1 // Detect the space patch
2 label spacePatchID = -1;
4 forAll (mesh.boundary(), patchI)
6 if (mesh.boundary()[patchI].name() == "space")
10 Info<< "Found space patch. ID: "
11 << spacePatchID << endl;
17 FatalErrorIn(args.executable())
18 << "Space patch not defined. Please make sure that "
19 << "the space patch is named as space."
24 IOdictionary mrfProperties
38 readScalar(mrfProperties.lookup("lambdaFf"))
43 readScalar(mrfProperties.lookup("lambdaF0"))
47 // Parameters of moving reference frame
48 IOdictionary movingReferenceFrame
52 "movingReferenceFrame",
55 IOobject::READ_IF_PRESENT,
63 if (movingReferenceFrame.found("Cb"))
67 movingReferenceFrame.lookup("Cb")
72 if (interface.twoFluids())
74 Cb = gSum((1.0 - fluidIndicator.internalField())
75 *mesh.C().internalField()*mesh.V())/
76 gSum((1.0 - fluidIndicator.internalField())*mesh.V());
80 scalar Va = gSum(mesh.V().field());
82 gSum(mesh.C().internalField()*mesh.V().field())
83 /gSum(mesh.V().field());
85 Info << "Ra = " << Ra << endl;
90 mesh.Cf().boundaryField()[interface.aPatchID()]
91 & mesh.Sf().boundaryField()[interface.aPatchID()]
96 Cb = (V*Ra - Va*Ra)/Vb;
98 Info << "Current bubble centre: " << Cb << endl;
100 if (mesh.nGeometricD() != 3)
102 FatalErrorIn(args.executable())
103 << "One-fluid bubble centroid calc "
104 << "is not implemented for 2d mesh"
105 << abort(FatalError);
109 movingReferenceFrame.add("Cb", Cb);
112 // - Bubble centre at the start of calculation
114 if (movingReferenceFrame.found("Cbf"))
118 movingReferenceFrame.lookup("Cbf")
125 movingReferenceFrame.add("Cbf", Cbf);
128 // - Bubble position vector
129 dimensionedVector XF ("XF", dimLength, vector::zero);
130 if (movingReferenceFrame.found("XF"))
132 XF = dimensionedVector
134 movingReferenceFrame.lookup("XF")
139 XF = dimensionedVector
146 movingReferenceFrame.add("XF", XF);
151 dimensionedVector UF ("UF", dimVelocity, vector::zero);
152 if (movingReferenceFrame.found("UF"))
154 UF = dimensionedVector
156 movingReferenceFrame.lookup("UF")
161 movingReferenceFrame.add("UF", UF);
165 // - Bubble acceleration
166 dimensionedVector aF ("aF", dimAcceleration, vector::zero);
167 if (movingReferenceFrame.found("aF"))
169 aF = dimensionedVector
171 movingReferenceFrame.lookup("aF")
176 movingReferenceFrame.add("aF", aF);
180 IOdictionary bubbleProperties
187 IOobject::READ_IF_PRESENT,
193 if (bubbleProperties.found("Vb"))
197 bubbleProperties.lookup("Vb")
202 Vb = gSum((1.0 - fluidIndicator.internalField())*mesh.V());
204 if (!interface.twoFluids())
206 scalar Va = gSum(mesh.V().field());
208 boundBox box(mesh.C().boundaryField()[spacePatchID]);
209 scalar r = (box.max().x() - box.min().x())/2;
211 scalar V = 4*M_PI*pow(r,3)/3;
215 if (mesh.nGeometricD() != 3)
217 FatalErrorIn(args.executable())
218 << "One-fluid bubble centroid calc "
219 << "is not implemented for 2d mesh"
220 << abort(FatalError);
224 bubbleProperties.add("Vb", Vb);
228 if (bubbleProperties.found("Vbf"))
232 bubbleProperties.lookup("Vbf")
238 bubbleProperties.add("Vbf", Vbf);