1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC 2 ! ! 3 ! Subroutine: CALC_COEFF_ALL ! 4 ! Purpose: This routine directs the calculation of all physical and ! 5 ! transport properties, exchange rates, and reaction rates. ! 6 ! ! 7 ! Author: M. Syamlal Date: 25-AUG-05 ! 8 ! Reviewer: Date: ! 9 ! ! 10 ! Literature/Document References: ! 11 ! ! 12 ! Variables referenced: ! 13 ! Variables modified: ! 14 ! Local variables: ! 15 ! ! 16 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 17 SUBROUTINE CALC_COEFF_ALL(FLAG, IER) 18 19 ! Global variables: 20 !----------------------------------------------------------------------- 21 ! Double precision: 1.0d0 22 use param1, only: ONE 23 ! Under relaxation factor for gas-solids drag coefficient 24 use ur_facs, only: UR_F_gs 25 ! Under relaxation factor solid conductivity coefficient for IA theory 26 use ur_facs, only: UR_kth_sml 27 ! Flag for explcit coupling between the fluid and particles. 28 use discretelement, only: DES_EXPLICITLY_COUPLED 29 30 implicit none 31 32 ! Dummy arguments 33 !----------------------------------------------------------------------- 34 ! FLAG = 0, overwrite the coeff arrays, (e.g. start of a time step) 35 ! FLAG = 1, do not overwrite 36 INTEGER, intent(in) :: FLAG 37 ! Error index 38 INTEGER, intent(inout) :: IER 39 40 ! Local variables 41 !----------------------------------------------- 42 ! Under relaxation factor for gas-solids drag coefficient 43 DOUBLE PRECISION :: loc_UR_F_gs ! Local copy 44 ! Under relaxation factor solid conductivity coefficient for IA theory 45 DOUBLE PRECISION :: loc_UR_kth_sml ! Local copy 46 47 !----------------------------------------------------------------------- 48 49 ! 1) Backup user-defined coefficient relaxation factors. 50 ! 2) Set user-defined coefficient relaxation factors to 1. 51 ! Note that 'FLAG' is hard coded to 0 in time march and reset_new. 52 IF(FLAG == 0) THEN 53 loc_UR_F_gs = UR_F_gs; UR_F_gs = ONE 54 loc_UR_Kth_sml = UR_Kth_sml; UR_Kth_sml = ONE 55 ENDIF 56 57 ! Calculate all physical properties, transport properties, and exchange 58 ! rates. 59 CALL CALC_COEFF(IER, 2) 60 61 IF(DES_EXPLICITLY_COUPLED) CALL CALC_DRAG_DES_EXPLICIT 62 63 ! Calculate reaction rates and interphase mass transfer. 64 CALL CALC_RRATE(IER) 65 66 ! Restore all coefficient underrelaxation factors to original values. 67 IF(FLAG == 0) THEN 68 UR_F_gs = loc_UR_F_gs 69 UR_Kth_sml = loc_UR_Kth_sml 70 ENDIF 71 72 73 RETURN 74 END SUBROUTINE CALC_COEFF_ALL 75 76 77 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 78 ! ! 79 ! Subroutine: CALC_COEFF ! 80 ! Purpose: This routine directs the calculation of all physical and ! 81 ! transport properties, and exchange rates. ! 82 ! ! 83 ! Author: M. Syamlal Date: 25-AUG-05 ! 84 ! Reviewer: Date: ! 85 ! ! 86 ! ! 87 ! ! 88 ! Literature/Document References: ! 89 ! ! 90 ! Variables referenced: ! 91 ! Variables modified: ! 92 ! Local variables: ! 93 ! ! 94 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 95 SUBROUTINE CALC_COEFF(IER, pLevel) 96 97 implicit none 98 99 ! Dummy arguments 100 !----------------------------------------------------------------------- 101 ! Error index 102 INTEGER, intent(inout) :: IER 103 ! Level to calculate physical properties. 104 ! 0) Only density 105 ! 1) Everything but density 106 ! 2) All physical properties 107 INTEGER, intent(in) :: pLevel 108 !----------------------------------------------------------------------- 109 110 ! Calculate physical properties: (density, specific heat, diameter) 111 CALL PHYSICAL_PROP(IER, pLevel) 112 113 ! Calculate transport properties: (conductivity, diffusivity, ect) 114 CALL TRANSPORT_PROP(IER) 115 116 ! Calculate interphase coeffs: (momentum and energy) 117 CALL EXCHANGE(IER) 118 119 RETURN 120 END SUBROUTINE CALC_COEFF 121 122 123 124 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC 125 ! C 126 ! Subroutine: CALC_RRATE C 127 ! Purpose: if rrate then calculate reaction rates and interphase C 128 ! mass transfer. if present, calculate discrete reactions C 129 ! C 130 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C 131 SUBROUTINE CALC_RRATE(IER) 132 133 !----------------------------------------------- 134 ! Modules 135 !----------------------------------------------- 136 USE compar, only : myPE 137 USE discretelement, only : DISCRETE_ELEMENT 138 USE funits, only : DMP_LOG, UNIT_LOG 139 USE machine, only: start_log, end_log 140 USE rxns, only : RRATE, USE_RRATES 141 use run, only: ANY_SPECIES_EQ 142 143 IMPLICIT NONE 144 !----------------------------------------------- 145 ! Dummy arguments 146 !----------------------------------------------- 147 !----------------------------------------------- 148 ! Local variables 149 !----------------------------------------------- 150 ! Error index 151 INTEGER, INTENT(INOUT) :: IER 152 153 ! For DEM simulations that do not have a homogeneous gas phase reaction, 154 ! the gas phase arrays phase change arrays need to be cleared in 155 ! CALC_RRATE_DES. Other 156 LOGICAL CLEAR_ARRAYS 157 158 !----------------------------------------------- 159 160 CLEAR_ARRAYS = .TRUE. 161 ! Calculate reaction rates and interphase mass transfer 162 IF(RRATE) THEN 163 ! Legacy hook: Calculate reactions from rrates.f. 164 IF(USE_RRATES) THEN 165 CALL RRATES (IER) 166 IF(IER .EQ. 1) THEN 167 CALL START_LOG 168 IF(DMP_LOG) WRITE (UNIT_LOG, 1000) 169 CALL END_LOG 170 CALL MFIX_EXIT(myPE) 171 ENDIF 172 ELSE 173 CALL RRATES0 (IER) 174 CLEAR_ARRAYS = .FALSE. 175 ENDIF 176 ENDIF 177 178 IF(DISCRETE_ELEMENT .AND. ANY_SPECIES_EQ) & 179 CALL CALC_RRATE_DES(CLEAR_ARRAYS) 180 181 RETURN 182 1000 FORMAT(/1X,70('*')//' From: CALC_COEFF',/,& 183 ' Species balance equations are being solved; but chemical',/, & 184 ' reactions are not specified in mfix.dat or in rrates.f.',/, & 185 ' Copy the file mfix/model/rrates.f into the run directory ',/, & 186 ' and remove the initial section that returns IER=1.',/& 187 1X,70('*')/) 188 189 END SUBROUTINE CALC_RRATE 190 191 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 192 ! ! 193 ! Subroutine: CALC_TRD_AND_TAU ! 194 ! Purpose: This routine directs the calculation of all physical and ! 195 ! transport properties, and exchange rates. ! 196 ! ! 197 ! Author: M. Syamlal Date: 25-AUG-05 ! 198 ! Reviewer: Date: ! 199 ! ! 200 ! ! 201 ! ! 202 ! Literature/Document References: ! 203 ! ! 204 ! Variables referenced: ! 205 ! Variables modified: ! 206 ! Local variables: ! 207 ! ! 208 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 209 SUBROUTINE CALC_TRD_AND_TAU() 210 211 USE run, only: jackson 212 ! Stress tensor trace. 213 USE visc_g, only : TRD_g 214 USE visc_s, only : TRD_S 215 ! Stress tensor cross terms. 216 USE tau_g, only : TAU_U_G, TAU_V_G, TAU_W_G 217 USE tau_g, only : cTAU_U_G, cTAU_V_G, cTAU_W_G 218 USE tau_s, only : TAU_U_S, TAU_V_S, TAU_W_S 219 ! Runtime flag for DEM model. 220 USE discretelement, only: DISCRETE_ELEMENT 221 ! Runtime flag for TFM-DEM hybrid model. 222 USE discretelement, only: DES_CONTINUUM_HYBRID 223 224 USE param1, only: zero 225 implicit none 226 227 !----------------------------------------------------------------------- 228 229 ! Calculate the trace of the stress tensor (gas phase; m=0) 230 CALL CALC_TRD_G (TRD_G) 231 232 ! Calculate the cross terms of the stress tensor (gas phase; m=0) 233 CALL CALC_TAU_U_G (TAU_U_G, CTAU_U_G) 234 CALL CALC_TAU_V_G (TAU_V_G, CTAU_V_G) 235 CALL CALC_TAU_W_G (TAU_W_G, CTAU_W_G) 236 237 IF (.NOT. JACKSON) THEN 238 CTAU_U_G = ZERO 239 CTAU_V_G = ZERO 240 CTAU_W_G = ZERO 241 ENDIF 242 243 ! Bypass the following calculations if there are no TFM solids. 244 IF (.NOT.DISCRETE_ELEMENT .OR. DES_CONTINUUM_HYBRID) THEN 245 ! Calculate the cross terms of the stress tensor (solids phases; m>0) 246 CALL CALC_TRD_S (TRD_S) 247 ! Calculate the trace of the stress tensor (solids phases; m>0) 248 CALL CALC_TAU_U_S (TAU_U_S) 249 CALL CALC_TAU_V_S (TAU_V_S) 250 CALL CALC_TAU_W_S (TAU_W_S) 251 ENDIF 252 253 RETURN 254 END SUBROUTINE CALC_TRD_AND_TAU 255