MFIX  2016-1
check_numerics.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: CHECK_NUMERICS !
4 ! Purpose: Check the numerics control namelist section !
5 ! !
6 ! Author: P. Nicoletti Date: 27-NOV-91 !
7 ! !
8 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
9  SUBROUTINE check_numerics
10 
11 
12 ! Global Variables:
13 !---------------------------------------------------------------------//
14 ! Flag: Use the Fourth-order scheme
15  use run, only: fpfoi
16 ! Flag: Use the Chi-scheme
17  use run, only: chi_scheme
18 ! Flag: Set optimal LEQ solver parameters for parallel runs.
19  use leqsol, only: opt_parallel
20 ! Discretization scheme for various equations
21  USE run, only: discretize, shear
22 ! Solve system transpose
23  use leqsol, only: do_transpose
24 ! Minimize dot products in BiCGSTAB
25  use leqsol, only: minimize_dotproducts
26 ! Report solver stats.
27  use leqsol, only: solver_statistics
28 ! Controls reduction of global sums for residuals.
29  use run, only: debug_resid
30 ! Linear equation, preconditioner sweep method.
31  use leqsol, only: leq_sweep
32 ! Linear equation solution method.
33  use leqsol, only: leq_method
34 ! Calculate dot-products more efficiently for serial runs.
35  use parallel, only: is_serial
36 
37  use param, only: dim_eqs
38 
39 ! Global Parameters:
40 !---------------------------------------------------------------------//
41 ! NONE
42 
43 ! Global Module procedures:
44 !---------------------------------------------------------------------//
45  use error_manager
46 
47 
48  IMPLICIT NONE
49 
50 
51 ! Local Variables:
52 !---------------------------------------------------------------------//
53 ! Loop counter
54  INTEGER :: L
55 
56 
57 !......................................................................!
58 
59 
60 ! Initialize the error manager.
61  CALL init_err_msg("CHECK_NUMERICS")
62 
63  DO l = 1,dim_eqs
64  IF(discretize(l) > 9 .OR. discretize(l) < 0) THEN
65  WRITE(err_msg,2002) trim(ivar('DISCRETIZE',l)),&
66  trim(ival(discretize(l)))
67  CALL flush_err_msg(abort=.true.)
68  ENDIF
69  ENDDO
70  2002 FORMAT('Error 2002: Invalid option ', a,' = ', a, '.',/ &
71  'Please correct the mfix.dat file.')
72 
73 
74 ! Check fourth-order scheme requirements.
75  IF (fpfoi) THEN
76  DO l = 1,dim_eqs
77  IF(discretize(l) <= 1) THEN
78  WRITE(err_msg,2000)
79  CALL flush_err_msg(abort=.true.)
80  ENDIF
81  ENDDO
82  2000 FORMAT('Error 2000: Fourth-order scheme (FPFOI) requires ', &
83  'DISCRETIZE >= 2',/'for all equations. Please correct the ', &
84  'mfix.dat file.')
85  ENDIF
86 
87 
88 ! Check chi scheme requirements.
89  IF(chi_scheme)THEN
90  IF(discretize(7) .NE. 3 .AND. discretize(7).NE.6) THEN
91  WRITE(err_msg,2001)
92  CALL flush_err_msg(abort=.true.)
93  2001 FORMAT('Error 2001: CHI_SCHEME for species equations is only ', &
94  'implemented',/'for SMART and MUSCL discretization schemes ', &
95  '[DISCRTIZE(7)].',/'Please correct the mfix.dat file.')
96  ENDIF
97  IF (shear) THEN
98  WRITE(err_msg,2003)
99  CALL flush_err_msg(abort=.true.)
100  2003 FORMAT('Error 2003: CHI_SCHEME is currently not implemented ', &
101  'with SHEAR ',/'option. See calc_chi in module chischeme for '&
102  'details.',/'Please correct the mfix.dat file.')
103  ENDIF
104  ENDIF
105 
106 
107 ! Set the optimizations for DMP runs.
108  IF (opt_parallel) THEN
109  is_serial = .false.
110  do_transpose = .false.
111  minimize_dotproducts = .true.
112  solver_statistics = .true.
113  debug_resid = .false.
114  leq_sweep(1:2) = 'ASAS'
115  leq_method(1:2) = 2
116  leq_method(3:9) = 1
117  ENDIF
118 
119 ! Finalize the error msg.
120  CALL finl_err_msg
121 
122  RETURN
123 
124  END SUBROUTINE check_numerics
character(len=32) function ivar(VAR, i1, i2, i3)
subroutine finl_err_msg
logical shear
Definition: run_mod.f:175
integer, parameter dim_eqs
Definition: param_mod.f:97
character(len=4), dimension(dim_eqs) leq_sweep
Definition: leqsol_mod.f:20
logical do_transpose
Definition: leqsol_mod.f:32
subroutine check_numerics
subroutine init_err_msg(CALLER)
logical chi_scheme
Definition: run_mod.f:71
logical is_serial
Definition: parallel_mod.f:11
Definition: run_mod.f:13
Definition: param_mod.f:2
logical minimize_dotproducts
Definition: leqsol_mod.f:29
character(len=line_length), dimension(line_count) err_msg
integer, dimension(dim_eqs) discretize
Definition: run_mod.f:67
integer, dimension(dim_eqs) leq_method
Definition: leqsol_mod.f:14
logical solver_statistics
Definition: leqsol_mod.f:41
logical fpfoi
Definition: run_mod.f:106
logical opt_parallel
Definition: leqsol_mod.f:38
subroutine flush_err_msg(DEBUG, HEADER, FOOTER, ABORT, LOG, CALL_TREE)
logical debug_resid
Definition: run_mod.f:244