MFIX  2016-1
read_namelist.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Module name: READ_NAMELIST(POST) !
4 ! Author: P. Nicoletti Date: 25-NOV-91 !
5 ! !
6 ! Purpose: Read in the NAMELIST variables !
7 ! !
8 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
9  SUBROUTINE read_namelist(READ_ACTION, FILENAME)
10 
11  USE bc
12  USE cdist
13  USE compar
14  USE constant
15  USE cutcell
16  USE dashboard
17  USE des_bc
18  USE des_rxns
19  USE des_thermo
20  USE discretelement
21  USE error_manager
22  USE fldvar
23  USE funits
24  USE geometry
25  USE ic
26  USE indices
27  USE is
28  USE iterate, only: max_nit
29  USE leqsol
31  USE mfix_pic
32  USE output
33  USE parallel
34  USE param1, only: undefined
35  USE particle_filter
36  USE physprop
37  USE pic_bc
38  USE polygon
39  USE ps
41  USE quadric
42  USE residual
43  USE run
44  USE rxns
45  USE scalars
46  USE scales
47  USE stiff_chem
48  USE toleranc
49  USE ur_facs
50  USE usr
51  USE utilities
52  USE vtk
53  Use stl
54  use usr_prop, only: usr_fgs, usr_fss, usr_gama
57  use usr_src, only: call_usr_source
58  IMPLICIT NONE
59 
60 ! Dummy Arguments:
61 !------------------------------------------------------------------------//
62 ! Specify how much of the input to process.
63  INTEGER, INTENT(IN) :: READ_ACTION
64 
65 ! Filename of the input file
66  CHARACTER(LEN=*), INTENT(IN) :: FILENAME
67 
68 ! Local Variables:
69 !------------------------------------------------------------------------//
70 ! LINE_STRING(1:MAXCOL) has valid input data
71  INTEGER, PARAMETER :: MAXCOL = 80
72 ! Holds one line in the input file
73  CHARACTER(LEN=512) :: LINE_STRING
74 ! Length of noncomment string
75  INTEGER :: LINE_LEN
76 ! Line number
77  INTEGER :: LINE_NO
78 ! Coefficient of restitution (old symbol)
79  DOUBLE PRECISION e
80 ! Indicates whether currently reading rxns or rate
81  LOGICAL :: RXN_FLAG
82 ! Indicate whether to do a namelist read on the line
83  LOGICAL :: READ_FLAG
84 ! Logical to check if file exits.
85  LOGICAL :: lEXISTS
86 ! Error flag
87  LOGICAL :: ERROR
88 
89  CHARACTER(len=256) :: STRING
90  INTEGER :: IOS, II
91 
92 ! Flags restricting what data from the mfix.dat to process
93  LOGICAL :: READ_LOCKED, READ_FULL
94 
95 ! Local Parameters:
96 !---------------------------------------------------------------------//
97  INTEGER, PARAMETER :: READ_MFIX = 0
98  INTEGER, PARAMETER :: READ_POST = 1
99  INTEGER, PARAMETER :: READ_INIT = 2
100 
101 ! External Functions
102 !---------------------------------------------------------------------//
103 ! Returns integer if data past column MAXCOL.
104 ! INTEGER, EXTERNAL :: LINE_TOO_BIG
105 ! Integer function which returns COMMENT_INDEX
106 ! INTEGER, EXTERNAL :: SEEK_COMMENT
107 ! Blank line function
108 ! LOGICAL, EXTERNAL :: BLANK_LINE
109 
110  e = undefined
111  rxn_flag = .false.
112  read_flag = .true.
113  no_of_rxns = 0
114  line_no = 0
115 
116  SELECT CASE(read_action)
117  CASE(read_mfix)
118  read_locked = .true.
119  read_full = .true.
120  CASE(read_post)
121  read_locked = .true.
122  read_full = .false.
123  CASE(read_init)
124  read_locked = .false.
125  read_full = .true.
126  END SELECT
127 
128 ! Open the mfix.dat file. Report errors if the file is not located or
129 ! there is difficulties opening it.
130  inquire(file=filename,exist=lexists)
131  IF(.NOT.lexists) THEN
132  IF(mype == pe_io) WRITE(*,1000)
133  CALL mfix_exit(mype)
134 
135  1000 FORMAT(2/,1x,70('*')/' From: READ_NAMELIST',/' Error 1000: ', &
136  'The input data file, mfix.dat, is missing. Aborting.',/1x, &
137  70('*'),2/)
138 
139  ELSE
140  OPEN(unit=unit_dat, file=filename, status='OLD', iostat=ios)
141  IF(ios /= 0) THEN
142  IF(mype == pe_io) WRITE (*,1001)
143  CALL mfix_exit(mype)
144  ENDIF
145 
146  1001 FORMAT(2/,1x,70('*')/' From: READ_NAMELIST',/' Error 1001: ', &
147  'Unable to open the mfix.dat file. Aborting.',/1x,70('*'),2/)
148  ENDIF
149 
150 
151 ! Loop through the mfix.dat file and process the input data.
152  read_lp: DO
153  READ (unit_dat,"(A)",iostat=ios) line_string
154  IF(ios < 0) EXIT read_lp
155 
156  line_no = line_no + 1
157 
158  line_len = seek_comment(line_string,len(line_string)) - 1
159  CALL remove_comment(line_string, line_len+1, len(line_string))
160 
161  IF(line_len <= 0) cycle read_lp ! comment line
162  IF(blank_line(line_string)) cycle read_lp ! blank line
163 
164  IF(line_too_big(line_string,line_len,maxcol) > 0) THEN
165  WRITE (*, 1100) trim(ival(line_no)), trim(ival(maxcol)), &
166  line_string(1:maxcol)
167  CALL mfix_exit(mype)
168  ENDIF
169 
170  1100 FORMAT(//1x,70('*')/1x,'From: READ_NAMELIST',/1x,'Error 1100: ', &
171  'Line ',a,' in mfix.dat has is too long. Input lines should', &
172  /1x,'not pass column ',a,'.',2/3x,a,2/1x,'Please correct ', &
173  'the mfix.dat file.',/1x,70('*'),2/)
174 
175 ! All subsequent lines are thermochemical data
176  IF(line_string(1:11) == 'THERMO DATA') EXIT read_lp
177 
178  CALL set_keyword(error)
179  IF (error) THEN
180 ! At this point, the keyword was not identified therefore it is
181 ! either deprecated or unknown.
182  CALL deprecated_or_unknown(line_no, line_string(1:line_len))
183  ENDIF
184 
185  ENDDO read_lp
186 
187  DO ii=1, cmd_line_args_count
188  line_string = cmd_line_args(ii)
189  line_len = len(line_string)
190  CALL set_keyword(error)
191  IF (error) THEN
192  CALL deprecated_or_unknown(line_no, line_string(1:line_len))
193  ENDIF
194  ENDDO
195 
196  CLOSE(unit=unit_dat)
197  IF (e /= undefined) c_e = e
198 
199  RETURN
200 
201  CONTAINS
202 
203 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
204 ! !
205 ! Subroutine: SET_KEYWORD(ERROR) !
206 ! Author: P. Nicoletti Date: 25-NOV-91 !
207 ! !
208 ! Purpose: Process LINE_STRING for MFIX keyword data. !
209 ! !
210 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
211  SUBROUTINE set_keyword(ERROR)
213  IMPLICIT NONE
214 
215  LOGICAL, INTENT(OUT) ::ERROR
216 
217 
218 
219 ! External namelist files:
220 !---------------------------------------------------------------------//
221  include 'run_control.inc'
222  include 'physical_params.inc'
223  include 'numerical_params.inc'
224  include 'geometry.inc'
225  include 'gas_phase.inc'
226  include 'solids_phase.inc'
227  include 'tfm_solids.inc'
228  include 'initial_conditions.inc'
229  include 'boundary_conditions.inc'
230  include 'internal_surfaces.inc'
231  include 'point_sources.inc'
232  include 'output_control.inc'
233  include 'usr_hooks.inc'
234  include 'chem_equations.inc'
235  include 'dmp_batch_control.inc'
236  include 'desnamelist.inc'
237  include 'cartesian_grid_namelist.inc'
238  include 'qmomknamelist.inc'
239  include 'legacy.inc'
240  include 'usrnlst.inc'
241 
242  error = .false.
243 
244 ! Make upper case all except species names
245  if(index(line_string,'SPECIES_NAME') == 0 .AND. &
246  index(line_string,'species_name') == 0 .AND. &
247  index(line_string,'Species_Name') == 0 .AND. &
248  index(line_string,'SPECIES_g') == 0 .AND. &
249  index(line_string,'Species_g') == 0 .AND. &
250  index(line_string,'species_g') == 0 .AND. &
251  index(line_string,'SPECIES_s') == 0 .AND. &
252  index(line_string,'Species_s') == 0 .AND. &
253  index(line_string,'species_s') == 0) &
254  CALL make_upper_case (line_string, line_len)
255 
256  CALL replace_tab (line_string, line_len)
257  CALL remove_par_blanks(line_string)
258 
259 ! Complete arithmetic operations and expand line
260  CALL parse_line (line_string, line_len, rxn_flag, read_flag)
261 
262 ! Write the current line to a scratch file
263 ! and read the scratch file in NAMELIST format
264  IF(.NOT.read_flag) RETURN
265 
266 
267 ! Run control keywords
268  IF(read_locked) THEN
269  string=''; string = '&RUN_CONTROL_LOCKED '//&
270  trim(adjustl(line_string(1:line_len)))//'/'
271  READ(string, nml=run_control_locked, iostat=ios)
272  IF(ios == 0) RETURN
273  ENDIF
274 
275  string=''; string = '&RUN_CONTROL_UNLOCKED '//&
276  trim(adjustl(line_string(1:line_len)))//'/'
277  READ(string, nml=run_control_unlocked, iostat=ios)
278  IF(ios == 0) RETURN
279 
280 
281 ! Physical parameter keywords
282  IF(read_locked) THEN
283  string=''; string = '&PHYSICAL_PARAM_LOCKED '//&
284  trim(adjustl(line_string(1:line_len)))//'/'
285  READ(string, nml=physical_param_locked, iostat=ios)
286  IF(ios == 0) RETURN
287  ENDIF
288 
289  string=''; string = '&PHYSICAL_PARAM_UNLOCKED '//&
290  trim(adjustl(line_string(1:line_len)))//'/'
291  READ(string, nml=physical_param_unlocked, iostat=ios)
292  IF(ios == 0) RETURN
293 
294 
295 ! Numerical parameter keywords
296  IF(read_locked) THEN
297  string=''; string = '&NUMERICAL_PARAM_LOCKED '//&
298  trim(adjustl(line_string(1:line_len)))//'/'
299  READ(string, nml=numerical_param_locked, iostat=ios)
300  IF(ios == 0) RETURN
301  ENDIF
302 
303  string=''; string = '&NUMERICAL_PARAM_UNLOCKED '//&
304  trim(adjustl(line_string(1:line_len)))//'/'
305  READ(string, nml=numerical_param_unlocked, iostat=ios)
306  IF(ios == 0) RETURN
307 
308 
309 ! Geometry and discretization keywords
310  IF(read_locked) THEN
311  string=''; string = '&GEOMETRY_LOCKED '//&
312  trim(adjustl(line_string(1:line_len)))//'/'
313  READ(string, nml=geometry_locked, iostat=ios)
314  IF(ios == 0) RETURN
315  ENDIF
316 
317  string=''; string = '&GEOMETRY_UNLOCKED '//&
318  trim(adjustl(line_string(1:line_len)))//'/'
319  READ(string, nml=geometry_unlocked, iostat=ios)
320  IF(ios == 0) RETURN
321 
322 
323 ! Gas phase keywords
324  IF(read_locked) THEN
325  string=''; string = '&GAS_PHASE_LOCKED '//&
326  trim(adjustl(line_string(1:line_len)))//'/'
327  READ(string, nml=gas_phase_locked, iostat=ios)
328  IF(ios == 0) RETURN
329  ENDIF
330 
331  string=''; string = '&GAS_PHASE_UNLOCKED '//&
332  trim(adjustl(line_string(1:line_len)))//'/'
333  READ(string, nml=gas_phase_unlocked, iostat=ios)
334  IF(ios == 0) RETURN
335 
336 
337 ! Solidss phase keywords
338  IF(read_locked) THEN
339  string=''; string = '&SOLIDS_PHASE_LOCKED '//&
340  trim(adjustl(line_string(1:line_len)))//'/'
341  READ(string, nml=solids_phase_locked, iostat=ios)
342  IF(ios == 0) RETURN
343  ENDIF
344 
345  string=''; string = '&SOLIDS_PHASE_UNLOCKED '//&
346  trim(adjustl(line_string(1:line_len)))//'/'
347  READ(string, nml=solids_phase_unlocked, iostat=ios)
348  IF(ios == 0) RETURN
349 
350 
351 ! Two-fluid solids keywords
352  string=''; string = '&TFM_SOLIDS_UNLOCKED '//&
353  trim(adjustl(line_string(1:line_len)))//'/'
354  READ(string, nml=tfm_solids_unlocked, iostat=ios)
355  IF(ios == 0) RETURN
356 
357 
358 ! Initial condtion keywords
359  IF(read_locked) THEN
360  string=''; string = '&INITIAL_CONDITIONS_LOCKED '//&
361  trim(adjustl(line_string(1:line_len)))//'/'
362  READ(string, nml=initial_conditions_locked, iostat=ios)
363  IF(ios == 0) RETURN
364  ENDIF
365 
366  string=''; string = '&INITIAL_CONDITIONS_UNLOCKED '//&
367  trim(adjustl(line_string(1:line_len)))//'/'
368  READ(string, nml=initial_conditions_unlocked, iostat=ios)
369  IF(ios == 0) RETURN
370 
371 
372 ! Boundary condition keywords
373  IF(read_locked) THEN
374  string=''; string = '&BOUNDARY_CONDITIONS_LOCKED '//&
375  trim(adjustl(line_string(1:line_len)))//'/'
376  READ(string, nml=boundary_conditions_locked, iostat=ios)
377  IF(ios == 0) RETURN
378  ENDIF
379 
380  string=''; string = '&BOUNDARY_CONDITIONS_UNLOCKED '//&
381  trim(adjustl(line_string(1:line_len)))//'/'
382  READ(string, nml=boundary_conditions_unlocked, iostat=ios)
383  IF(ios == 0) RETURN
384 
385 
386 ! Internal surface keywords
387  IF(read_locked) THEN
388  string=''; string = '&INTERNAL_SURFACES_LOCKED '//&
389  trim(adjustl(line_string(1:line_len)))//'/'
390  READ(string, nml=internal_surfaces_locked, iostat=ios)
391  IF(ios == 0) RETURN
392  ENDIF
393 
394  string=''; string = '&INTERNAL_SURFACES_UNLOCKED '//&
395  trim(adjustl(line_string(1:line_len)))//'/'
396  READ(string, nml=internal_surfaces_unlocked, iostat=ios)
397  IF(ios == 0) RETURN
398 
399 
400 ! Point source keywords
401  string=''; string = '&POINT_SOURCES_UNLOCKED '//&
402  trim(adjustl(line_string(1:line_len)))//'/'
403  READ(string, nml=point_sources_unlocked, iostat=ios)
404  IF(ios == 0) RETURN
405 
406 
407 ! Output control keywords
408  IF(read_locked) THEN
409  string=''; string = '&OUTPUT_CONTROL_LOCKED '//&
410  trim(adjustl(line_string(1:line_len)))//'/'
411  READ(string, nml=output_control_locked, iostat=ios)
412  IF(ios == 0) RETURN
413  ENDIF
414 
415  string=''; string = '&OUTPUT_CONTROL_UNLOCKED '//&
416  trim(adjustl(line_string(1:line_len)))//'/'
417  READ(string, nml=output_control_unlocked, iostat=ios)
418  IF(ios == 0) RETURN
419 
420 
421 ! User hook keywords
422  string=''; string = '&USER_HOOKS_UNLOCKED '//&
423  trim(adjustl(line_string(1:line_len)))//'/'
424  READ(string, nml=user_hooks_unlocked, iostat=ios)
425  IF(ios == 0) RETURN
426 
427 
428 ! Chemical equation keywords
429  string=''; string = '&CHEM_EQUATIONS_UNLOCKED '//&
430  trim(adjustl(line_string(1:line_len)))//'/'
431  READ(string, nml=chem_equations_unlocked, iostat=ios)
432  IF(ios == 0) RETURN
433 
434 
435 ! DMP and Batch Queue control keywords
436  IF(read_locked) THEN
437  string=''; string = '&DMP_BATCH_CONTROL_LOCKED '//&
438  trim(adjustl(line_string(1:line_len)))//'/'
439  READ(string, nml=dmp_batch_control_locked, iostat=ios)
440  IF(ios == 0) RETURN
441  ENDIF
442 
443  string=''; string = '&DMP_BATCH_CONTROL_UNLOCKED '//&
444  trim(adjustl(line_string(1:line_len)))//'/'
445  READ(string, nml=dmp_batch_control_unlocked, iostat=ios)
446  IF(ios == 0) RETURN
447 
448 
449 ! Legacy keywords
450  IF(read_locked) THEN
451  string=''; string = '&LEGACY_LOCKED '//&
452  trim(adjustl(line_string(1:line_len)))//'/'
453  READ(string, nml=legacy_locked, iostat=ios)
454  IF(ios == 0) RETURN
455 
456  ENDIF
457 
458 ! Stop processing keyword inputs if runing POST_MFIX
459  IF(.NOT.read_full) RETURN
460 
461 
462  IF(read_locked) THEN
463 
464 ! Discrete Element model input parameters.
465  string=''; string = '&DES_INPUT_DATA '//&
466  trim(adjustl(line_string(1:line_len)))//'/'
467  READ(string, nml=des_input_data, iostat=ios)
468  IF(ios == 0) RETURN
469 
470 
471 ! User defined input parameters.
472  string=''; string = '&USR_INPUT_DATA '//&
473  trim(adjustl(line_string(1:line_len)))//'/'
474  READ(string, nml=usr_input_data, iostat=ios)
475  IF(ios == 0) RETURN
476 
477 
478 ! Cartesian grid cut-cell input parameters.
479  string=''; string = '&CARTESIAN_GRID_INPUT_DATA '//&
480  trim(adjustl(line_string(1:line_len)))//'/'
481  READ(string, nml=cartesian_grid_input_data, iostat=ios)
482  IF(ios == 0) RETURN
483 
484 
485 ! QMOMK input parameters.
486  string=''; string = '&QMOMK_INPUT_DATA '//&
487  trim(adjustl(line_string(1:line_len)))//'/'
488  READ(string, nml=qmomk_input_data, iostat=ios)
489  IF(ios == 0) RETURN
490  ENDIF
491 
492  IF(read_locked) error = .true.
493 
494  RETURN
495  END SUBROUTINE set_keyword
496 
497 END SUBROUTINE read_namelist
logical, dimension(dim_m) usr_ros
Definition: usr_prop_mod.f:9
double precision c_e
Definition: constant_mod.f:105
subroutine remove_par_blanks(LINE)
subroutine replace_tab(LINE_STRING, MAXCOL)
logical usr_rog
Definition: usr_prop_mod.f:7
subroutine remove_comment(LINE, LSTART, MAXCOL)
Definition: rxns_mod.f:1
logical usr_mug
Definition: usr_prop_mod.f:13
Definition: vtk_mod.f:1
subroutine set_keyword(ERROR)
double precision, parameter undefined
Definition: param1_mod.f:18
integer function seek_comment(LINE, MAXCOL)
Definition: is_mod.f:11
double precision, dimension(:), allocatable a
Definition: scalars_mod.f:29
subroutine parse_line(LINE, LMAX, RXN_FLAG, READ_FLAG)
Definition: parse_line.f:23
subroutine deprecated_or_unknown(LINE_NO, INPUT)
Definition: deprecated.f:12
logical, dimension(dim_m) usr_difs
Definition: usr_prop_mod.f:18
integer pe_io
Definition: compar_mod.f:30
Definition: ic_mod.f:9
logical usr_difg
Definition: usr_prop_mod.f:15
logical usr_cpg
Definition: usr_prop_mod.f:8
Definition: stl_mod.f:1
Definition: cdist_mod.f:2
integer no_of_rxns
Definition: rxns_mod.f:41
integer cmd_line_args_count
Definition: main.f:37
Definition: run_mod.f:13
logical, dimension((dim_m *(dim_m-1)/2)+1) usr_fss
Definition: usr_prop_mod.f:22
Definition: usr_mod.f:1
integer function line_too_big(LINE, LINE_LEN, MAXCOL)
integer mype
Definition: compar_mod.f:24
logical, dimension(dim_m) usr_ks
Definition: usr_prop_mod.f:17
Definition: iterate.f:2
logical, dimension(dim_m) usr_mus
Definition: usr_prop_mod.f:16
character(len=80), dimension(100) cmd_line_args
Definition: main.f:36
integer max_nit
Definition: iterate.f:15
Definition: ps_mod.f:22
subroutine read_namelist(READ_ACTION, FILENAME)
Definition: read_namelist.f:10
Definition: main.f:10
logical function blank_line(line)
logical, dimension(dim_m) usr_fgs
Definition: usr_prop_mod.f:21
logical, dimension(dim_eqs) call_usr_source
Definition: usr_src_mod.f:7
logical usr_kg
Definition: usr_prop_mod.f:14
integer, parameter unit_dat
Definition: funits_mod.f:15
subroutine make_upper_case(LINE_STRING, MAXCOL)
double precision, dimension(:), allocatable x
Definition: geometry_mod.f:129
logical, dimension(dim_m) usr_cps
Definition: usr_prop_mod.f:10
Definition: bc_mod.f:23
logical, dimension(dim_m) usr_gama
Definition: usr_prop_mod.f:24