2010-11-24 23:00:58 +00:00
|
|
|
// Detect the space patch
|
|
|
|
label spacePatchID = -1;
|
|
|
|
|
|
|
|
forAll (mesh.boundary(), patchI)
|
|
|
|
{
|
|
|
|
if (mesh.boundary()[patchI].name() == "space")
|
|
|
|
{
|
|
|
|
spacePatchID = patchI;
|
|
|
|
|
|
|
|
Info<< "Found space patch. ID: "
|
|
|
|
<< spacePatchID << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (spacePatchID < 0)
|
|
|
|
{
|
|
|
|
FatalErrorIn(args.executable())
|
|
|
|
<< "Space patch not defined. Please make sure that "
|
|
|
|
<< "the space patch is named as space."
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IOdictionary mrfProperties
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"mrfProperties",
|
|
|
|
runTime.constant(),
|
|
|
|
mesh,
|
Vanilla backport
- in FOAM library
updated containers
backported PackedBoolList, hashedWordList, nullObject, wordRe,
backported functions to
backported int32 support
backported tableReaders
backported Function1, TimeFunction1
backported dynamicCode (for codedBCs, ...) -- needs to be mapped out
advanced error macros (FatalIOErrorInFunction, ...) -- needs to be mapped out
backported IOobject::MUST_READ_IF_MODIFIED and added IOobject::READ_IF_PRESENT_IF_MODIFIED (only in FO)
- in postProcessing
backported IO FOs (partialWrite, removeRegisteredObject, writeDictionary, writeRegisteredObject)
backported field FOs (fieldCoordinateSystemTransform, fieldValues, nearWallFields, processorField, readFields, regionSizeDistribution, streamLine, wallBoundedStreamLine)
backported fvTools FOs (calcFvcDiv, calcFvcGrad, calcMag)
backported jobControl FOs (abortCalculation)
backported utilities FOs (ourantNo, Lambda2, Peclet, Q, codedFunctionObject, pressureTools, residuals, scalarTransport, setTimeStep, timeActivatedFileUpdate, turbulenceFields, vorticity, wallShearStress)
2017-04-09 13:11:54 +00:00
|
|
|
IOobject::MUST_READ_IF_MODIFIED,
|
2010-11-24 23:00:58 +00:00
|
|
|
IOobject::NO_WRITE
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
scalar lambdaFf
|
|
|
|
(
|
|
|
|
readScalar(mrfProperties.lookup("lambdaFf"))
|
|
|
|
);
|
|
|
|
|
|
|
|
scalar lambdaF0
|
|
|
|
(
|
|
|
|
readScalar(mrfProperties.lookup("lambdaF0"))
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// Parameters of moving reference frame
|
|
|
|
IOdictionary movingReferenceFrame
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"movingReferenceFrame",
|
|
|
|
runTime.timeName(),
|
|
|
|
mesh,
|
|
|
|
IOobject::READ_IF_PRESENT,
|
|
|
|
IOobject::AUTO_WRITE
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// - Bubble center
|
|
|
|
vector Cb;
|
|
|
|
if (movingReferenceFrame.found("Cb"))
|
|
|
|
{
|
|
|
|
Cb = vector
|
|
|
|
(
|
|
|
|
movingReferenceFrame.lookup("Cb")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (interface.twoFluids())
|
|
|
|
{
|
|
|
|
Cb = gSum((1.0 - fluidIndicator.internalField())
|
|
|
|
*mesh.C().internalField()*mesh.V())/
|
|
|
|
gSum((1.0 - fluidIndicator.internalField())*mesh.V());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
scalar Va = gSum(mesh.V().field());
|
2013-07-18 01:02:34 +00:00
|
|
|
vector Ra =
|
2010-11-24 23:00:58 +00:00
|
|
|
gSum(mesh.C().internalField()*mesh.V().field())
|
|
|
|
/gSum(mesh.V().field());
|
|
|
|
|
|
|
|
Info << "Ra = " << Ra << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2010-11-24 23:00:58 +00:00
|
|
|
scalar Vb =
|
|
|
|
- gSum
|
|
|
|
(
|
|
|
|
mesh.Cf().boundaryField()[interface.aPatchID()]
|
|
|
|
& mesh.Sf().boundaryField()[interface.aPatchID()]
|
|
|
|
)/3;
|
|
|
|
|
|
|
|
scalar V = Va + Vb;
|
|
|
|
|
|
|
|
Cb = (V*Ra - Va*Ra)/Vb;
|
|
|
|
|
|
|
|
Info << "Current bubble centre: " << Cb << endl;
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2010-11-24 23:00:58 +00:00
|
|
|
if (mesh.nGeometricD() != 3)
|
|
|
|
{
|
|
|
|
FatalErrorIn(args.executable())
|
|
|
|
<< "One-fluid bubble centroid calc "
|
|
|
|
<< "is not implemented for 2d mesh"
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
movingReferenceFrame.add("Cb", Cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - Bubble centre at the start of calculation
|
|
|
|
vector Cbf;
|
|
|
|
if (movingReferenceFrame.found("Cbf"))
|
|
|
|
{
|
|
|
|
Cbf = vector
|
|
|
|
(
|
|
|
|
movingReferenceFrame.lookup("Cbf")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
2013-07-18 01:02:34 +00:00
|
|
|
{
|
2010-11-24 23:00:58 +00:00
|
|
|
Cbf = Cb;
|
|
|
|
|
|
|
|
movingReferenceFrame.add("Cbf", Cbf);
|
|
|
|
}
|
|
|
|
|
|
|
|
// - Bubble position vector
|
|
|
|
dimensionedVector XF ("XF", dimLength, vector::zero);
|
|
|
|
if (movingReferenceFrame.found("XF"))
|
|
|
|
{
|
|
|
|
XF = dimensionedVector
|
|
|
|
(
|
|
|
|
movingReferenceFrame.lookup("XF")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XF = dimensionedVector
|
|
|
|
(
|
|
|
|
"XF",
|
|
|
|
dimLength,
|
|
|
|
Cbf
|
|
|
|
);
|
|
|
|
|
|
|
|
movingReferenceFrame.add("XF", XF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// - Bubble velocity
|
|
|
|
dimensionedVector UF ("UF", dimVelocity, vector::zero);
|
|
|
|
if (movingReferenceFrame.found("UF"))
|
|
|
|
{
|
|
|
|
UF = dimensionedVector
|
|
|
|
(
|
|
|
|
movingReferenceFrame.lookup("UF")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
movingReferenceFrame.add("UF", UF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// - Bubble acceleration
|
|
|
|
dimensionedVector aF ("aF", dimAcceleration, vector::zero);
|
|
|
|
if (movingReferenceFrame.found("aF"))
|
|
|
|
{
|
|
|
|
aF = dimensionedVector
|
|
|
|
(
|
|
|
|
movingReferenceFrame.lookup("aF")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
movingReferenceFrame.add("aF", aF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IOdictionary bubbleProperties
|
|
|
|
(
|
|
|
|
IOobject
|
|
|
|
(
|
|
|
|
"bubbleProperties",
|
|
|
|
runTime.timeName(),
|
|
|
|
mesh,
|
|
|
|
IOobject::READ_IF_PRESENT,
|
|
|
|
IOobject::AUTO_WRITE
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
scalar Vb;
|
|
|
|
if (bubbleProperties.found("Vb"))
|
|
|
|
{
|
|
|
|
Vb = readScalar
|
|
|
|
(
|
|
|
|
bubbleProperties.lookup("Vb")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Vb = gSum((1.0 - fluidIndicator.internalField())*mesh.V());
|
|
|
|
|
|
|
|
if (!interface.twoFluids())
|
|
|
|
{
|
|
|
|
scalar Va = gSum(mesh.V().field());
|
2013-07-18 01:02:34 +00:00
|
|
|
|
2010-11-24 23:00:58 +00:00
|
|
|
boundBox box(mesh.C().boundaryField()[spacePatchID]);
|
|
|
|
scalar r = (box.max().x() - box.min().x())/2;
|
|
|
|
|
|
|
|
scalar V = 4*M_PI*pow(r,3)/3;
|
|
|
|
|
|
|
|
Vb = V - Va;
|
|
|
|
|
|
|
|
if (mesh.nGeometricD() != 3)
|
|
|
|
{
|
|
|
|
FatalErrorIn(args.executable())
|
|
|
|
<< "One-fluid bubble centroid calc "
|
|
|
|
<< "is not implemented for 2d mesh"
|
|
|
|
<< abort(FatalError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bubbleProperties.add("Vb", Vb);
|
|
|
|
}
|
|
|
|
|
|
|
|
scalar Vbf;
|
|
|
|
if (bubbleProperties.found("Vbf"))
|
|
|
|
{
|
|
|
|
Vbf = readScalar
|
|
|
|
(
|
|
|
|
bubbleProperties.lookup("Vbf")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Vbf = Vb;
|
|
|
|
bubbleProperties.add("Vbf", Vbf);
|
|
|
|
}
|