mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
fluxRequired: Added setFluxRequired function to fvSchemes class
Added calls to setFluxRequired for p in all incompressible solvers which avoids the need to add fluxRequired entries in fvSchemes dictionary. Will add calls to setFluxRequired to the rest of the solvers.
This commit is contained in:
@ -1,98 +1,99 @@
|
||||
Info<< "Reading velocity field U\n" << endl;
|
||||
volVectorField U
|
||||
Info<< "Reading velocity field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
U = dimensionedVector("0", U.dimensions(), vector::zero);
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvc::interpolate(U) & mesh.Sf()
|
||||
);
|
||||
|
||||
if (args.optionFound("initialiseUBCs"))
|
||||
{
|
||||
U.correctBoundaryConditions();
|
||||
phi = fvc::interpolate(U) & mesh.Sf();
|
||||
}
|
||||
|
||||
|
||||
// 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 BCs
|
||||
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
|
||||
),
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
dimensionedScalar(pName, sqr(dimVelocity), 0),
|
||||
pBCTypes
|
||||
);
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Constructing velocity potential field Phi\n" << endl;
|
||||
volScalarField Phi
|
||||
U = dimensionedVector("0", U.dimensions(), vector::zero);
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
"phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
|
||||
p.boundaryField().types()
|
||||
);
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
fvc::interpolate(U) & mesh.Sf()
|
||||
);
|
||||
|
||||
label PhiRefCell = 0;
|
||||
scalar PhiRefValue = 0;
|
||||
setRefCell
|
||||
if (args.optionFound("initialiseUBCs"))
|
||||
{
|
||||
U.correctBoundaryConditions();
|
||||
phi = fvc::interpolate(U) & mesh.Sf();
|
||||
}
|
||||
|
||||
|
||||
// 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 BCs
|
||||
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
|
||||
(
|
||||
Phi,
|
||||
potentialFlow.dict(),
|
||||
PhiRefCell,
|
||||
PhiRefValue
|
||||
);
|
||||
pName,
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(pName, sqr(dimVelocity), 0),
|
||||
pBCTypes
|
||||
);
|
||||
|
||||
Info<< "Constructing velocity potential field Phi\n" << endl;
|
||||
volScalarField Phi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Phi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
|
||||
p.boundaryField().types()
|
||||
);
|
||||
|
||||
label PhiRefCell = 0;
|
||||
scalar PhiRefValue = 0;
|
||||
setRefCell
|
||||
(
|
||||
Phi,
|
||||
potentialFlow.dict(),
|
||||
PhiRefCell,
|
||||
PhiRefValue
|
||||
);
|
||||
mesh.setFluxRequired(Phi.name());
|
||||
|
||||
Reference in New Issue
Block a user