mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: potentialFoam: construct Phi with only types() so does not work
for initialising 'complex' bcs. Instead now 'clone' from p. Fixes #153.
This commit is contained in:
@ -93,21 +93,48 @@ if (args.optionFound("writep"))
|
|||||||
|
|
||||||
|
|
||||||
Info<< "Constructing velocity potential field Phi\n" << endl;
|
Info<< "Constructing velocity potential field Phi\n" << endl;
|
||||||
volScalarField Phi
|
autoPtr<volScalarField> PhiPtr;
|
||||||
(
|
|
||||||
IOobject
|
IOobject io
|
||||||
(
|
(
|
||||||
"Phi",
|
"Phi",
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::READ_IF_PRESENT,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
);
|
||||||
|
|
||||||
|
if (io.typeHeaderOk<volScalarField>())
|
||||||
|
{
|
||||||
|
PhiPtr.reset(new volScalarField(io, mesh));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Cannot just use p.boundaryField().types() since does not initialise
|
||||||
|
// complex boundary types. Instead re-clone them from p.
|
||||||
|
|
||||||
|
io.readOpt() = IOobject::NO_READ;
|
||||||
|
PhiPtr.reset
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
io,
|
||||||
mesh,
|
mesh,
|
||||||
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
|
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
|
||||||
p.boundaryField().types()
|
p.boundaryField().types()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const volScalarField::GeometricBoundaryField& bp = p.boundaryField();
|
||||||
|
volScalarField::GeometricBoundaryField& bPhi = PhiPtr().boundaryField();
|
||||||
|
|
||||||
|
forAll(bp, patchI)
|
||||||
|
{
|
||||||
|
bPhi.set(patchI, bp[patchI].clone(PhiPtr().dimensionedInternalField()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
volScalarField& Phi = PhiPtr();
|
||||||
|
|
||||||
label PhiRefCell = 0;
|
label PhiRefCell = 0;
|
||||||
scalar PhiRefValue = 0;
|
scalar PhiRefValue = 0;
|
||||||
setRefCell
|
setRefCell
|
||||||
|
|||||||
Reference in New Issue
Block a user