1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 2 ! ! 3 ! Module name: DES_THERMO_NEWVALUES ! 4 ! ! 5 ! Purpose: ! 6 ! ! 7 ! ! 8 ! Author: J.Musser Date: 16-Jun-10 ! 9 ! ! 10 ! Comments: ! 11 ! ! 12 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 13 SUBROUTINE DES_THERMO_NEWVALUES 14 15 USE compar 16 Use des_thermo 17 Use des_rxns 18 Use discretelement 19 USE geometry 20 USE indices 21 Use param1 22 Use physprop 23 use run, only: ENERGY_EQ 24 use functions 25 26 IMPLICIT NONE 27 28 ! Passed variables 29 !----------------------------------------------- 30 ! NONE 31 32 ! Local variables 33 !---------------------------------------------------------------------// 34 ! Index of neighbor particle of particle I such that I < J 35 INTEGER IJK 36 ! Loop index for particles. 37 INTEGER NP, lNP 38 ! Logical for Adams-Bashfort integration. 39 LOGICAL,SAVE:: FIRST_PASS = .TRUE. 40 ! Sum of particle temperatures in fluid cell. 41 DOUBLE PRECISION SUM_T_s 42 !---------------------------------------------------------------------// 43 44 IF(.NOT.ENERGY_EQ) RETURN 45 46 ! Second-order Adams-Bashforth scheme defaults to Euler on first pass. 47 IF(FIRST_PASS) THEN 48 IF(INTG_ADAMS_BASHFORTH) & 49 Q_Source0(:) = Q_Source(:)/ (PMASS(:) * DES_C_ps(:)) 50 FIRST_PASS = .FALSE. 51 ENDIF 52 53 ! Clear the average solids temperature for all fluid cells. 54 avgDES_T_s(:) = ZERO 55 56 ! Loop over fluid cells. 57 !---------------------------------------------------------------------// 58 IJK_LP: DO IJK = IJKSTART3, IJKEND3 59 IF(.NOT.FLUID_AT(IJK)) CYCLE IJK_LP 60 IF(PINC(IJK) == 0) CYCLE IJK_LP 61 62 ! Initialize local solids temperature. 63 SUM_T_s = ZERO 64 65 ! Loop over all particles in cell IJK. 66 !---------------------------------------------------------------------// 67 lNP_LP: DO lNP = 1, PINC(IJK) 68 NP = PIC(IJK)%p(lNP) 69 ! Skip indices that do not represent particles 70 IF(.NOT.PEA(NP,1)) CYCLE lNP_LP 71 ! Skip indices that represent ghost particles 72 IF(PEA(NP,4)) CYCLE lNP_LP 73 ! Advance particle position, velocity 74 IF (INTG_EULER) THEN 75 76 ! First-order method 77 DES_T_s_NEW(NP) = DES_T_s_NEW(NP) + & 78 DTSOLID*(Q_Source(NP) / (PMASS(NP) * DES_C_ps(NP))) 79 ELSE 80 ! Second-order Adams-Bashforth scheme 81 DES_T_s_NEW(NP) = DES_T_s_OLD(NP) + & 82 (1.5d0 * (Q_Source(NP)/(PMASS(NP)*DES_C_ps(NP))) - & 83 0.5d0 * Q_Source0(NP)) * DTSOLID 84 Q_Source0(NP) = Q_Source(NP) / (PMASS(NP) * DES_C_ps(NP)) 85 ENDIF 86 87 ! Write out the debugging information. 88 IF(DEBUG_DES) THEN 89 IF(DMP_LOG) THEN 90 IF(NP == FOCUS_PARTICLE) THEN 91 WRITE(*,"(//5X,A)")'From: DES_THERMO_NEWVALUES -' 92 WRITE(*,"(8X,A,D13.6)")'Tp: ',DES_T_s_NEW(NP) 93 WRITE(*,"(8X,A,D13.6)")'Tp0: ',DES_T_s_OLD(NP) 94 WRITE(*,"(8X,A,D13.6)")'Qsrc:',Q_Source(NP) 95 WRITE(*,"(5X,25('-')/)") 96 ENDIF 97 ENDIF 98 ENDIF 99 100 ! Update the old temperature value 101 DES_T_s_OLD(NP) = DES_T_s_NEW(NP) 102 ! Update the sum of particle temperatures in fluid cell IJK. 103 SUM_T_s = SUM_T_s + DES_T_s_NEW(NP) 104 ENDDO lNP_LP ! End loop over all particles 105 ! Average solids temperature in fluid cell IJK. The average method 106 ! (over particles) will need changed for Hybrid model (area? volume?). 107 avgDES_T_s(IJK) = SUM_T_s/PINC(IJK) 108 109 ENDDO IJK_LP ! End loop over fluid cells 110 111 Q_Source(:) = ZERO 112 113 114 RETURN 115 116 END SUBROUTINE DES_THERMO_NEWVALUES 117 118 119 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv! 120 ! ! 121 ! Module name: SET_INIT_avgTs ! 122 ! ! 123 ! Purpose: ! 124 ! ! 125 ! ! 126 ! Author: J.Musser Date: 06-NOV-12 ! 127 ! ! 128 ! Comments: ! 129 ! ! 130 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^! 131 SUBROUTINE SET_INIT_avgTs 132 133 USE compar 134 Use des_thermo 135 Use des_rxns 136 Use discretelement 137 USE geometry 138 USE indices 139 Use param1 140 Use physprop 141 use run, only: ENERGY_EQ 142 use functions 143 IMPLICIT NONE 144 145 ! Passed variables 146 !----------------------------------------------- 147 ! NONE 148 149 ! Local variables 150 !---------------------------------------------------------------------// 151 ! Index of neighbor particle of particle I such that I < J 152 INTEGER IJK 153 ! Loop index for particles. 154 INTEGER NP, lNP 155 ! Sum of particle temperatures in fluid cell. 156 DOUBLE PRECISION SUM_T_s 157 !---------------------------------------------------------------------// 158 159 IF(.NOT.ENERGY_EQ) RETURN 160 161 ! Clear the average solids temperature for all fluid cells. 162 avgDES_T_s(:) = ZERO 163 164 ! Loop over fluid cells. 165 !---------------------------------------------------------------------// 166 IJK_LP: DO IJK = IJKSTART3, IJKEND3 167 IF(.NOT.FLUID_AT(IJK)) CYCLE IJK_LP 168 IF(PINC(IJK) == 0) CYCLE IJK_LP 169 170 ! Initialize local solids temperature. 171 SUM_T_s = ZERO 172 173 ! Loop over all particles in cell IJK. 174 !---------------------------------------------------------------------// 175 lNP_LP: DO lNP = 1, PINC(IJK) 176 NP = PIC(IJK)%p(lNP) 177 ! Skip indices that do not represent particles 178 IF(.NOT.PEA(NP,1)) CYCLE lNP_LP 179 ! Skip indices that represent ghost particles 180 IF(PEA(NP,4)) CYCLE lNP_LP 181 ! Update the sum of particle temperatures in fluid cell IJK. 182 SUM_T_s = SUM_T_s + DES_T_s_NEW(NP) 183 ENDDO lNP_LP ! End loop over all particles 184 ! Average solids temperature in fluid cell IJK. The average method 185 ! (over particles) will need changed for Hybrid model (area? volume?). 186 avgDES_T_s(IJK) = SUM_T_s/PINC(IJK) 187 188 ENDDO IJK_LP ! End loop over fluid cells 189 190 RETURN 191 192 END SUBROUTINE SET_INIT_avgTs 193