Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-10-26 14:01:45 +00:00
124 changed files with 1697 additions and 582 deletions

View File

@ -13,7 +13,7 @@
);
volVectorField force =
U/dimensionedScalar("dt", dimTime, runTime.deltaT().value());
U/dimensionedScalar("dt", dimTime, runTime.deltaTValue());
Kmesh K(mesh);
UOprocess forceGen(K, runTime.deltaT().value(), turbulenceProperties);
UOprocess forceGen(K, runTime.deltaTValue(), turbulenceProperties);

View File

@ -41,11 +41,11 @@ Description
StCoNum =
max(SfUfbyDelta/mesh.magSf()).value()
*runTime.deltaT().value();
*runTime.deltaTValue();
meanStCoNum =
(sum(SfUfbyDelta)/sum(mesh.magSf())).value()
*runTime.deltaT().value();
*runTime.deltaTValue();
}
Info<< "St courant Number mean: " << meanStCoNum

View File

@ -41,12 +41,12 @@ if (adjustTimeStep)
(
min
(
deltaTFact*runTime.deltaT().value(),
deltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
// ************************************************************************* //

View File

@ -40,7 +40,7 @@ if (ign.ignited())
(
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiSt)/(fvc::interpolate(rho)*mesh.magSf())
).value()*runTime.deltaT().value();
).value()*runTime.deltaTValue();
Info<< "Max St-Courant Number = " << StCoNum << endl;

View File

@ -89,8 +89,8 @@ int main(int argc, char *argv[])
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -80,8 +80,8 @@ int main(int argc, char *argv[])
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -3,8 +3,8 @@
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -3,8 +3,8 @@
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -38,11 +38,11 @@ if (mesh.nInternalFaces())
surfaceScalarField amaxSfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()*amaxSf;
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaT().value();
CoNum = max(amaxSfbyDelta/mesh.magSf()).value()*runTime.deltaTValue();
meanCoNum =
(sum(amaxSfbyDelta)/sum(mesh.magSf())).value()
*runTime.deltaT().value();
*runTime.deltaTValue();
}
Info<< "Mean and max Courant Numbers = "

View File

@ -68,7 +68,7 @@ int main(int argc, char *argv[])
(
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiv)/mesh.magSf()
).value()*runTime.deltaT().value();
).value()*runTime.deltaTValue();
Info<< "\nMax Courant Number = " << CoNum << endl;

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
(
mesh.surfaceInterpolation::deltaCoeffs()
*mag(phiv)/mesh.magSf()
).value()*runTime.deltaT().value();
).value()*runTime.deltaTValue();
Info<< "Max Courant Number = " << CoNum << endl;

View File

@ -1,4 +1,4 @@
Info<< "magnetic flux divergence error = "
<< runTime.deltaT().value()
<< runTime.deltaTValue()
*mag(fvc::div(phiB))().weightedAverage(mesh.V()).value()
<< endl;

View File

@ -47,10 +47,10 @@ Foam::scalar Foam::compressibleCourantNo
/ fvc::interpolate(rho);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Region: " << mesh.name() << " Courant Number mean: " << meanCoNum

View File

@ -42,10 +42,10 @@ if (mesh.nInternalFaces())
*mag(phi)/fvc::interpolate(h);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
// Gravity wave Courant number
waveCoNum =
@ -53,7 +53,7 @@ if (mesh.nInternalFaces())
(
mesh.surfaceInterpolation::deltaCoeffs()
*sqrt(fvc::interpolate(h))
).value()*sqrt(magg).value()*runTime.deltaT().value();
).value()*sqrt(magg).value()*runTime.deltaTValue();
}
Info<< "Courant number mean: " << meanCoNum

View File

@ -3,8 +3,8 @@
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -3,8 +3,8 @@
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -3,8 +3,8 @@
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
runTime.value() - runTime.deltaTValue(),
runTime.deltaTValue()
);
// turbulent time scale

View File

@ -40,15 +40,15 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
acousticCoNum = max
(
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
).value()*runTime.deltaT().value();
).value()*runTime.deltaTValue();
}
Info<< "phiv Courant Number mean: " << meanCoNum

View File

