fvMesh is no longer derived from fvSchemes and fvSolution, these are now
demand-driven and accessed by the member functions schemes() and solution()
respectively. This means that the system/fvSchemes and system/fvSolution files
are no longer required during fvMesh constructions simplifying the mesh
generation and manipulation phase; theses files are read on the first call of
their access functions.
The fvSchemes member function names have also been simplified taking advantage
of the context in which they are called, for example
mesh.ddtScheme(fieldName) -> mesh.schemes().ddt(fieldName)
117 lines
2.1 KiB
C++
117 lines
2.1 KiB
C++
Info<< "Reading velocity field U\n" << endl;
|
|
volVectorField U
|
|
(
|
|
IOobject
|
|
(
|
|
"U",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::MUST_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
mesh
|
|
);
|
|
|
|
U = Zero;
|
|
|
|
surfaceScalarField phi
|
|
(
|
|
IOobject
|
|
(
|
|
"phi",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::NO_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
fvc::flux(U)
|
|
);
|
|
|
|
if (args.optionFound("initialiseUBCs"))
|
|
{
|
|
U.correctBoundaryConditions();
|
|
phi = fvc::flux(U);
|
|
}
|
|
|
|
|
|
// Default name for the pressure field
|
|
word pName("p");
|
|
|
|
// Update name of the pressure field from the command-line option
|
|
args.optionReadIfPresent("pName", pName);
|
|
|
|
// Infer the pressure BCs from the velocity
|
|
wordList pBCTypes
|
|
(
|
|
U.boundaryField().size(),
|
|
fixedValueFvPatchScalarField::typeName
|
|
);
|
|
|
|
forAll(U.boundaryField(), patchi)
|
|
{
|
|
if (U.boundaryField()[patchi].fixesValue())
|
|
{
|
|
pBCTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
|
|
}
|
|
}
|
|
|
|
Info<< "Constructing pressure field " << pName << nl << endl;
|
|
volScalarField p
|
|
(
|
|
IOobject
|
|
(
|
|
pName,
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::READ_IF_PRESENT,
|
|
IOobject::NO_WRITE
|
|
),
|
|
mesh,
|
|
dimensionedScalar(pName, sqr(dimVelocity), 0),
|
|
pBCTypes
|
|
);
|
|
|
|
// Infer the velocity potential BCs from the pressure
|
|
wordList PhiBCTypes
|
|
(
|
|
p.boundaryField().size(),
|
|
zeroGradientFvPatchScalarField::typeName
|
|
);
|
|
|
|
forAll(p.boundaryField(), patchi)
|
|
{
|
|
if (p.boundaryField()[patchi].fixesValue())
|
|
{
|
|
PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName;
|
|
}
|
|
}
|
|
|
|
Info<< "Constructing velocity potential field Phi\n" << endl;
|
|
volScalarField Phi
|
|
(
|
|
IOobject
|
|
(
|
|
"Phi",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::READ_IF_PRESENT,
|
|
IOobject::NO_WRITE
|
|
),
|
|
mesh,
|
|
dimensionedScalar(dimLength*dimVelocity, 0),
|
|
PhiBCTypes
|
|
);
|
|
|
|
label PhiRefCell = 0;
|
|
scalar PhiRefValue = 0;
|
|
setRefCell
|
|
(
|
|
Phi,
|
|
potentialFlow.dict(),
|
|
PhiRefCell,
|
|
PhiRefValue
|
|
);
|
|
mesh.schemes().setFluxRequired(Phi.name());
|
|
|
|
#include "createMRF.H"
|