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,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;
|
||||
|
||||
Reference in New Issue
Block a user