@ -43,12 +43,12 @@ if (adjustTimeStep)
(
min
(
deltaTFact*runTime.deltaT().value(),
deltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
// ************************************************************************* //

View File

@ -44,7 +44,7 @@ if (adjustTimeStep)
(
min
(
maxDeltaTFact*runTime.deltaT().value(),
maxDeltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);

View File

@ -1,5 +1,5 @@
scalar sumLocalContErr =
runTime.deltaT().value()*
runTime.deltaTValue()*
mag
(
fvc::ddt(rho)
@ -7,7 +7,7 @@
)().weightedAverage(rho*mesh.V()).value();
scalar globalContErr =
runTime.deltaT().value()*
runTime.deltaTValue()*
(
fvc::ddt(rho)
+ fvc::div(phi)

View File

@ -5,7 +5,7 @@
(
mesh.surfaceInterpolation::deltaCoeffs()*mag(phia - phib)
/mesh.magSf()
).value()*runTime.deltaT().value();
).value()*runTime.deltaTValue();
Info<< "Max Ur Courant Number = " << UrCoNum << endl;

View File

@ -50,6 +50,7 @@ Description
#include "mathematicalConstants.H"
#include "PackedBoolList.H"
#include "SortableList.H"
#include "unitConversion.H"
using namespace Foam;
@ -467,7 +468,7 @@ int main(int argc, char *argv[])
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/constant::mathematical::pi);
scalar maxCos = Foam::cos(degToRad(angle));
Info<< "Merging:" << nl
<< " edges with length less than " << minLen << " meters" << nl

View File

@ -208,12 +208,13 @@ void readPoints
{
hasWarned = true;
WarningIn
IOWarningIn
(
"readPoints(IFstream&, label&, DynamicList<point>"
", DynamicList<label>&)"
", DynamicList<label>&)",
is
) << "Points not in order starting at point " << pointI
<< " at line " << is.lineNumber()
//<< " at line " << is.lineNumber()
//<< abort(FatalError);
<< endl;
}
@ -429,47 +430,53 @@ void readPatches
>> dofSet >> tempSet >> contactSet >> nFaces;
is.getLine(line);
patchNames.append(string::validate<word>(line));
word groupName = string::validate<word>(line);
Info<< "For facegroup " << group
<< " named " << patchNames[patchNames.size()-1]
Info<< "For group " << group
<< " named " << groupName
<< " trying to read " << nFaces << " patch face indices."
<< endl;
patchFaceIndices.append(labelList(0));
labelList& faceIndices = patchFaceIndices[patchFaceIndices.size()-1];
faceIndices.setSize(nFaces);
label faceI = 0;
labelList groupIndices(nFaces);
label groupType = -1;
nFaces = 0;
while (faceI < faceIndices.size())
while (nFaces < groupIndices.size())
{
is.getLine(line);
IStringStream lineStr(line);
// Read one (for last face) or two entries from line.
label nRead = 2;
if (faceI == faceIndices.size()-1)
if (nFaces == groupIndices.size()-1)
{
nRead = 1;
}
for (label i = 0; i < nRead; i++)
{
label typeCode, tag, nodeLeaf, component;
label tag, nodeLeaf, component;
lineStr >> typeCode >> tag >> nodeLeaf >> component;
lineStr >> groupType >> tag >> nodeLeaf >> component;
if (typeCode != 8)
{
FatalErrorIn("readPatches")
<< "When reading patches expect Entity Type Code 8"
<< nl << "At line " << is.lineNumber()
<< exit(FatalError);
}
faceIndices[faceI++] = tag;
groupIndices[nFaces++] = tag;
}
}
// Store
if (groupType == 8)
{
patchNames.append(groupName);
patchFaceIndices.append(groupIndices);
}
else
{
IOWarningIn("readPatches(..)", is)
<< "When reading patches expect entity type code 8"
<< nl << " Skipping group code " << groupType
<< endl;
}
}
patchNames.shrink();

View File

@ -0,0 +1,394 @@
-1
2411
1 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 0.0000000000000000E+00
2 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 2.1000000000000000E+02
3 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 0.0000000000000000E+00
4 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 2.1000000000000000E+02
5 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 0.0000000000000000E+00
6 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 2.1000000000000000E+02
7 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00
8 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 2.1000000000000000E+02
9 0 0 0
0.0000000000000000E+00 1.0020000000000000E+02 2.1000000000000000E+02
10 0 0 0
0.0000000000000000E+00 2.0009999999999999E+02 2.1000000000000000E+02
11 0 0 0
1.0000000000000000E+02 3.0000000000000000E+02 2.1000000000000000E+02
12 0 0 0
2.0000000000000000E+02 1.0020000000000000E+02 2.1000000000000000E+02
13 0 0 0
2.0000000000000000E+02 2.0009999999999999E+02 2.1000000000000000E+02
14 0 0 0
1.0000000000000000E+02 0.0000000000000000E+00 2.1000000000000000E+02
15 0 0 0
0.0000000000000000E+00 1.0020000000000000E+02 0.0000000000000000E+00
16 0 0 0
0.0000000000000000E+00 2.0009999999999999E+02 0.0000000000000000E+00
17 0 0 0
1.0000000000000000E+02 3.0000000000000000E+02 0.0000000000000000E+00
18 0 0 0
2.0000000000000000E+02 1.0020000000000000E+02 0.0000000000000000E+00
19 0 0 0
2.0000000000000000E+02 2.0009999999999999E+02 0.0000000000000000E+00
20 0 0 0
1.0000000000000000E+02 0.0000000000000000E+00 0.0000000000000000E+00
21 0 0 0
2.0000000000000000E+02 3.0000000000000000E+02 1.0500000000000000E+02
22 0 0 0
0.0000000000000000E+00 3.0000000000000000E+02 1.0500000000000000E+02
23 0 0 0
2.0000000000000000E+02 0.0000000000000000E+00 1.0500000000000000E+02
24 0 0 0
0.0000000000000000E+00 0.0000000000000000E+00 1.0500000000000000E+02
25 0 0 0
9.6161727574445891E+01 1.3290789499900029E+02 2.1000000000000000E+02
26 0 0 0
8.0082880863556014E+01 2.2412763570985578E+02 2.1000000000000000E+02
27 0 0 0
9.6161727574240444E+01 1.3290789499883087E+02 0.0000000000000000E+00
28 0 0 0
8.0082880863392205E+01 2.2412763570989483E+02 0.0000000000000000E+00
29 0 0 0
2.0000000000000000E+02 1.5011560268321134E+02 1.0500000000592973E+02
30 0 0 0
0.0000000000000000E+00 1.5011560299451648E+02 1.0499999963389952E+02
31 0 0 0
9.9094099553883055E+01 7.2457929267250009E+01 1.0499999994714025E+02
-1
-1
2412
1 11 2 1 7 2
0 0 0
9 8
2 11 2 1 7 2
0 0 0
10 9
3 11 2 1 7 2
0 0 0
6 10
4 11 2 1 7 2
0 0 0
11 6
5 11 2 1 7 2
0 0 0
2 11
6 11 2 1 7 2
0 0 0
4 12
7 11 2 1 7 2
0 0 0
12 13
8 11 2 1 7 2
0 0 0
13 2
9 11 2 1 7 2
0 0 0
8 14
10 11 2 1 7 2
0 0 0
14 4
11 11 2 1 7 2
0 0 0
7 15
12 11 2 1 7 2
0 0 0
15 16
13 11 2 1 7 2
0 0 0
16 5
14 11 2 1 7 2
0 0 0
5 17
15 11 2 1 7 2
0 0 0
17 1
16 11 2 1 7 2
0 0 0
18 3
17 11 2 1 7 2
0 0 0
19 18
18 11 2 1 7 2
0 0 0
1 19
19 11 2 1 7 2
0 0 0
20 7
20 11 2 1 7 2
0 0 0
3 20
21 11 2 1 7 2
0 0 0
21 1
22 11 2 1 7 2
0 0 0
2 21
23 11 2 1 7 2
0 0 0
5 22
24 11 2 1 7 2
0 0 0
22 6
25 11 2 1 7 2
0 0 0
3 23
26 11 2 1 7 2
0 0 0
23 4
27 11 2 1 7 2
0 0 0
24 7
28 11 2 1 7 2
0 0 0
8 24
29 41 2 1 7 3
9 8 14
30 41 2 1 7 3
10 9 25
31 41 2 1 7 3
6 10 26
32 41 2 1 7 3
11 6 26
33 41 2 1 7 3
10 25 26
34 41 2 1 7 3
2 11 13
35 41 2 1 7 3
4 12 14
36 41 2 1 7 3
12 13 25
37 41 2 1 7 3
14 12 25
38 41 2 1 7 3
9 14 25
39 41 2 1 7 3
13 11 26
40 41 2 1 7 3
13 26 25
41 41 2 1 7 3
7 15 20
42 41 2 1 7 3
15 16 27
43 41 2 1 7 3
16 5 28
44 41 2 1 7 3
27 16 28
45 41 2 1 7 3
5 17 28
46 41 2 1 7 3
17 1 19
47 41 2 1 7 3
18 3 20
48 41 2 1 7 3
19 18 27
49 41 2 1 7 3
18 20 27
50 41 2 1 7 3
20 15 27
51 41 2 1 7 3
17 19 28
52 41 2 1 7 3
28 19 27
53 41 2 1 7 3
17 5 22
54 41 2 1 7 3
1 17 21
55 41 2 1 7 3
2 21 11
56 41 2 1 7 3
6 11 22
57 41 2 1 7 3
22 11 21
58 41 2 1 7 3
22 21 17
59 41 2 1 7 3
7 20 24
60 41 2 1 7 3
20 3 23
61 41 2 1 7 3
23 4 14
62 41 2 1 7 3
14 8 24
63 41 2 1 7 3
14 24 23
64 41 2 1 7 3
20 23 24
65 41 2 1 7 3
23 3 18
66 41 2 1 7 3
4 23 12
67 41 2 1 7 3
13 12 29
68 41 2 1 7 3
2 13 21
69 41 2 1 7 3
22 16 30
70 41 2 1 7 3
13 29 21
71 41 2 1 7 3
1 21 19
72 41 2 1 7 3
12 23 29
73 41 2 1 7 3
18 19 29
74 41 2 1 7 3
23 18 29
75 41 2 1 7 3
15 24 30
76 41 2 1 7 3
29 19 21
77 41 2 1 7 3
7 24 15
78 41 2 1 7 3
24 8 9
79 41 2 1 7 3
9 10 30
80 41 2 1 7 3
10 6 22
81 41 2 1 7 3
30 10 22
82 41 2 1 7 3
16 15 30
83 41 2 1 7 3
22 5 16
84 41 2 1 7 3
24 9 30
85 111 2 1 7 4
21 28 22 17
86 111 2 1 7 4
31 18 29 23
87 111 2 1 7 4
31 29 18 27
88 111 2 1 7 4
29 21 26 13
89 111 2 1 7 4
29 25 26 30
90 111 2 1 7 4
26 28 29 30
91 111 2 1 7 4
16 28 5 22
92 111 2 1 7 4
30 25 10 9
93 111 2 1 7 4
16 30 15 27
94 111 2 1 7 4
26 25 10 30
95 111 2 1 7 4
21 28 26 22
96 111 2 1 7 4
31 20 18 23
97 111 2 1 7 4
27 28 16 30
98 111 2 1 7 4
18 27 29 19
99 111 2 1 7 4
21 22 26 11
100 111 2 1 7 4
23 4 12 14
101 111 2 1 7 4
31 25 29 30
102 111 2 1 7 4
31 18 20 27
103 111 2 1 7 4
21 11 26 13
104 111 2 1 7 4
22 28 5 17
105 111 2 1 7 4
2 11 21 13
106 111 2 1 7 4
29 25 12 13
107 111 2 1 7 4
30 28 16 22
108 111 2 1 7 4
31 24 20 23
109 111 2 1 7 4
26 28 30 22
110 111 2 1 7 4
21 17 19 28
111 111 2 1 7 4
15 24 31 30
112 111 2 1 7 4
31 9 30 24
113 111 2 1 7 4
15 30 31 27
114 111 2 1 7 4
8 14 24 9
115 111 2 1 7 4
26 22 10 6
116 111 2 1 7 4
31 25 12 29
117 111 2 1 7 4
31 29 12 23
118 111 2 1 7 4
31 30 9 25
119 111 2 1 7 4
21 1 19 17
120 111 2 1 7 4
29 19 27 28
121 111 2 1 7 4
10 22 26 30
122 111 2 1 7 4
29 28 26 21
123 111 2 1 7 4
7 20 15 24
124 111 2 1 7 4
11 22 26 6
125 111 2 1 7 4
29 28 27 30
126 111 2 1 7 4
31 23 12 14
127 111 2 1 7 4
26 25 29 13
128 111 2 1 7 4
15 27 31 20
129 111 2 1 7 4
21 19 29 28
130 111 2 1 7 4
18 3 23 20
131 111 2 1 7 4
15 20 31 24
132 111 2 1 7 4
27 31 29 30
133 111 2 1 7 4
31 14 9 24
134 111 2 1 7 4
31 9 14 25
135 111 2 1 7 4
31 14 12 25
136 111 2 1 7 4
31 23 14 24
-1
-1
2467
0 0 0 0 0 0 0 10
outlet
8 70 0 0 8 67 0 0
8 68 0 0 8 71 0 0
8 76 0 0 8 66 0 0
8 72 0 0 8 73 0 0
8 74 0 0 8 65 0 0
1 0 0 0 0 0 0 12
inlet
8 36 0 0 8 30 0 0
8 31 0 0 8 37 0 0
8 34 0 0 8 38 0 0
8 33 0 0 8 35 0 0
8 32 0 0 8 29 0 0
8 39 0 0 8 40 0 0
2 0 0 0 0 0 0 12
nodes
7 2 0 0 7 4 0 0
7 6 0 0 7 8 0 0
7 9 0 0 7 10 0 0
7 11 0 0 7 12 0 0
7 13 0 0 7 14 0 0
7 25 0 0 7 26 0 0
-1

View File

@ -94,7 +94,8 @@ int main(int argc, char *argv[])
noFailedChecks += checkGeometry(mesh, allGeometry);
reduce(noFailedChecks, sumOp<label>());
// Note: no reduction in noFailedChecks necessary since is
// counter of checks, not counter of failed cells,faces etc.
if (noFailedChecks == 0)
{
@ -112,8 +113,6 @@ int main(int argc, char *argv[])
label nFailedChecks = checkGeometry(mesh, allGeometry);
reduce(nFailedChecks, sumOp<label>());
if (nFailedChecks)
{
Info<< "\nFailed " << nFailedChecks << " mesh checks.\n"

View File

@ -121,7 +121,7 @@ void Foam::SIBS::solve
kMax_ = kOpt_;
}
label k=0;
label k = 0;
scalar h = hTry;
yTemp_ = y;
@ -213,7 +213,7 @@ void Foam::SIBS::solve
x = xNew_;
hDid = h;
first_=0;
first_ = 0;
scalar wrkmin = GREAT;
scalar scale = 1.0;

View File

@ -27,7 +27,7 @@ License
#include "mapDistribute.H"
#include "commSchedule.H"
#include "HashSet.H"
#include "ListOps.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -257,6 +257,292 @@ Foam::mapDistribute::mapDistribute
}
Foam::mapDistribute::mapDistribute
(
const globalIndex& globalNumbering,
labelList& elements,
List<Map<label> >& compactMap
)
:
constructSize_(0),
schedulePtr_()
{
// 1. Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
compactMap.setSize(Pstream::nProcs());
{
// Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0);
forAll(elements, i)
{
label globalIndex = elements[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
nNonLocal[procI]++;
}
}
forAll(compactMap, procI)
{
if (procI != Pstream::myProcNo())
{
compactMap[procI].resize(2*nNonLocal[procI]);
}
}
// Collect all (non-local) elements needed.
forAll(elements, i)
{
label globalIndex = elements[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
label index = globalNumbering.toLocal(procI, globalIndex);
label nCompact = compactMap[procI].size();
compactMap[procI].insert(index, nCompact);
}
}
//// Sort remote elements needed (not really necessary)
//forAll(compactMap, procI)
//{
// if (procI != Pstream::myProcNo())
// {
// Map<label>& globalMap = compactMap[procI];
//
// SortableList<label> sorted(globalMap.toc().xfer());
//
// forAll(sorted, i)
// {
// Map<label>::iterator iter = globalMap.find(sorted[i]);
// iter() = i;
// }
// }
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
constructSize_ = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = constructSize_;
constructSize_ += compactMap[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
// What I want to receive is what others have to send
labelListList wantedRemoteElements(Pstream::nProcs());
// Compact addressing for received data
constructMap_.setSize(Pstream::nProcs());
forAll(compactMap, procI)
{
if (procI == Pstream::myProcNo())
{
// All my own elements are used
label nLocal = globalNumbering.localSize();
wantedRemoteElements[procI] = identity(nLocal);
constructMap_[procI] = identity(nLocal);
}
else
{
// Remote elements wanted from processor procI
labelList& remoteElem = wantedRemoteElements[procI];
labelList& localElem = constructMap_[procI];
remoteElem.setSize(compactMap[procI].size());
localElem.setSize(compactMap[procI].size());
label i = 0;
forAllIter(Map<label>, compactMap[procI], iter)
{
remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter();
localElem[i] = compactI;
iter() = compactI;
i++;
}
}
}
subMap_.setSize(Pstream::nProcs());
exchange(wantedRemoteElements, subMap_);
// Renumber elements
forAll(elements, i)
{
elements[i] = renumber(globalNumbering, compactMap, elements[i]);
}
}
Foam::mapDistribute::mapDistribute
(
const globalIndex& globalNumbering,
labelListList& cellCells,
List<Map<label> >& compactMap
)
:
constructSize_(0),
schedulePtr_()
{
// 1. Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
compactMap.setSize(Pstream::nProcs());
{
// Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0);
forAll(cellCells, cellI)
{
const labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
label globalIndex = cCells[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
nNonLocal[procI]++;
}
}
}
forAll(compactMap, procI)
{
if (procI != Pstream::myProcNo())
{
compactMap[procI].resize(2*nNonLocal[procI]);
}
}
// Collect all (non-local) elements needed.
// Collect all (non-local) elements needed.
forAll(cellCells, cellI)
{
const labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
label globalIndex = cCells[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
label index = globalNumbering.toLocal(procI, globalIndex);
label nCompact = compactMap[procI].size();
compactMap[procI].insert(index, nCompact);
}
}
}
//// Sort remote elements needed (not really necessary)
//forAll(compactMap, procI)
//{
// if (procI != Pstream::myProcNo())
// {
// Map<label>& globalMap = compactMap[procI];
//
// SortableList<label> sorted(globalMap.toc().xfer());
//
// forAll(sorted, i)
// {
// Map<label>::iterator iter = globalMap.find(sorted[i]);
// iter() = i;
// }
// }
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
constructSize_ = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = constructSize_;
constructSize_ += compactMap[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
// What I want to receive is what others have to send
labelListList wantedRemoteElements(Pstream::nProcs());
// Compact addressing for received data
constructMap_.setSize(Pstream::nProcs());
forAll(compactMap, procI)
{
if (procI == Pstream::myProcNo())
{
// All my own elements are used
label nLocal = globalNumbering.localSize();
wantedRemoteElements[procI] = identity(nLocal);
constructMap_[procI] = identity(nLocal);
}
else
{
// Remote elements wanted from processor procI
labelList& remoteElem = wantedRemoteElements[procI];
labelList& localElem = constructMap_[procI];
remoteElem.setSize(compactMap[procI].size());
localElem.setSize(compactMap[procI].size());
label i = 0;
forAllIter(Map<label>, compactMap[procI], iter)
{
remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter();
localElem[i] = compactI;
iter() = compactI;
i++;
}
}
}
subMap_.setSize(Pstream::nProcs());
exchange(wantedRemoteElements, subMap_);
// Renumber elements
forAll(cellCells, cellI)
{
labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
cCells[i] = renumber(globalNumbering, compactMap, cCells[i]);
}
}
}
Foam::mapDistribute::mapDistribute(const mapDistribute& map)
:
constructSize_(map.constructSize_),
@ -266,7 +552,27 @@ Foam::mapDistribute::mapDistribute(const mapDistribute& map)
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::mapDistribute::renumber
(
const globalIndex& globalNumbering,
const List<Map<label> >& compactMap,
const label globalI
)
{
if (globalNumbering.isLocal(globalI))
{
return globalNumbering.toLocal(globalI);
}
else
{
label procI = globalNumbering.whichProcID(globalI);
label index = globalNumbering.toLocal(procI, globalI);
return compactMap[procI][index];
}
}
void Foam::mapDistribute::compact(const boolList& elemIsUsed)
{

View File

@ -39,6 +39,16 @@ Note:
Note2: number of items send on one processor have to equal the number
of items received on the other processor.
Constructors using compact numbering: all my own elements first
(whether used or not) followed by used-only remote elements.
So e.g 4 procs and on proc 1 the compact
table will first have all globalIndex.localSize() elements from proc1
followed by used-only elements of proc0, proc2, proc3.
The constructed mapDistribute sends the local elements from and
receives the remote elements into their compact position.
compactMap[procI] is the position of elements from procI in the compact
map. compactMap[myProcNo()] is empty since trivial addressing. The indices
into compactMap[procI] are local, not global, indices.
SourceFiles
mapDistribute.C
@ -52,6 +62,7 @@ SourceFiles
#include "labelPair.H"
#include "Pstream.H"
#include "boolList.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,6 +70,7 @@ namespace Foam
{
class mapPolyMesh;
class globalIndex;
/*---------------------------------------------------------------------------*\
Class mapDistribute Declaration
@ -81,6 +93,15 @@ class mapDistribute
mutable autoPtr<List<labelPair> > schedulePtr_;
//- Exchange data. sendBuf[procI] : data to send to processor procI
// To be moved into Pstream.
template<class T>
static void exchange
(
const List<List<T> >& sendBuf,
List<List<T> >& recvBuf
);
public:
// Public classes
@ -123,6 +144,27 @@ public:
const labelList& recvProcs
);
//- Construct from list of (possibly) remote elements in globalIndex
// numbering. Determines compact numbering (see above) and
// distribute map to get data into this ordering and renumbers the
// elements to be in compact numbering.
mapDistribute
(
const globalIndex&,
labelList& elements,
List<Map<label> >& compactMap
);
//- Special variant that works with the into sorted into bins
// according to local indices. E.g. think cellCells where
// cellCells[localCellI] is a list of global cells
mapDistribute
(
const globalIndex&,
labelListList& cellCells,
List<Map<label> >& compactMap
);
//- Construct copy
mapDistribute(const mapDistribute&);
@ -180,6 +222,15 @@ public:
// Other
//- Helper for construct from globalIndex. Renumbers element
// (in globalIndex numbering) into compact indices.
static label renumber
(
const globalIndex&,
const List<Map<label> >& compactMap,
const label globalElement
);
//- Compact maps. Gets per field a bool whether it is used (locally)
// and works out itself what this side and sender side can remove
// from maps.

View File

@ -886,4 +886,78 @@ void Foam::mapDistribute::distribute
}
template<class T>
void Foam::mapDistribute::exchange
(
const List<List<T> >& sendBuf,
List<List<T> >& recvBuf
)
{
if (!contiguous<T>())
{
FatalErrorIn("mapDistribute::exchange(..)")
<< "Not contiguous" << exit(FatalError);
}
if (Pstream::parRun())
{
// Determine sizes
// ~~~~~~~~~~~~~~~
labelListList allNTrans(Pstream::nProcs());
allNTrans[Pstream::myProcNo()].setSize(Pstream::nProcs());
forAll(allNTrans, procI)
{
allNTrans[Pstream::myProcNo()][procI] = sendBuf[procI].size();
}
combineReduce(allNTrans, listEq());
// Set up receives
// ~~~~~~~~~~~~~~~
recvBuf.setSize(Pstream::nProcs());
forAll(recvBuf, procI)
{
if (procI != Pstream::myProcNo())
{
recvBuf[procI].setSize(allNTrans[procI][Pstream::myProcNo()]);
IPstream::read
(
Pstream::nonBlocking,
procI,
reinterpret_cast<char*>(recvBuf[procI].begin()),
recvBuf[procI].byteSize()
);
}
}
// Set up sends
// ~~~~~~~~~~~~
forAll(sendBuf, procI)
{
if (procI != Pstream::myProcNo())
{
OPstream::write
(
Pstream::nonBlocking,
procI,
reinterpret_cast<const char*>(sendBuf[procI].begin()),
sendBuf[procI].byteSize()
);
}
}
// Wait for completion
Pstream::waitRequests();
}
// Do myself
recvBuf[Pstream::myProcNo()] = sendBuf[Pstream::myProcNo()];
}
// ************************************************************************* //

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi());
meshCoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanMeshCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Mesh Courant Number mean: " << meanMeshCoNum

View File

@ -119,7 +119,7 @@ void fvMotionSolverEngineMesh::move()
pistonPosition_.value() += deltaZ;
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
<< "Piston speed = " << pistonSpeed << " m/s" << endl;

View File

@ -121,7 +121,7 @@ void layeredEngineMesh::move()
}
pistonPosition_.value() += deltaZ;
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
<< "Piston speed = " << pistonSpeed << " m/s" << endl;

View File

@ -165,7 +165,7 @@ Foam::scalar Foam::engineTime::thetaRevolution() const
Foam::scalar Foam::engineTime::deltaTheta() const
{
return timeToDeg(deltaT().value());
return timeToDeg(deltaTValue());
}
@ -216,7 +216,7 @@ Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
(
"pistonSpeed",
dimVelocity,
pistonDisplacement().value()/(deltaT().value() + VSMALL)
pistonDisplacement().value()/(deltaTValue() + VSMALL)
);
}

View File

@ -208,7 +208,7 @@ Foam::scalar Foam::engineValve::curVelocity() const
lift(engineDB_.theta() - engineDB_.deltaTheta()),
minLift_
)
)/(engineDB_.deltaT().value() + VSMALL);
)/(engineDB_.deltaTValue() + VSMALL);
}

View File

@ -106,7 +106,7 @@ const labelList& ignitionSite::cells() const
bool ignitionSite::igniting() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaT().value();
scalar deltaT = db_.deltaTValue();
return
(
@ -120,7 +120,7 @@ bool ignitionSite::igniting() const
bool ignitionSite::ignited() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaT().value();
scalar deltaT = db_.deltaTValue();
return(curTime - deltaT >= time_);
}

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi)/fvc::interpolate(rho);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

@ -180,7 +180,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
@ -240,7 +240,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su()
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{

View File

@ -41,12 +41,12 @@ if (adjustTimeStep)
(
min
(
deltaTFact*runTime.deltaT().value(),
deltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
// ************************************************************************* //

View File

@ -39,7 +39,7 @@ if (adjustTimeStep)
(
min
(
maxCo*runTime.deltaT().value()/CoNum,
maxCo*runTime.deltaTValue()/CoNum,
maxDeltaT
)
);

View File

@ -4,12 +4,12 @@
// Backward Differencing in time.
conserve.internalField() +=
(1.0 - mesh.V0()/mesh.V())/runTime.deltaT().value();
(1.0 - mesh.V0()/mesh.V())/runTime.deltaTValue();
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(conserve)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
conserve.weightedAverage(mesh.V()).value();
Info<< "volume continuity errors : sum local = " << sumLocalContErr

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

@ -33,10 +33,10 @@ Description
{
volScalarField contErr = fvc::div(phi);
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;

View File

@ -33,10 +33,10 @@ Description
{
volScalarField contErr = fvc::div(phi + fvc::meshPhi(U));
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;

View File

@ -32,11 +32,11 @@ Description
if (mesh.moving())
{
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(fvc::div(phi + fvc::meshPhi(rho, U)))()
.weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
fvc::div(phi + fvc::meshPhi(rho, U))()
.weightedAverage(mesh.V()).value();

View File

@ -223,7 +223,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
openFraction_
+ max
(
this->db().time().deltaT().value()/openingTime_,
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),

View File

@ -202,7 +202,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
this->dimensionedInternalField().mesh()
.ddtScheme(this->dimensionedInternalField().name())
);
scalar deltaT = this->db().time().deltaT().value();
scalar deltaT = this->db().time().deltaTValue();
const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry::

View File

@ -112,7 +112,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
oldFc[i] = pp[i].centre(oldPoints);
}
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue();
const volVectorField& U = db().lookupObject<volVectorField>("U");
scalarField phip =

View File

@ -196,7 +196,7 @@ void syringePressureFvPatchScalarField::updateCoeffs()
}
scalar t = db().time().value();
scalar deltaT = db().time().deltaT().value();
scalar deltaT = db().time().deltaTValue();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");

View File

@ -59,8 +59,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
IOobject::NO_WRITE
);
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -137,8 +137,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
IOobject::NO_WRITE
);
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -246,8 +246,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -307,8 +307,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -368,8 +368,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);

View File

@ -276,7 +276,7 @@ EulerDdtScheme<Type>::fvmDdt
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*mesh().V();
@ -311,7 +311,7 @@ EulerDdtScheme<Type>::fvmDdt
);
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*rho.value()*mesh().V();
@ -348,7 +348,7 @@ EulerDdtScheme<Type>::fvmDdt
);
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();

View File

@ -44,14 +44,14 @@ namespace fv
template<class Type>
scalar backwardDdtScheme<Type>::deltaT_() const
{
return mesh().time().deltaT().value();
return mesh().time().deltaTValue();
}
template<class Type>
scalar backwardDdtScheme<Type>::deltaT0_() const
{
return mesh().time().deltaT0().value();
return mesh().time().deltaT0Value();
}

View File

@ -42,13 +42,13 @@ namespace fv
scalar boundedBackwardDdtScheme::deltaT_() const
{
return mesh().time().deltaT().value();
return mesh().time().deltaTValue();
}
scalar boundedBackwardDdtScheme::deltaT0_() const
{
return mesh().time().deltaT0().value();
return mesh().time().deltaT0Value();
}

View File

@ -99,7 +99,7 @@ void Foam::MULES::explicitSolve
scalarField& psiIf = psi;
const scalarField& psi0 = psi.oldTime();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
psiIf = 0.0;
fvc::surfaceIntegrate(psiIf, phiPsi);
@ -328,7 +328,7 @@ void Foam::MULES::limiter
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighb = mesh.neighbour();
const scalarField& V = mesh.V();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
const scalarField& phiBDIf = phiBD;
const surfaceScalarField::GeometricBoundaryField& phiBDBf =

View File

@ -55,7 +55,7 @@ class centredCPCCellToFaceStencilObject
public:
TypeName("centredCFCCellToFaceStencil");
TypeName("centredCPCCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class centredFECCellToFaceStencilObject
public:
TypeName("centredCFCCellToFaceStencil");
TypeName("centredFECCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindCECCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindCECCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindCPCCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindCPCCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindFECCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindFECCellToFaceStencil");
// Constructors

View File

@ -93,202 +93,6 @@ void Foam::extendedCellToFaceStencil::writeStencilStats
}
Foam::autoPtr<Foam::mapDistribute>
Foam::extendedCellToFaceStencil::calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
)
{
// Convert stencil to schedule
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
// We now know what information we need from other processors. This needs
// to be converted into what information I need to send as well
// (mapDistribute)
// 1. Construct per processor compact addressing of the global cells
// needed. The ones from the local processor are not included since
// these are always all needed.
List<Map<label> > globalToProc(Pstream::nProcs());
{
const labelList& procPatchMap = mesh.globalData().procPatchMap();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Presize with (as estimate) size of patch to neighbour.
forAll(procPatchMap, procI)
{
if (procPatchMap[procI] != -1)
{
globalToProc[procI].resize
(
patches[procPatchMap[procI]].size()
);
}
}
// Collect all (non-local) globalcells/faces needed.
forAll(faceStencil, faceI)
{
const labelList& stencilCells = faceStencil[faceI];
forAll(stencilCells, i)
{
label globalCellI = stencilCells[i];
label procI = globalNumbering.whichProcID(stencilCells[i]);
if (procI != Pstream::myProcNo())
{
label nCompact = globalToProc[procI].size();
globalToProc[procI].insert(globalCellI, nCompact);
}
}
}
// Sort global cells needed (not really necessary)
forAll(globalToProc, procI)
{
if (procI != Pstream::myProcNo())
{
Map<label>& globalMap = globalToProc[procI];
SortableList<label> sorted(globalMap.toc().xfer());
forAll(sorted, i)
{
Map<label>::iterator iter = globalMap.find(sorted[i]);
iter() = i;
}
}
}
//forAll(globalToProc, procI)
//{
// Pout<< "From processor:" << procI << " want cells/faces:" << endl;
// forAllConstIter(Map<label>, globalToProc[procI], iter)
// {
// Pout<< " global:" << iter.key()
// << " local:" << globalNumbering.toLocal(procI, iter.key())
// << endl;
// }
// Pout<< endl;
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
label nCompact = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = nCompact;
nCompact += globalToProc[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
labelListList recvCompact(Pstream::nProcs());
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
if (procI != Pstream::myProcNo())
{
labelList wantedGlobals(globalToProc[procI].size());
recvCompact[procI].setSize(globalToProc[procI].size());
label i = 0;
forAllConstIter(Map<label>, globalToProc[procI], iter)
{
wantedGlobals[i] = iter.key();
recvCompact[procI][i] = compactStart[procI]+iter();
i++;
}
// Send the global cell numbers I need from procI
OPstream str(Pstream::blocking, procI);
str << wantedGlobals;
}
else
{
recvCompact[procI] =
compactStart[procI]
+ identity(globalNumbering.localSize());
}
}
labelListList sendCompact(Pstream::nProcs());
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
if (procI != Pstream::myProcNo())
{
// See what neighbour wants to receive (= what I need to send)
IPstream str(Pstream::blocking, procI);
labelList globalCells(str);
labelList& procCompact = sendCompact[procI];
procCompact.setSize(globalCells.size());
// Convert from globalCells (all on my processor!) into compact
// addressing
forAll(globalCells, i)
{
label cellI = globalNumbering.toLocal(globalCells[i]);
procCompact[i] = compactStart[Pstream::myProcNo()]+cellI;
}
}
else
{
sendCompact[procI] = recvCompact[procI];
}
}
// Convert stencil to compact numbering
forAll(faceStencil, faceI)
{
labelList& stencilCells = faceStencil[faceI];
forAll(stencilCells, i)
{
label globalCellI = stencilCells[i];
label procI = globalNumbering.whichProcID(globalCellI);
if (procI != Pstream::myProcNo())
{
label localCompact = globalToProc[procI][globalCellI];
stencilCells[i] = compactStart[procI]+localCompact;
}
else
{
label localCompact = globalNumbering.toLocal(globalCellI);
stencilCells[i] = compactStart[procI]+localCompact;
}
}
}
// Constuct map for distribution of compact data.
autoPtr<mapDistribute> mapPtr
(
new mapDistribute
(
nCompact,
sendCompact.xfer(),
recvCompact.xfer()
)
);
return mapPtr;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)

View File

@ -112,14 +112,6 @@ public:
// Member Functions
//- Calculate distribute map
static autoPtr<mapDistribute> calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
);
//- Use map to get the data into stencil order
template<class T>
static void collectData

View File

@ -35,16 +35,19 @@ Foam::extendedCentredCellToFaceStencil::extendedCentredCellToFaceStencil
const cellToFaceStencil& stencil
)
:
extendedCellToFaceStencil(stencil.mesh())
extendedCellToFaceStencil(stencil.mesh()),
stencil_(stencil)
{
stencil_ = stencil;
// Calculate distribute map (also renumbers elements in stencil)
mapPtr_ = calcDistributeMap
List<Map<label> > compactMap(Pstream::nProcs());
mapPtr_.reset
(
stencil.mesh(),
stencil.globalNumbering(),
stencil_
new mapDistribute
(
stencil.globalNumbering(),
stencil_,
compactMap
)
);
}

View File

@ -419,19 +419,32 @@ Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
neiStencil_
);
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
ownMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
ownStencil_,
compactMap
)
);
}
neiMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
neiStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
neiMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
neiStencil_,
compactMap
)
);
}
// stencil now in compact form
if (pureUpwind_)
@ -515,12 +528,18 @@ Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
ownStencil_ = stencil;
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
ownMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
ownStencil_,
compactMap
)
);
}
const fvMesh& mesh = dynamic_cast<const fvMesh&>(stencil.mesh());

View File

@ -28,9 +28,6 @@ License
#include "extendedCentredFaceToCellStencil.H"
#include "faceToCellStencil.H"
// Only for access to calcDistributeMap <- needs to be moved out
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil
@ -38,16 +35,19 @@ Foam::extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil
const faceToCellStencil& stencil
)
:
extendedFaceToCellStencil(stencil.mesh())
extendedFaceToCellStencil(stencil.mesh()),
stencil_(stencil)
{
stencil_ = stencil;
// Calculate distribute map (also renumbers elements in stencil)
mapPtr_ = extendedCellToFaceStencil::calcDistributeMap
List<Map<label> > compactMap(Pstream::nProcs());
mapPtr_.reset
(
stencil.mesh(),
stencil.globalNumbering(),
stencil_
new mapDistribute
(
stencil.globalNumbering(),
stencil_,
compactMap
)
);
}

View File

@ -576,7 +576,7 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
// Move the polyMesh and set the mesh motion fluxes to the swept-volumes
scalar rDeltaT = 1.0/time().deltaT().value();
scalar rDeltaT = 1.0/time().deltaTValue();
tmp<scalarField> tsweptVols = polyMesh::movePoints(p);
scalarField& sweptVols = tsweptVols();

View File

@ -142,7 +142,7 @@ Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
(
cmpt_,
tcurPoints().component(cmpt_)
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
);
twoDCorrectPoints(tcurPoints());

View File

@ -112,7 +112,7 @@ Foam::velocityLaplacianFvMotionSolver::curPoints() const
tmp<pointField> tcurPoints
(
fvMesh_.points()
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
);
twoDCorrectPoints(tcurPoints());

View File

@ -146,7 +146,7 @@ void angularOscillatingVelocityPointPatchVectorField::updateCoeffs()
+ (axisHat ^ p0Rel*sin(angle))
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
- p.localPoints()
)/t.deltaT().value()
)/t.deltaTValue()
);
fixedValuePointPatchField<vector>::updateCoeffs();

View File

@ -125,7 +125,7 @@ void oscillatingVelocityPointPatchVectorField::updateCoeffs()
Field<vector>::operator=
(
(p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
/t.deltaT().value()
/t.deltaTValue()
);
fixedValuePointPatchField<vector>::updateCoeffs();

View File

@ -129,7 +129,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
// calculate the forces on the motion object from this data, then
// update the positions
motion_.updatePosition(t.deltaT().value());
motion_.updatePosition(t.deltaTValue());
dictionary forcesDict;
@ -157,7 +157,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
(
fm.first().first() + fm.first().second() + gravity*motion_.mass(),
fm.second().first() + fm.second().second(),
t.deltaT().value()
t.deltaTValue()
);
Field<vector>::operator=(motion_.generatePositions(p0_) - p0_);

View File

@ -64,7 +64,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
const pointField& localPoints = patch().localPoints();
const labelList& meshPoints = patch().meshPoints();
//const scalar deltaT = mesh.time().deltaT().value();
//const scalar deltaT = mesh.time().deltaTValue();
// Construct large enough vector in direction of projectDir so
// we're guaranteed to hit something.
@ -451,7 +451,7 @@ void surfaceDisplacementPointPatchVectorField::updateCoeffs()
// Clip offset to maximum displacement possible: velocity*timestep
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
const vector clipVelocity = velocity_*deltaT;
forAll(displacement, i)

View File

@ -63,7 +63,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
const pointField& localPoints = patch().localPoints();
const labelList& meshPoints = patch().meshPoints();
//const scalar deltaT = mesh.time().deltaT().value();
//const scalar deltaT = mesh.time().deltaTValue();
// Construct large enough vector in direction of projectDir so
// we're guaranteed to hit something.

View File

@ -373,7 +373,7 @@ inline Foam::scalar Foam::Particle<ParticleType>::currentTime() const
{
return
cloud_.pMesh().time().value()
+ stepFraction_*cloud_.pMesh().time().deltaT().value();
+ stepFraction_*cloud_.pMesh().time().deltaTValue();
}

View File

@ -100,7 +100,7 @@ bool Foam::parcel::move(spray& sDB)
const liquidMixture& fuels = sDB.fuels();
scalar deltaT = sDB.runTime().deltaT().value();
scalar deltaT = sDB.runTime().deltaTValue();
label Nf = fuels.components().size();
label Ns = sDB.composition().Y().size();

View File

@ -157,7 +157,7 @@ inline tmp<volVectorField> spray::momentumSource() const
)
);
tsource().internalField() = sms_/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = sms_/runTime_.deltaTValue()/mesh_.V();
return tsource;
}
@ -185,7 +185,7 @@ inline tmp<volScalarField> spray::evaporationSource(const label si) const
if (isLiquidFuel_[si])
{
label fi = gasToLiquidIndex_[si];
tsource().internalField() = srhos_[fi]/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = srhos_[fi]/runTime_.deltaTValue()/mesh_.V();
}
else
{
@ -216,7 +216,7 @@ inline tmp<volScalarField> spray::heatTransferSource() const
)
);
tsource().internalField() = shs_/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = shs_/runTime_.deltaTValue()/mesh_.V();
return tsource;
}

View File

@ -71,7 +71,7 @@ void spray::inject()
// deltaT is the duration of injection during this timestep
scalar deltaT = min
(
runTime_.deltaT().value(),
runTime_.deltaTValue(),
min
(
time - it->tsoi(),
@ -150,8 +150,8 @@ void spray::inject()
scalar dt = time - toi;
pPtr->stepFraction() =
(runTime_.deltaT().value() - dt)
/runTime_.deltaT().value();
(runTime_.deltaTValue() - dt)
/runTime_.deltaTValue();
bool keepParcel = pPtr->move(*this);

View File

@ -58,7 +58,7 @@ void spray::evolve()
calculateAmbientPressure();
calculateAmbientTemperature();
collisions().collideParcels(runTime_.deltaT().value());
collisions().collideParcels(runTime_.deltaTValue());
move();
dispersion().disperseParcels();
inject();
@ -103,7 +103,7 @@ void spray::breakupLoop()
breakup().updateParcelProperties
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);
@ -111,7 +111,7 @@ void spray::breakupLoop()
breakup().breakupParcel
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);
@ -137,7 +137,7 @@ void spray::atomizationLoop()
atomization().atomizeParcel
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);

View File

@ -72,7 +72,7 @@ void gradientDispersionRAS::disperseParcels() const
const scalar cps = 0.16432;
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const volScalarField& k = turbulence().k();
volVectorField gradk = fvc::grad(k);
const volScalarField& epsilon = turbulence().epsilon();

View File

@ -73,7 +73,7 @@ void stochasticDispersionRAS::disperseParcels() const
const scalar cps = 0.16432;
const vector one(1.0, 1.0, 1.0);
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const volScalarField& k = turbulence().k();
//volVectorField gradk = fvc::grad(k);
const volScalarField& epsilon = turbulence().epsilon();

View File

@ -104,7 +104,7 @@ bool reflectParcel::wallTreatment
vector Ub1 = U_.boundaryField()[patchi][facei];
vector Ub0 = U_.oldTime().boundaryField()[patchi][facei];
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const vectorField& oldPoints = mesh.oldPoints();
const vector& Cf1 = mesh.faceCentres()[globalFacei];

View File

@ -128,7 +128,7 @@ inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
template<class ParcelType>
inline void Foam::DsmcCloud<ParcelType>::storeDeltaT()
{
cachedDeltaT_ = mesh().time().deltaT().value();
cachedDeltaT_ = mesh().time().deltaTValue();
}

View File

@ -47,6 +47,7 @@ $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
/* bolt-on models */
submodels/addOns/radiation/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
/* data entries */

View File

@ -167,7 +167,7 @@ void Foam::KinematicCloud<ParcelType>::checkParcelProperties
parcel.rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaT().value();
scalar carrierDt = this->db().time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}

View File

@ -84,7 +84,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
false
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
dimensionedScalar("zero", dimEnergy, 0.0)
),
hcTrans_
(
@ -98,7 +98,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
false
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
dimensionedScalar("zero", dimEnergy, 0.0)
)
{
if (readFields)

View File

@ -226,7 +226,7 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
const polyMesh& mesh = td.cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
const scalar dtMax = tEnd;
@ -286,7 +286,13 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
ParcelType& p = static_cast<ParcelType&>(*this);
td.cloud().postProcessing().postPatch(p, patchI);
return td.cloud().patchInteraction().correct(pp, this->face(), U_);
return td.cloud().patchInteraction().correct
(
pp,
this->face(),
td.keepParticle,
U_
);
}

View File

@ -462,15 +462,21 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
{
const label idc =
td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[idc].H(T);
const label idl = td.cloud().composition().globalIds(idPhase)[i];
const scalar hl =
td.cloud().composition().liquids().properties()[idl].h(pc_, T);
// Enthalphy transfer to carrier phase
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[idc].H(Ts);
const scalar hl =
td.cloud().composition().liquids().properties()[idl].h(pc_, Ts);
// Enthalphy transfer to carrier phase - method 1 using enthalpy diff
Sh += dMassPC[i]*(hl - hv)/dt;
// Enthalphy transfer to carrier phase - method 2 using latent heat
// const scalar hl =
// td.cloud().composition().liquids().properties()[idl].hl(pc_, Ts);
// Sh -= dMassPC[i]*hl/dt;
// Update particle surface thermo properties
const scalar Dab =
td.cloud().composition().liquids().properties()[idl].D(pc_, Ts, Wc);

View File

@ -351,7 +351,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
}
const scalar time = owner_.db().time().value();
const scalar carrierDt = owner_.db().time().deltaT().value();
const scalar carrierDt = owner_.db().time().deltaTValue();
const polyMesh& mesh = owner_.mesh();
// Prepare for next time step

View File

@ -26,7 +26,7 @@ License
#include "LocalInteraction.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template <class CloudType>
Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
@ -46,7 +46,7 @@ Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template <class CloudType>
Foam::LocalInteraction<CloudType>::LocalInteraction
@ -62,6 +62,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
// check that user patches are valid region patches
forAll(patchData_, patchI)
{
const word& patchName = patchData_[patchI].patchName();
@ -70,7 +71,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
{
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Patch " << patchName << " not found. Available patches "
<< "are: " << bMesh.names() << exit(FatalError);
<< "are: " << bMesh.names() << nl << exit(FatalError);
}
}
@ -95,6 +96,26 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
<< "interaction. Please specify data for patches:" << nl
<< badWalls << nl << exit(FatalError);
}
// check that interactions are valid/specified
forAll(patchData_, patchI)
{
const word& interactionTypeName =
patchData_[patchI].interactionTypeName();
const typename PatchInteractionModel<CloudType>::interactionType& it =
this->wordToInteractionType(interactionTypeName);
if (it == PatchInteractionModel<CloudType>::itOther)
{
const word& patchName = patchData_[patchI].patchName();
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Unknown patch interaction type "
<< interactionTypeName << " for patch " << patchName
<< ". Valid selections are:"
<< this->PatchInteractionModel<CloudType>::interactionTypeNames_
<< nl << exit(FatalError);
}
}
}
@ -105,7 +126,7 @@ Foam::LocalInteraction<CloudType>::~LocalInteraction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::LocalInteraction<CloudType>::active() const
@ -119,6 +140,7 @@ bool Foam::LocalInteraction<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
@ -126,18 +148,64 @@ bool Foam::LocalInteraction<CloudType>::correct
if (patchI >= 0)
{
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
typename PatchInteractionModel<CloudType>::interactionType it =
this->wordToInteractionType
(
patchData_[patchI].interactionTypeName()
);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
switch (it)
{
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
U -= patchData_[patchI].mu()*Ut;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
{
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
U -= patchData_[patchI].mu()*Ut;
break;
}
default:
{
FatalErrorIn
(
"bool LocalInteraction<CloudType>::correct"
"("
"const polyPatch&, "
"const label, "
"bool&, "
"vector&"
") const"
) << "Unknown interaction type "
<< patchData_[patchI].interactionTypeName()
<< "(" << it << ") for patch "
<< patchData_[patchI].patchName()
<< ". Valid selections are:" << this->interactionTypeNames_
<< endl << abort(FatalError);
}
}
return true;
}

