setWaves: Prevent overwrite of wall fixed-value boundaries

Resoves bug report https://bugs.openfoam.org/view.php?id=3135
This commit is contained in:
Will Bainbridge
2018-12-18 16:10:09 +00:00
parent 3db8158b7b
commit e592540951

View File

@ -36,7 +36,7 @@ Description
#include "timeSelector.H"
#include "uniformDimensionedFields.H"
#include "volFields.H"
#include "wallDist.H"
#include "wallPolyPatch.H"
#include "waveAlphaFvPatchScalarField.H"
#include "waveVelocityFvPatchVectorField.H"
@ -187,25 +187,33 @@ int main(int argc, char *argv[])
uLiq.boundaryFieldRef()[patchj] = waves.ULiquid(t, fcs);
}
// Set the fields
alpha == levelSetFraction(h, hp, !liquid);
U == levelSetAverage(h, hp, uGas, uGasp, uLiq, uLiqp);
// Calculate the fields
volScalarField alphaNoBCs(levelSetFraction(h, hp, !liquid));
volVectorField UNoBCs(levelSetAverage(h, hp, uGas, uGasp, uLiq, uLiqp));
// Set the boundary fields
// Set the wave and non-wall fixed-value patch fields
forAll(mesh.boundary(), patchi)
{
const polyPatch& patch = mesh.boundaryMesh()[patchi];
fvPatchScalarField& alphap = alpha.boundaryFieldRef()[patchi];
if (isA<waveAlphaFvPatchScalarField>(alphap))
{
alphap == refCast<waveAlphaFvPatchScalarField>(alphap).alpha();
}
fvPatchVectorField& Up = U.boundaryFieldRef()[patchi];
if (isA<waveVelocityFvPatchVectorField>(Up))
if
(
!isA<wallPolyPatch>(patch)
|| isA<waveAlphaFvPatchScalarField>(alphap)
|| isA<waveVelocityFvPatchVectorField>(Up)
)
{
Up == refCast<waveVelocityFvPatchVectorField>(Up).U();
alphap == alphaNoBCs.boundaryField()[patchi];
Up == UNoBCs.boundaryField()[patchi];
}
}
// Set the internal fields and all non-fixed value patch fields
alpha = alphaNoBCs;
U = UNoBCs;
// Output
Info<< "Writing " << alpha.name() << nl;
alpha.write();