44 int main(
int argc,
char *argv[])
46 timeSelector::addOptions(
false,
false);
52 "name of the velocity field, default is \"U\"" 59 "name of the volume fraction field, default is \"alpha\"" 68 #include "readGravitationalAcceleration.H" 74 runTime.setTime(timeDirs[timeI], timeI);
76 Info<<
"Time = " << runTime.timeName() <<
nl <<
endl;
107 IOobject(
"height", runTime.timeName(),
mesh),
113 IOobject(
"heightp", runTime.timeName(),
mesh),
119 IOobject(
"uGas", runTime.timeName(),
mesh),
125 IOobject(
"uGasp", runTime.timeName(),
mesh),
131 IOobject(
"uLiquid", runTime.timeName(),
mesh),
137 IOobject(
"uLiquidp", runTime.timeName(),
mesh),
149 vector UMeanp = vector::zero;
157 const bool isWave = isA<waveAlphaFvPatchScalarField>(alphap);
159 if (isA<waveVelocityFvPatchVectorField>(Up) != isWave)
162 <<
"The alpha condition on patch " << Up.patch().name()
163 <<
" is " << alphap.type() <<
" and the velocity condition" 164 <<
" is " << Up.type() <<
". Wave boundary conditions must" 165 <<
" be set in pairs. If the alpha condition is " 166 << waveAlphaFvPatchScalarField::typeName
167 <<
" then the velocity condition must be " 168 << waveVelocityFvPatchVectorField::typeName
177 Info<<
"Adding waves from patch " << Up.patch().name() <<
endl;
179 const waveSuperposition& waves =
180 refCast<waveVelocityFvPatchVectorField>(Up).waves();
182 UMeanp = waves.UMean();
185 refCast<waveAlphaFvPatchScalarField>(alphap).liquid();
186 if (nWaves > 0 && liquidp != liquid)
189 <<
"All " << waveAlphaFvPatchScalarField::typeName
190 <<
"patch fields must be configured for the same phase," 191 <<
" i.e., the liquid switch must have the same value." 196 const scalar t = runTime.value();
201 height.primitiveFieldRef() += waves.height(t, ccs);
202 heightp.primitiveFieldRef() += waves.height(t, pts);
203 uGas.primitiveFieldRef() += waves.UGas(t, ccs) - UMeanp;
204 uGasp.primitiveFieldRef() += waves.UGas(t, pts) - UMeanp;
205 uLiquid.primitiveFieldRef() += waves.ULiquid(t, ccs) - UMeanp;
206 uLiquidp.primitiveFieldRef() += waves.ULiquid(t, pts) - UMeanp;
212 height.boundaryFieldRef()[patchj] += waves.height(t, fcs);
213 uGas.boundaryFieldRef()[patchj] += waves.UGas(t, fcs) - UMeanp;
214 uLiquid.boundaryFieldRef()[patchj] +=
215 waves.ULiquid(t, fcs) - UMeanp;
225 <<
"No " << waveAlphaFvPatchScalarField::typeName <<
" or " 226 << waveVelocityFvPatchVectorField::typeName <<
" patch fields " 227 <<
"were found. No waves have been set." <<
endl;
235 IOobject(
"UMean", runTime.timeName(),
mesh),
245 IOobject(
"weight", runTime.timeName(),
mesh),
251 IOobject(
"weightUMean", runTime.timeName(),
mesh),
262 const bool isWave = isA<waveAlphaFvPatchScalarField>(alphap);
269 const waveSuperposition& waves =
270 refCast<waveVelocityFvPatchVectorField>(Up).waves();
272 UMeanp = waves.UMean();
288 UMean = weightUMean/weight;
312 const bool isWave = isA<waveAlphaFvPatchScalarField>(alphap);
320 height.boundaryField()[
patchi],
321 heightp.boundaryField()[
patchi].patchInternalField(),
329 height.boundaryField()[
patchi],
330 heightp.boundaryField()[
patchi].patchInternalField()(),
331 uGas.boundaryField()[
patchi],
332 uGasp.boundaryField()[
patchi].patchInternalField()(),
333 uLiquid.boundaryField()[
patchi],
334 uLiquidp.boundaryField()[
patchi].patchInternalField()()
339 alphap == refCast<waveAlphaFvPatchScalarField>(alphap).
alpha();
340 Up == refCast<waveVelocityFvPatchVectorField>(Up).
U();
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< instant > instantList
List of instants.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
fvPatchField< vector > fvPatchVectorField
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
volVectorField UMean(UMeanHeader, mesh)
Vector< scalar > vector
A scalar version of the templated Vector.
GeometricField< vector, fvPatchField, volMesh > volVectorField
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
tmp< DimensionedField< Type, volMesh > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const DimensionedField< Type, volMesh > &positiveC, const DimensionedField< Type, pointMesh > &positiveP, const DimensionedField< Type, volMesh > &negativeC, const DimensionedField< Type, pointMesh > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
vectorField pointField
pointField is a vectorField.
fvPatchField< scalar > fvPatchScalarField
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
List< label > labelList
A List of labels.
tmp< DimensionedField< scalar, volMesh > > levelSetFraction(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const bool above)
Calculate the volume-fraction that a level set occupies. This gives the the.
const word & name() const
Return const reference to name.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Foam::argList args(argc, argv)
const dimensionSet dimVelocity