Loading...
Searching...
No Matches
directBC.H
Go to the documentation of this file.
1fvMesh& mesh = _mesh();
2volScalarField& T(_T());
3// Setting BC at the cold side
4coldSide_ind = mesh.boundaryMesh().findPatchID("coldSide");
5label coldSideSize = T.boundaryField()[coldSide_ind].size();
6Tf.resize(coldSideSize);
7refGrad.resize(coldSideSize);
8valueFraction.resize(coldSideSize);
9forAll(Tf, faceI)
10{
11 scalar faceZ =
12 mesh.boundaryMesh()[coldSide_ind].faceCentres()[faceI].z();
13 scalar faceY =
14 mesh.boundaryMesh()[coldSide_ind].faceCentres()[faceI].y();
15 scalar faceX =
16 mesh.boundaryMesh()[coldSide_ind].faceCentres()[faceI].x();
17 Tf[faceI] = k / H * (b * faceX + c) + a * faceX * faceX +
18 b * faceX * faceY + c * faceY - a * faceZ * faceZ + c;
19}
20// Setting BC at gammaEx1
21gammaEx1_ind = mesh.boundaryMesh().findPatchID("gammaEx1");
22label gammaEx1Size = T.boundaryField()[gammaEx1_ind].size();
23heatFlux_gammaEx1.resize(gammaEx1Size);
24forAll(heatFlux_gammaEx1, faceI)
25{
26 scalar faceZ =
27 mesh.boundaryMesh()[gammaEx1_ind].faceCentres()[faceI].z();
28 heatFlux_gammaEx1[faceI] = k * 2 * a * faceZ;
29}
30// Setting BC at gammaEx2
31gammaEx2_ind = mesh.boundaryMesh().findPatchID("gammaEx2");
32label gammaEx2Size = T.boundaryField()[gammaEx2_ind].size();
33heatFlux_gammaEx2.resize(gammaEx2Size);
34forAll(heatFlux_gammaEx2, faceI)
35{
36 scalar faceX =
37 mesh.boundaryMesh()[gammaEx2_ind].faceCentres()[faceI].x();
38 scalar faceY =
39 mesh.boundaryMesh()[gammaEx2_ind].faceCentres()[faceI].y();
40 heatFlux_gammaEx2[faceI] = - k * (2 * a * faceX + b * faceY);
41}
42// Setting BC at gammaEx3
43gammaEx3_ind = mesh.boundaryMesh().findPatchID("gammaEx3");
44label gammaEx3Size = T.boundaryField()[gammaEx3_ind].size();
45heatFlux_gammaEx3.resize(gammaEx3Size);
46forAll(heatFlux_gammaEx3, faceI)
47{
48 heatFlux_gammaEx3[faceI] = 0;
49}
50// Setting BC at gammaEx4
51gammaEx4_ind = mesh.boundaryMesh().findPatchID("gammaEx4");
52label gammaEx4Size = T.boundaryField()[gammaEx4_ind].size();
53heatFlux_gammaEx4.resize(gammaEx4Size);
54forAll(heatFlux_gammaEx4, faceI)
55{
56 scalar faceY =
57 mesh.boundaryMesh()[gammaEx4_ind].faceCentres()[faceI].y();
58 heatFlux_gammaEx4[faceI] = k * (b * faceY);
59}
61forAll(mesh.boundaryMesh(), patchI)
62{
63 if (patchI == mesh.boundaryMesh().findPatchID("coldSide"))
64 {
65 ITHACAutilities::assignMixedBC(T, patchI, Tf, refGrad, valueFraction);
66 }
67
68 if (patchI == mesh.boundaryMesh().findPatchID("hotSide"))
69 {
70 ITHACAutilities::assignBC(T, patchI, - g / k);
71 }
72
73 if (patchI == mesh.boundaryMesh().findPatchID("gammaEx1"))
74 {
75 ITHACAutilities::assignBC(T, patchI, -heatFlux_gammaEx1 / k);
76 }
77
78 if (patchI == mesh.boundaryMesh().findPatchID("gammaEx2"))
79 {
80 ITHACAutilities::assignBC(T, patchI, -heatFlux_gammaEx2 / k);
81 }
82
83 if (patchI == mesh.boundaryMesh().findPatchID("gammaEx3"))
84 {
85 ITHACAutilities::assignBC(T, patchI, -heatFlux_gammaEx3 / k);
86 }
87
88 if (patchI == mesh.boundaryMesh().findPatchID("gammaEx4"))
89 {
90 ITHACAutilities::assignBC(T, patchI, -heatFlux_gammaEx4 / k);
91 }
92}
93
_T
Definition createT.H:30
volScalarField & T
Definition createT.H:46
label gammaEx4Size
Definition directBC.H:52
gammaEx3_ind
Definition directBC.H:43
forAll(Tf, faceI)
Definition directBC.H:9
gammaEx4_ind
Definition directBC.H:51
gammaEx1_ind
Definition directBC.H:21
label gammaEx1Size
Definition directBC.H:22
coldSide_ind
Definition directBC.H:4
label coldSideSize
Definition directBC.H:5
fvMesh & mesh
Definition directBC.H:1
set_valueFraction()
label gammaEx3Size
Definition directBC.H:44
label gammaEx2Size
Definition directBC.H:32
gammaEx2_ind
Definition directBC.H:31
void assignMixedBC(GeometricField< Type, fvPatchField, volMesh > &field, label BC_ind, List< Type > &value, List< Type > &grad, List< scalar > &valueFrac)
Assign value of a boundary condition of type "mixed".
void assignBC(GeometricField< scalar, fvPatchField, volMesh > &s, label BC_ind, double value)
Assign uniform Boundary Condition to a volScalarField.
dimensionedVector & g