Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / equationReaderDemo / initializeSourceFields.H
bloba16ae4be2928b9cacb97a8a1dee6ff776a4954c3
1     // Initializing the scalarFields
2     forAll(sfA, cellIndex)
3     {
4         scalar cellValue(scalar(cellIndex) / 100000);
5         sfA[cellIndex] = 10 + cellValue;
6         sfB[cellIndex] = 20 + cellValue;
7         sfC[cellIndex] = 30 + cellValue;
8     }
10     // Initializing the volScalarFields
11     label globalI(0);
12     forAll(vsfA.internalField(), cellIndex)
13     {
14         scalar cellValue(scalar(globalI) / 100000);
15         vsfA.internalField()[cellIndex] = 40 + cellValue;
16         vsfB.internalField()[cellIndex] = 50 + cellValue;
17         vsfC.internalField()[cellIndex] = 60 + cellValue;
18         globalI++;
19     }
20     forAll(vsfA.boundaryField(), geoIndex)
21     {
22         forAll(vsfA.boundaryField()[geoIndex], cellIndex)
23         {
24             scalar cellValue(scalar(globalI) / 100000);
25             vsfA.boundaryField()[geoIndex][cellIndex] = 40 + cellValue;
26             vsfB.boundaryField()[geoIndex][cellIndex] = 50 + cellValue;
27             vsfC.boundaryField()[geoIndex][cellIndex] = 60 + cellValue;
28             globalI++;
29         }
30     }
32     // Initializing the vectorFields
33     forAll(vfA, cellIndex)
34     {
35         scalar cellValue(scalar(cellIndex) / 100000);
36         vfA[cellIndex] = vector
37         (
38             1000 + cellValue,
39             1000 + cellValue,
40             1000 + cellValue
41         );
42         vfB[cellIndex] = vector
43         (
44             2000 + cellValue,
45             -2000 - cellValue,
46             2000 + cellValue
47         );
48         vfC[cellIndex] = vector
49         (
50             3000 + cellValue,
51             3000 + cellValue,
52             -3000 - cellValue
53         );
54     }
56     // Initializing the volVectorFields
57     globalI = 0;
58     forAll(vvfA.internalField(), cellIndex)
59     {
60         scalar cellValue(scalar(globalI) / 100000);
61         vvfA.internalField()[cellIndex] = vector
62         (
63             4000 + cellValue,
64             4000 + cellValue,
65             4000 + cellValue
66         );
67         vvfB.internalField()[cellIndex] = vector
68         (
69             5000 + cellValue,
70             -5000 - cellValue,
71             5000 + cellValue
72         );
73         vvfC.internalField()[cellIndex] = vector
74         (
75             6000 + cellValue,
76             6000 + cellValue,
77             -6000 - cellValue
78         );
79         globalI++;
80     }
81     forAll(vvfA.boundaryField(), geoIndex)
82     {
83         forAll(vvfA.boundaryField()[geoIndex], cellIndex)
84         {
85             scalar cellValue(scalar(globalI) / 100000);
86             vvfA.boundaryField()[geoIndex][cellIndex] = vector
87             (
88                 4000 + cellValue,
89                 4000 + cellValue,
90                 4000 + cellValue
91             );
92             vvfB.boundaryField()[geoIndex][cellIndex] = vector
93             (
94                 5000 + cellValue,
95                 -5000 - cellValue,
96                 5000 + cellValue
97             );
98             vvfC.boundaryField()[geoIndex][cellIndex] = vector
99             (
100                 6000 + cellValue,
101                 6000 + cellValue,
102                 -6000 - cellValue
103             );
104             globalI++;
105         }
106     }
108     // Initializing the tensorFields
109     forAll(tfA, cellIndex)
110     {
111         scalar cellValue(scalar(cellIndex) / 100000);
112         scalar tA(cellValue + 100000);
113         scalar tB(cellValue + 200000);
114         scalar tC(cellValue + 300000);
115         tfA[cellIndex] = tensor
116         (
117             tA, -tA, tA,
118             -tA, tA, -tA,
119             tA, -tA, tA
120         );
121         tfB[cellIndex] = tensor
122         (
123             tB, tB, -tB,
124             tB, -tB, tB,
125             -tB, tB, -tB
126         );
127         tfC[cellIndex] = tensor
128         (
129             tC, tC, -tC,
130             -tC, tC, tC,
131             -tC, -tC, tC
132         );
133     }
135     // Initializing the volTectorFields
136     globalI = 0;
137     forAll(vtfA.internalField(), cellIndex)
138     {
139         scalar cellValue(scalar(globalI) / 100000);
140         scalar tA(cellValue + 400000);
141         scalar tB(cellValue + 500000);
142         scalar tC(cellValue + 600000);
143         vtfA.internalField()[cellIndex] = tensor
144         (
145             tA, -tA, tA,
146             -tA, tA, -tA,
147             tA, -tA, tA
148         );
149         vtfB.internalField()[cellIndex] = tensor
150         (
151             tB, tB, -tB,
152             tB, -tB, tB,
153             -tB, tB, -tB
154         );
155         vtfC.internalField()[cellIndex] = tensor
156         (
157             tC, tC, -tC,
158             -tC, tC, tC,
159             -tC, -tC, tC
160         );
161         globalI++;
162     }
163     forAll(vtfA.boundaryField(), geoIndex)
164     {
165         forAll(vtfA.boundaryField()[geoIndex], cellIndex)
166         {
167             scalar cellValue(scalar(globalI) / 100000);
168             scalar tA(cellValue + 400000);
169             scalar tB(cellValue + 500000);
170             scalar tC(cellValue + 600000);
171             vtfA.boundaryField()[geoIndex][cellIndex] = tensor
172             (
173                 tA, -tA, tA,
174                 -tA, tA, -tA,
175                 tA, -tA, tA
176             );
177             vtfB.boundaryField()[geoIndex][cellIndex] = tensor
178             (
179                 tB, tB, -tB,
180                 tB, -tB, tB,
181                 -tB, tB, -tB
182             );
183             vtfC.boundaryField()[geoIndex][cellIndex] = tensor
184             (
185                 tC, tC, -tC,
186                 -tC, tC, tC,
187                 -tC, -tC, tC
188             );
189             globalI++;
190         }
191     }