MFIX  2016-1
run_mod.f
Go to the documentation of this file.
1 ! -*- f90 -*-
2 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
3 ! C
4 ! Module name: run C
5 ! Purpose: Common block containing run control data C
6 ! C
7 ! Author: M. Syamlal Date: dd-mmm-yy C
8 ! Reviewer: Date: dd-mmm-yy C
9 ! C
10 ! C
11 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
12 
13  MODULE run
14 
15 ! Modules
16 !---------------------------------------------------------------------//
17  use param, only: dim_m, dim_eqs
18  use param1, only: undefined_i
19  use derived_types
20 !---------------------------------------------------------------------//
21 
22 ! Main filename to be used for output files Name must
23 ! still be legal after extensions are added to it.
24  CHARACTER(LEN=60) :: run_name
25 
26 ! Brief description of the problem.
27  CHARACTER(LEN=60) :: description
28 
29 ! Units for data input and output: CGS.
30  CHARACTER(LEN=16) :: units
31 
32 ! Type of run: NEW, RESTART
33  CHARACTER(LEN=16) :: run_type
34 
35 ! Variable which triggers automatic restart
36  LOGICAL :: automatic_restart
37 
38 ! counter to keep track of how many auto_retart were performed
39  INTEGER :: iter_restart
40 
41 ! version.release of software
42  CHARACTER(LEN=10) :: id_version
43 
44 ! Start-time of the run.
45  DOUBLE PRECISION :: time
46 
47 ! Stop-time of the run.
48  DOUBLE PRECISION :: tstop
49 
50 ! Time step.
51  DOUBLE PRECISION :: dt
52 
53 ! 1./Time step.
54  DOUBLE PRECISION :: odt
55 
56 ! Indicates whether simulation is steady-state
57  LOGICAL :: steady_state
58 
59 ! Number of times steps completed.
60  INTEGER :: nstep
61 
62 ! Declare a new variable to use on CN with RESTART cases
63 ! Number of time steps when restart file was read
64  INTEGER :: nsteprst
65 
66 ! Discretization scheme for different equations
67  INTEGER :: discretize(dim_eqs)
68 
69 ! Use Chi scheme for discretizing certain equation sets
70 ! (species mass fractions)
71  LOGICAL :: chi_scheme
72 
73 ! If .TRUE. solve X momentum equations
74  LOGICAL :: momentum_x_eq(0:dim_m)
75 
76 ! If .TRUE. solve Y momentum equations
77  LOGICAL :: momentum_y_eq(0:dim_m)
78 
79 ! If .TRUE. solve Z momentum equations
80  LOGICAL :: momentum_z_eq(0:dim_m)
81 
82 ! IF .TRUE. use Jackson form momentum equations
83  LOGICAL :: jackson
84 ! IF .TRUE. use Ishii form momentum equations
85  LOGICAL :: ishii
86 
87 ! If .TRUE. use Model-B momentum equations
88  LOGICAL :: model_b
89 
90 ! If .TRUE. include added (virtual) mass in momentum eq.
91  LOGICAL :: added_mass
92 
93 ! phase number where added mass is applied.
94  INTEGER :: m_am
95 
96 ! If .TRUE. solve K_Epsilon turbulence eq.
97  LOGICAL :: k_epsilon
98 
99 ! If .TRUE. solve energy equations
100  LOGICAL :: energy_eq
101 
102 ! If .TRUE. use the deferred correction method
103  LOGICAL :: def_cor
104 
105 ! If .TRUE. use the fourth order interpolation
106  LOGICAL :: fpfoi
107 
108 ! If .TRUE. activate 2nd order accurate time implementation
109  LOGICAL :: cn_on
110 
111 ! If .TRUE. solve granular energy equations
112  LOGICAL :: granular_energy
113 
114 ! If .TRUE. solve species balance equations
115  LOGICAL :: species_eq(0:dim_m)
116 
117 ! If .TRUE. one of the species equations is being solved
118  LOGICAL :: any_species_eq
119 
120 ! If .TRUE. call user-defined subroutines
121  LOGICAL :: call_usr
122 
123 ! If .TRUE. force time-step when NIT=MAX_NIT and DT=DT_MIN
124  LOGICAL :: persistent_mode
125 
126 ! If .TRUE. solve population balance equations
127  LOGICAL :: call_dqmom
128 
129 ! If .TRUE. incorporate the wall effects upon the calculation of the
130 ! subgrid solids viscosity, solids pressure, and gas-solids drag
131  LOGICAL :: subgrid_wall
132 ! the ratio of the FilterSize to the GridSize
133  DOUBLE PRECISION :: filter_size_ratio
134 
135 ! Single particle drag correlation
136  CHARACTER(64) :: cd_function
137 
138 ! Parameter used to calculate lubrication interactions between
139 ! different particles in HYS drag model
140  DOUBLE PRECISION :: lam_hys
141 
142 ! If .TRUE. use Simonin model (k_epsilon must also be true)
143  LOGICAL :: simonin
144 
145 ! If .TRUE. use Ahmadi model (k_epsilon must also be true)
146  LOGICAL :: ahmadi
147 
148 ! If .TRUE. calculate frictional stress terms
149  LOGICAL :: friction
150 ! Form of friction model:
151 ! If 0: use S:S
152 ! If 1: use the form of Savage to compute S:S
153 ! If 2: use combination of both for frictional stress terms
154  INTEGER :: savage
155 
156 ! If .TRUE. use Scheffer frictional stress (default set to .TRUE.)
157  LOGICAL :: schaeffer
158 
159 ! If .TRUE. use blending frictional/kinetic stresses
160 ! (default set to .FALSE. do not blend)
161  LOGICAL :: blending_stress
162  LOGICAL :: tanh_blend ! default set to true
163  LOGICAL :: sigm_blend ! default set to false
164 
165 ! If .TRUE. use Jenkins small friction BC
166  LOGICAL :: jenkins
167 ! If .TRUE. use revised phip for JJ BC
168  LOGICAL :: bc_jj_m
169 ! If .TRUE. output PHIP to JJ_PHIP.dat
170  LOGICAL :: phip_out_jj
171 ! to write specularity
172  INTEGER :: phip_out_iter
173 
174 ! If .TRUE. treat system as if shearing
175  LOGICAL :: shear
176 ! Shear Vel
177  DOUBLE PRECISION :: v_sh
178 
179 ! If .TRUE. use Yu and Standish correlation to compute ep_star
180  LOGICAL :: yu_standish
181 
182 ! If .TRUE. use Fedors and Landel correlation to compute ep_star
183  LOGICAL :: fedors_landel
184 
185 ! STOP Trigger mechanism to terminate MFIX normally before batch
186 ! queue terminates flag variable to check for end of batch queue when
187 ! set to TRUE check performed at the beginning of each time step and
188 ! termination of mfix triggered after saving all files if condition
189 ! is met
190  LOGICAL :: chk_batchq_end
191 ! variable to store the total wall clock duration of the batch queue
192 ! session wall clock time specified in seconds
193 ! for jaguarcnl@NCCS max wall clock limit is 2.5 hr limit up to 512
194 ! processors
195  DOUBLE PRECISION :: batch_wallclock
196 ! variable to set a buffer time before the batch queue session ends to
197 ! make sure once MFIX is triggered to shutdown, there is sufficient
198 ! time to save files, make copies to HPSS storage before batch queue
199 ! time runs out. Current logic in MFIX checks for:
200 ! if CPU_TIME > (BATCH_WALLCLOCK - TERM_BUFFER) then
201 ! save all .RES .SP files and trigger shutdown
202  DOUBLE PRECISION :: term_buffer
203 
204 ! If .TRUE. code will automatically restart for DT < DT_MIN
205  LOGICAL :: auto_restart
206 
207 ! If .TRUE. code will automatically restart for DT < DT_MIN
208  LOGICAL :: reinitializing = .false.
209 
210 ! Time-step failure rate:
211 ! 1) Number of failed time steps
212 ! 2) Observation window
213  INTEGER :: timestep_fail_rate(2)
214 
215 ! parameters for dynamically adjusting time step
216 ! +1 -> increase dt; -1 decrease dt
217  INTEGER :: dt_dir = -1
218 
219 ! Maximum Time step.
220  DOUBLE PRECISION :: dt_max
221 
222 ! Minimum Time step.
223  DOUBLE PRECISION :: dt_min
224 
225 ! Time step adjustment factor (<1.0)
226  DOUBLE PRECISION :: dt_fac
227 
228 ! The previous time step used in iterate (before it is
229 ! changed by adjust_dt)
230  DOUBLE PRECISION :: dt_prev
231 
232 ! in case iterations converged and DT modified, use old dt
233 ! to advance time in time_march.
234  LOGICAL :: use_dt_prev
235 
236 ! Slope limiter parameter (0 < C _FAC <= 1.0)
237  DOUBLE PRECISION :: c_fac
238 
239 ! If .TRUE. reduce time step when residuals do not decrease
240  LOGICAL :: detect_stall
241 
242 ! String which controls reduction of global sums for residual
243 ! calculations
244  LOGICAL :: debug_resid
245 
246  common /run_dp/ time !for Linux
247 
248 
249 ! Flags indicating variable solids density.
251 
252 ! Specifies the type of solids: TFM, DEM, MPPIC
253  CHARACTER(len=3), DIMENSION(DIM_M) :: solids_model
254 
255 ! Flags for various solids phase models.
256  LOGICAL :: tfm_solids
257  LOGICAL :: dem_solids
258  LOGICAL :: pic_solids
259 ! The number of the various solids phases.
260  INTEGER :: tfm_count = 0
261  INTEGER :: dem_count = 0
262  INTEGER :: pic_count = 0
263 
264  ! Error index
265  INTEGER :: ier
266 
267  ! CPU time unit.
268  CHARACTER(LEN=4) :: tunit
269 
270  CONTAINS
271 
272  !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
273  ! Purpose: Given time in seconds, calculate time in days/hours/seconds
274  !
275  !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
276  SUBROUTINE get_tunit(TLEFT, TUNIT)
278  !-----------------------------------------------
279  ! Modules
280  !-----------------------------------------------
281  IMPLICIT NONE
282  !-----------------------------------------------
283  ! Dummy arguments
284  !-----------------------------------------------
285  DOUBLE PRECISION, INTENT(INOUT) :: TLEFT
286  CHARACTER(LEN=4) :: TUNIT
287  !-----------------------------------------------
288 
289  IF (tleft < 3600.0d0) THEN
290  tunit = 's'
291  ELSE
292  tleft = tleft/3600.0d0
293  tunit = 'h'
294  IF (tleft >= 24.) THEN
295  tleft = tleft/24.0d0
296  tunit = 'days'
297  ENDIF
298  ENDIF
299 
300  RETURN
301  END SUBROUTINE get_tunit
302 
303  END MODULE run
logical, dimension(0:dim_m) momentum_y_eq
Definition: run_mod.f:77
logical dem_solids
Definition: run_mod.f:257
logical steady_state
Definition: run_mod.f:57
character(len=60) description
Definition: run_mod.f:27
double precision dt_prev
Definition: run_mod.f:230
integer pic_count
Definition: run_mod.f:262
double precision dt_fac
Definition: run_mod.f:226
logical shear
Definition: run_mod.f:175
logical ishii
Definition: run_mod.f:85
logical use_dt_prev
Definition: run_mod.f:234
double precision lam_hys
Definition: run_mod.f:140
logical sigm_blend
Definition: run_mod.f:163
integer dt_dir
Definition: run_mod.f:217
logical added_mass
Definition: run_mod.f:91
logical, dimension(0:dim_m) momentum_x_eq
Definition: run_mod.f:74
character(len=60) run_name
Definition: run_mod.f:24
logical, dimension(0:dim_m) species_eq
Definition: run_mod.f:115
logical subgrid_wall
Definition: run_mod.f:131
logical friction
Definition: run_mod.f:149
integer, parameter dim_eqs
Definition: param_mod.f:97
integer, parameter dim_m
Definition: param_mod.f:67
logical, dimension(0:dim_m) momentum_z_eq
Definition: run_mod.f:80
logical, dimension(dim_m) solve_ros
Definition: run_mod.f:250
double precision dt
Definition: run_mod.f:51
logical automatic_restart
Definition: run_mod.f:36
character(len=3), dimension(dim_m) solids_model
Definition: run_mod.f:253
logical detect_stall
Definition: run_mod.f:240
logical cn_on
Definition: run_mod.f:109
integer, dimension(2) timestep_fail_rate
Definition: run_mod.f:213
double precision term_buffer
Definition: run_mod.f:202
integer phip_out_iter
Definition: run_mod.f:172
logical jackson
Definition: run_mod.f:83
logical chk_batchq_end
Definition: run_mod.f:190
character(64) cd_function
Definition: run_mod.f:136
integer ier
Definition: run_mod.f:265
double precision dt_max
Definition: run_mod.f:220
integer dem_count
Definition: run_mod.f:261
logical jenkins
Definition: run_mod.f:166
logical bc_jj_m
Definition: run_mod.f:168
logical simonin
Definition: run_mod.f:143
integer m_am
Definition: run_mod.f:94
logical chi_scheme
Definition: run_mod.f:71
double precision tstop
Definition: run_mod.f:48
character(len=16) run_type
Definition: run_mod.f:33
logical persistent_mode
Definition: run_mod.f:124
double precision odt
Definition: run_mod.f:54
double precision filter_size_ratio
Definition: run_mod.f:133
logical schaeffer
Definition: run_mod.f:157
logical any_species_eq
Definition: run_mod.f:118
integer tfm_count
Definition: run_mod.f:260
logical tfm_solids
Definition: run_mod.f:256
character(len=4) tunit
Definition: run_mod.f:268
integer savage
Definition: run_mod.f:154
logical call_dqmom
Definition: run_mod.f:127
Definition: run_mod.f:13
logical yu_standish
Definition: run_mod.f:180
Definition: param_mod.f:2
logical def_cor
Definition: run_mod.f:103
character(len=16) units
Definition: run_mod.f:30
double precision batch_wallclock
Definition: run_mod.f:195
logical blending_stress
Definition: run_mod.f:161
logical ahmadi
Definition: run_mod.f:146
integer nsteprst
Definition: run_mod.f:64
logical any_solve_ros
Definition: run_mod.f:250
logical k_epsilon
Definition: run_mod.f:97
logical reinitializing
Definition: run_mod.f:208
integer nstep
Definition: run_mod.f:60
logical energy_eq
Definition: run_mod.f:100
logical fedors_landel
Definition: run_mod.f:183
integer, parameter undefined_i
Definition: param1_mod.f:19
logical phip_out_jj
Definition: run_mod.f:170
integer, dimension(dim_eqs) discretize
Definition: run_mod.f:67
double precision dt_min
Definition: run_mod.f:223
double precision c_fac
Definition: run_mod.f:237
logical model_b
Definition: run_mod.f:88
logical tanh_blend
Definition: run_mod.f:162
logical auto_restart
Definition: run_mod.f:205
double precision time
Definition: run_mod.f:45
logical granular_energy
Definition: run_mod.f:112
logical pic_solids
Definition: run_mod.f:258
logical fpfoi
Definition: run_mod.f:106
subroutine get_tunit(TLEFT, TUNIT)
Definition: run_mod.f:277
integer iter_restart
Definition: run_mod.f:39
character(len=10) id_version
Definition: run_mod.f:42
double precision v_sh
Definition: run_mod.f:177
logical call_usr
Definition: run_mod.f:121
logical debug_resid
Definition: run_mod.f:244