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) Eveything 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 rxns, only : RRATE, USE_RRATES 137 USE funits, only : DMP_LOG, UNIT_LOG 138 USE compar, only : myPE 139 USE discretelement, only : DISCRETE_ELEMENT 140 use run, only: ANY_SPECIES_EQ 141 142 IMPLICIT NONE 143 !----------------------------------------------- 144 ! Dummy arguments 145 !----------------------------------------------- 146 !----------------------------------------------- 147 ! Local variables 148 !----------------------------------------------- 149 ! Error index 150 INTEGER, INTENT(INOUT) :: IER 151 152 ! For DEM simulations that do not have a homogeneous gas phase reaction, 153 ! the gas phase arrays phase change arrays need to be cleared in 154 ! CALC_RRATE_DES. Other 155 LOGICAL CLEAR_ARRAYS 156 157 !----------------------------------------------- 158 159 CLEAR_ARRAYS = .TRUE. 160 ! Calculate reaction rates and interphase mass transfer 161 IF(RRATE) THEN 162 ! Legacy hook: Calculate reactions from rrates.f. 163 IF(USE_RRATES) THEN 164 CALL RRATES (IER) 165 IF(IER .EQ. 1) THEN 166 CALL START_LOG 167 IF(DMP_LOG) WRITE (UNIT_LOG, 1000) 168 CALL END_LOG 169 CALL MFIX_EXIT(myPE) 170 ENDIF 171 ELSE 172 CALL RRATES0 (IER) 173 CLEAR_ARRAYS = .FALSE. 174 ENDIF 175 ENDIF 176 177 IF(DISCRETE_ELEMENT .AND. ANY_SPECIES_EQ) & 178 CALL CALC_RRATE_DES(CLEAR_ARRAYS) 179 180 RETURN 181 1000 FORMAT(/1X,70('*')//' From: CALC_COEFF',/,& 182 ' Species balance equations are being solved; but chemical',/, & 183 ' reactions are not specified in mfix.dat or in rrates.f.',/, & 184 ' Copy the file mfix/model/rrates.f into the run directory ',/, & 185 ' and remove the initial section that returns IER=1.',/1X,70('*')/) 186 187 END SUBROUTINE CALC_RRATE 188 189 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 190 ! ! 191 ! Subroutine: CALC_TRD_AND_TAU ! 192 ! Purpose: This routine directs the calculation of all physical and ! 193 ! transport properties, and exchange rates. ! 194 ! ! 195 ! Author: M. Syamlal Date: 25-AUG-05 ! 196 ! Reviewer: Date: ! 197 ! ! 198 ! ! 199 ! ! 200 ! Literature/Document References: ! 201 ! ! 202 ! Variables referenced: ! 203 ! Variables modified: ! 204 ! Local variables: ! 205 ! ! 206 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 207 SUBROUTINE CALC_TRD_AND_TAU(IER) 208 209 ! Stress tensor trace. 210 USE visc_g, only : TRD_g 211 USE visc_s, only : TRD_S 212 ! Stress tensor cross terms. 213 USE tau_g, only : TAU_U_G, TAU_V_G, TAU_W_G 214 USE tau_s, only : TAU_U_S, TAU_V_S, TAU_W_S 215 ! Runtime flag for DEM model. 216 USE discretelement, only: DISCRETE_ELEMENT 217 ! Runtime flag for TFM-DEM hybrid model. 218 USE discretelement, only: DES_CONTINUUM_HYBRID 219 220 implicit none 221 222 ! Dummy arguments 223 !----------------------------------------------------------------------- 224 ! Error index 225 INTEGER, intent(inout) :: IER 226 227 !----------------------------------------------------------------------- 228 229 ! Calculate the trace of the stress tensor (gas phase; m=0) 230 CALL CALC_TRD_G (TRD_G, IER) 231 232 ! Calculate the cross terms of the stress tensor (gas phase; m=0) 233 CALL CALC_TAU_U_G (TAU_U_G, IER) 234 CALL CALC_TAU_V_G (TAU_V_G, IER) 235 CALL CALC_TAU_W_G (TAU_W_G, IER) 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, IER) 241 ! Calculate the trace of the stress tensor (solids phases; m>0) 242 CALL CALC_TAU_U_S (TAU_U_S, IER) 243 CALL CALC_TAU_V_S (TAU_V_S, IER) 244 CALL CALC_TAU_W_S (TAU_W_S, IER) 245 ENDIF 246 247 RETURN 248 END SUBROUTINE CALC_TRD_AND_TAU 249