1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC 2 ! C 3 ! Subroutine: USR_SOURCES C 4 ! Purpose: Hook for user defined source terms C 5 ! C 6 ! Comments: C 7 ! Discretized equations take form as a matrix equation Ax=b. C 8 ! Terms that may be represented as a coefficient of the dependent C 9 ! variable go to the center coefficient (ap) through sourcelhs C 10 ! (i.e., included on the left-hand-side (lhs)). C 11 ! Terms that are a constant go to the source vector (b) through C 12 ! sourcerhs (i.e., included on the right-hand-side (rhs)). C 13 ! C 14 ! Source terms are often a function of the dependent variable. To C 15 ! aid in convergence, this dependency should be acknowledged in the C 16 ! equation. Incorporate the dependency of the source term on the C 17 ! dependent variable through both ap and b. C 18 ! C 19 ! See Patankar, S. V., Numerical heat transfer and fluid flow, C 20 ! Taylor and Francis, 1980, for rules and suggestions for C 21 ! appropriate discretization of the source term. C 22 ! C 23 ! C 24 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C 25 SUBROUTINE USR_SOURCES(lEQ_NO, IJK, sourcelhs, sourcerhs, M, N) 26 27 ! Modules 28 !----------------------------------------------- 29 use constant, only: pi, gas_const, gravity 30 use fldvar, only: u_g, v_g, w_g 31 use fldvar, only: u_s, v_s, w_s 32 use fldvar, only: ep_g, rop_g, ro_g, T_g, X_g, P_g 33 use fldvar, only: ep_s, rop_s, ro_s, T_s, X_s, d_p, theta_m 34 use fldvar, only: k_turb_g, e_turb_g, scalar 35 use functions 36 use geometry 37 use indices, only: i_of, j_of, k_of 38 use indices, only: im1, ip1, jm1, jp1, km1, kp1 39 use param1, only: zero, one, half, undefined, undefined_i 40 use physprop 41 use scalars, only: phase4scalar 42 use usr_src 43 IMPLICIT NONE 44 45 ! Dummy arguments 46 !----------------------------------------------- 47 ! reference equation 48 INTEGER, INTENT(IN) :: lEQ_NO 49 ! index 50 INTEGER, INTENT(IN) :: IJK 51 ! source terms which appear appear in the 52 ! center coefficient (lhs) - part of a_m matrix 53 ! source vector (rhs) - part of b_m vector 54 DOUBLE PRECISION, INTENT(OUT) :: sourcelhs, sourcerhs 55 ! Phase index 56 INTEGER, INTENT(IN) :: M 57 ! Species index OR scalar equation number 58 ! (if applicable otherwise undefined_i) 59 INTEGER, INTENT(IN) :: N 60 61 ! Local variables 62 !----------------------------------------------- 63 64 !----------------------------------------------- 65 ! initialize 66 sourcelhs = zero 67 sourcerhs = zero 68 69 SELECT CASE(lEQ_NO) 70 71 ! source for pressure correction equation: pp_g 72 CASE (PRESSURE_CORRECTION) 73 74 ! source for solids correctione quation:: epp 75 CASE (SOLIDS_CORRECTION) 76 77 ! source for gas continuity equation: rop_g 78 CASE (GAS_CONTINUITY) 79 80 ! source for solids continuity equation: rop_s 81 CASE (SOLIDS_CONTINUITY) 82 83 ! source for gas u momentum equation: U_g 84 CASE (GAS_U_MOM) 85 86 ! source for solids u momentum equation: U_s 87 CASE (SOLIDS_U_MOM) 88 89 ! source for gas v momentum equation: V_g 90 CASE (GAS_V_MOM) 91 92 ! source for solids v momentum equation: V_s 93 CASE (SOLIDS_V_MOM) 94 95 ! source for gas w momentum equation: W_g 96 CASE (GAS_W_MOM) 97 98 ! source for solids w momentum equation: W_s 99 CASE (SOLIDS_W_MOM) 100 101 ! source for gas temperature equation: T_g 102 CASE (GAS_ENERGY) 103 104 ! source for solids temperature equation: T_s 105 CASE (SOLIDS_ENERGY) 106 107 ! source for gas species equation: X_g 108 CASE (GAS_SPECIES) 109 110 ! source for solids species equation: X_s 111 CASE (SOLIDS_SPECIES) 112 113 ! source for granular energy equation: Theta_m 114 CASE (GRAN_ENERGY) 115 116 ! source for user scalar equations: scalar 117 CASE (USR_SCALAR) 118 119 ! source for k_epsilon turbulence equations: k_turb_g 120 CASE (K_EPSILON_K) 121 122 ! source for k_epsilon turbulence equations: e_turb_g 123 CASE (K_EPSILON_E) 124 125 END SELECT 126 RETURN 127 END SUBROUTINE USR_SOURCES 128 129 130 131