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:
mattijs
2016-06-20 20:57:47 +01:00
parent 5583b78d9d
commit 3fc2ec183d

View File

@ -93,20 +93,47 @@ if (args.optionFound("writep"))
Info<< "Constructing velocity potential field Phi\n" << endl;
volScalarField Phi
autoPtr<volScalarField> PhiPtr;
IOobject io
(
IOobject
(
"Phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::MUST_READ,
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,
dimensionedScalar("Phi", dimLength*dimVelocity, 0),
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;
scalar PhiRefValue = 0;