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