Global Balance of Squared Temperature¶
Sink (Dissipation)¶
There are 3 terms dissipating the squared temperature, which are computed separately.
\[\sumzc
\sumyc
\sumxf
\dhdis{1}\]
12static int get_dtdx (
13 const domain_t * domain,
14 const fluid_t * fluid,
15 double * quantity
16) {
17 const int isize = domain->mysizes[0];
18 const int jsize = domain->mysizes[1];
19#if NDIMS == 3
20 const int ksize = domain->mysizes[2];
21#endif
22 const double * restrict hxxf = domain->hxxf;
23 const double * restrict jdxf = domain->jdxf;
24 const double * restrict t = fluid->t.data;
25 const double diffusivity = fluid_compute_temperature_diffusivity(fluid);
26#if NDIMS == 2
27 for (int j = 1; j <= jsize; j++) {
28 for (int i = 1; i <= isize + 1; i++) {
29 const double hx = HXXF(i);
30 const double jd = JDXF(i);
31 const double dt =
32 - T(i-1, j )
33 + T(i , j );
34 *quantity += diffusivity * jd * pow(1. / hx * dt, 2.);
35 }
36 }
37#else
38 for (int k = 1; k <= ksize; k++) {
39 for (int j = 1; j <= jsize; j++) {
40 for (int i = 1; i <= isize + 1; i++) {
41 const double hx = HXXF(i);
42 const double jd = JDXF(i);
43 const double dt =
44 - T(i-1, j , k )
45 + T(i , j , k );
46 *quantity += diffusivity * jd * pow(1. / hx * dt, 2.);
47 }
48 }
49 }
50#endif
51 return 0;
52}
\[\sumzc
\sumyf
\sumxc
\dhdis{2}\]
55static int get_dtdy (
56 const domain_t * domain,
57 const fluid_t * fluid,
58 double * quantity
59) {
60 const int isize = domain->mysizes[0];
61 const int jsize = domain->mysizes[1];
62#if NDIMS == 3
63 const int ksize = domain->mysizes[2];
64#endif
65 const double hy = domain->hy;
66 const double * restrict jdxc = domain->jdxc;
67 const double * restrict t = fluid->t.data;
68 const double diffusivity = fluid_compute_temperature_diffusivity(fluid);
69#if NDIMS == 2
70 for (int j = 1; j <= jsize; j++) {
71 for (int i = 1; i <= isize; i++) {
72 const double jd = JDXC(i);
73 const double dt =
74 - T(i , j-1)
75 + T(i , j );
76 *quantity += diffusivity * jd * pow(1. / hy * dt, 2.);
77 }
78 }
79#else
80 for (int k = 1; k <= ksize; k++) {
81 for (int j = 1; j <= jsize; j++) {
82 for (int i = 1; i <= isize; i++) {
83 const double jd = JDXC(i);
84 const double dt =
85 - T(i , j-1, k )
86 + T(i , j , k );
87 *quantity += diffusivity * jd * pow(1. / hy * dt, 2.);
88 }
89 }
90 }
91#endif
92 return 0;
93}
\[\sumzf
\sumyc
\sumxc
\dhdis{3}\]
97static int get_dtdz (
98 const domain_t * domain,
99 const fluid_t * fluid,
100 double * quantity
101) {
102 const int isize = domain->mysizes[0];
103 const int jsize = domain->mysizes[1];
104 const int ksize = domain->mysizes[2];
105 const double hz = domain->hz;
106 const double * restrict jdxc = domain->jdxc;
107 const double * restrict t = fluid->t.data;
108 const double diffusivity = fluid_compute_temperature_diffusivity(fluid);
109 for (int k = 1; k <= ksize; k++) {
110 for (int j = 1; j <= jsize; j++) {
111 for (int i = 1; i <= isize; i++) {
112 const double jd = JDXC(i);
113 const double dt =
114 - T(i , j , k-1)
115 + T(i , j , k );
116 *quantity += diffusivity * jd * pow(1. / hz * dt, 2.);
117 }
118 }
119 }
120 return 0;
121}
Source (Injection)¶
\[\dhinjall\]
injects squared temperature, which will be elaborated later.