View File

@ -34,7 +34,7 @@ Description
#define LocalInteraction_H
#include "PatchInteractionModel.H"
#include "dictionaryEntry.H"
#include "patchInteractionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,78 +49,6 @@ class LocalInteraction
:
public PatchInteractionModel<CloudType>
{
class patchInteractionData
{
// Private data
//- Patch name
word patchName_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
scalar mu_;
public:
//- Construct null
patchInteractionData()
:
patchName_("unknownPatch"),
e_(0.0),
mu_(0.0)
{}
//- Construct from dictionary
patchInteractionData(const dictionary& dict);
// Member functions
// Access
//- Return const access to the patch name
const word& patchName() const
{
return patchName_;
}
//- Return const access to the elasticity coefficient
scalar e() const
{
return e_;
}
//- Return const access to the restitution coefficient
scalar mu() const
{
return mu_;
}
// I-O
//- Istream operator
friend Istream& operator>>(Istream& is, patchInteractionData& pid)
{
is.check
(
"Istream& operator>>"
"(Istream&, patchInteractionData&)"
);
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("e") >> pid.e_;
entry.lookup("mu") >> pid.mu_;
return is;
}
};
// Private data
//- List of participating patches
@ -164,6 +92,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "patchInteractionData.H"
#include "dictionaryEntry.H"
#include "PatchInteractionModel.H"
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
Foam::patchInteractionData::patchInteractionData()
:
interactionTypeName_("unknownInteractionTypeName"),
patchName_("unknownPatch"),
e_(0.0),
mu_(0.0)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::word& Foam::patchInteractionData::interactionTypeName() const
{
return interactionTypeName_;
}
const Foam::word& Foam::patchInteractionData::patchName() const
{
return patchName_;
}
Foam::scalar Foam::patchInteractionData::e() const
{
return e_;
}
Foam::scalar Foam::patchInteractionData::mu() const
{
return mu_;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>
(
Istream& is,
patchInteractionData& pid
)
{
is.check("Istream& operator>>(Istream&, patchInteractionData&)");
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("type") >> pid.interactionTypeName_;
pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0);
pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0);
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::patchInteractionData
Description
Helper class for the LocalInteraction patch interaction model
\*---------------------------------------------------------------------------*/
#ifndef patchInteractionData_H
#define patchInteractionData_H
#include "Istream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class patchInteractionData Declaration
\*---------------------------------------------------------------------------*/
// Forward declaration of classes
class patchInteractionData;
// Forward declaration of friend functions
Istream& operator>>
(
Istream& is,
patchInteractionData& pid
);
class patchInteractionData
{
// Private data
//- Interaction type name
word interactionTypeName_;
//- Patch name
word patchName_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
scalar mu_;
public:
// Constructor
//- Construct null
patchInteractionData();
// Member functions
// Access
//- Return const access to the interaction type name
const word& interactionTypeName() const;
//- Return const access to the patch name
const word& patchName() const;
//- Return const access to the elasticity coefficient
scalar e() const;
//- Return const access to the restitution coefficient
scalar mu() const;
// I-O
//- Istream operator
friend Istream& operator>>
(
Istream& is,
patchInteractionData& pid
);
/* {
is.check
(
"Istream& operator>>"
"(Istream&, patchInteractionData&)"
);
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("type") >> pid.interactionTypeName_;
pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0);
pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0);
if
(
PatchInteractionModel<CloudType>::wordToInteractionType
(
pid.interactionTypeName_
)
== PatchInteractionModel<CloudType>::itOther)
{
FatalErrorIn
(
"friend Istream& operator>>"
"("
"Istream&, "
"patchInteractionData&"
")"
) << "Unknown patch interaction type "
<< pid.interactionTypeName_
<< ". Valid selections are:"
<< PatchInteractionModel<CloudType>::
interactionTypeNames_
<< endl << abort(FatalError);
}
return is;
}
*/};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,6 +26,76 @@ License
#include "PatchInteractionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::wordList Foam::PatchInteractionModel<CloudType>::interactionTypeNames_
(
IStringStream
(
"(rebound stick escape)"
)()
);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::word Foam::PatchInteractionModel<CloudType>::interactionTypeToWord
(
const interactionType& itEnum
)
{
switch (itEnum)
{
case itRebound:
{
return "rebound";
break;
}
case itStick:
{
return "stick";
break;
}
case itEscape:
{
return "escape";
break;
}
default:
{
return "other";
}
}
}
template<class CloudType>
typename Foam::PatchInteractionModel<CloudType>::interactionType
Foam::PatchInteractionModel<CloudType>::wordToInteractionType
(
const word& itWord
)
{
if (itWord == "rebound")
{
return itRebound;
}
else if (itWord == "stick")
{
return itStick;
}
else if (itWord == "escape")
{
return itEscape;
}
else
{
return itOther;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -40,6 +40,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "polyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,6 +54,24 @@ namespace Foam
template<class CloudType>
class PatchInteractionModel
{
public:
// Public enumerations
// Interaction types
enum interactionType
{
itRebound,
itStick,
itEscape,
itOther
};
static wordList interactionTypeNames_;
private:
// Private data
//- The cloud dictionary
@ -121,6 +140,12 @@ public:
// Member Functions
//- Convert interaction result to word
static word interactionTypeToWord(const interactionType& itEnum);
//- Convert word to interaction result
static interactionType wordToInteractionType(const word& itWord);
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const = 0;
@ -130,6 +155,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const = 0;
};

View File

@ -61,9 +61,12 @@ bool Foam::Rebound<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
keepParticle = true;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);

View File

@ -82,6 +82,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -36,9 +36,45 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
)
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
e_(dimensionedScalar(this->coeffDict().lookup("e")).value()),
mu_(dimensionedScalar(this->coeffDict().lookup("mu")).value())
{}
interactionType_
(
this->wordToInteractionType(this->coeffDict().lookup("type"))
),
e_(0.0),
mu_(0.0)
{
switch (interactionType_)
{
case PatchInteractionModel<CloudType>::itOther:
{
word interactionTypeName(this->coeffDict().lookup("type"));
FatalErrorIn
(
"StandardWallInteraction<CloudType>::StandardWallInteraction"
"("
"const dictionary&, "
"CloudType& cloud"
")"
) << "Unknown interaction result type "
<< interactionTypeName
<< ". Valid selections are:" << this->interactionTypeNames_
<< endl << exit(FatalError);
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
e_ = this->coeffDict().lookupOrDefault("e", 1.0);
mu_ = this->coeffDict().lookupOrDefault("mu", 0.0);
break;
}
default:
{
// do nothing
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -62,23 +98,62 @@ bool Foam::StandardWallInteraction<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
if (isA<wallPolyPatch>(pp))
{
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
switch (interactionType_)
{
U -= (1.0 + e_)*Un*nw;
}
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
U -= mu_*Ut;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
{
U -= (1.0 + e_)*Un*nw;
}
U -= mu_*Ut;
break;
}
default:
{
FatalErrorIn
(
"bool StandardWallInteraction<CloudType>::correct"
"("
"const polyPatch&, "
"const label, "
"bool&, "
"vector&"
") const"
) << "Unknown interaction type "
<< this->interactionTypeToWord(interactionType_)
<< "(" << interactionType_ << ")" << endl
<< abort(FatalError);
}
}
return true;
}

View File

@ -26,7 +26,19 @@ Class
Foam::StandardWallInteraction
Description
Wall interaction based on restitution and elasticity coefficients
Wall interaction model. Three choices:
- rebound - optionally specify elasticity and resitution coefficients
- stick - particles assigined zero velocity
- escape - remove particle from the domain
Example usage:
StandardWallInteractionCoeffs
{
type rebound; // stick, escape
e 1; // optional - elasticity coeff
mu 0; // optional - restitution coeff
}
\*---------------------------------------------------------------------------*/
@ -40,7 +52,7 @@ Description
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class StandardWallInteraction Declaration
Class StandardWallInteraction Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
@ -48,13 +60,19 @@ class StandardWallInteraction
:
public PatchInteractionModel<CloudType>
{
// Private data
protected:
//- Elasticity
const scalar e_;
// Protected data
//- Interaction type
typename PatchInteractionModel<CloudType>::interactionType
interactionType_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
const scalar mu_;
scalar mu_;
public:
@ -84,6 +102,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -161,7 +161,7 @@ void Foam::LiquidEvaporation<CloudType>::calculate
// vapour diffusivity [m2/s]
scalar Dab = liquids_->properties()[lid].D(pc, Ts);
// Saturation pressure for species i [pa]
// saturation pressure for species i [pa]
// - carrier phase pressure assumed equal to the liquid vapour pressure
// close to the surface
// NOTE: if pSat > pc then particle is superheated

View File

@ -41,9 +41,9 @@ void Foam::correlationFunction<Type>::setTimesAndSizes
const label tZeroBufferSize
)
{
sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaT().value());
sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaTValue());
sampleInterval_ = sampleSteps_*mesh_.time().deltaT().value();
sampleInterval_ = sampleSteps_*mesh_.time().deltaTValue();
label bufferLength(ceil(duration_/sampleInterval_));

View File

@ -88,7 +88,7 @@ bool Foam::molecule::move(molecule::trackData& td)
const constantProperties& constProps(td.molCloud().constProps(id_));
scalar deltaT = cloud().pMesh().time().deltaT().value();
scalar deltaT = cloud().pMesh().time().deltaTValue();
if (td.part() == 0)
{

Some files were not shown because too many files have changed in this diff Show More