From e592540951fa8257e7b96d73e31573dc790f022a Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 18 Dec 2018 16:10:09 +0000 Subject: [PATCH] setWaves: Prevent overwrite of wall fixed-value boundaries Resoves bug report https://bugs.openfoam.org/view.php?id=3135 --- .../preProcessing/setWaves/setWaves.C | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/applications/utilities/preProcessing/setWaves/setWaves.C b/applications/utilities/preProcessing/setWaves/setWaves.C index bc48d78bbf..c542f84fe3 100644 --- a/applications/utilities/preProcessing/setWaves/setWaves.C +++ b/applications/utilities/preProcessing/setWaves/setWaves.C @@ -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(alphap)) - { - alphap == refCast(alphap).alpha(); - } fvPatchVectorField& Up = U.boundaryFieldRef()[patchi]; - if (isA(Up)) + if + ( + !isA(patch) + || isA(alphap) + || isA(Up) + ) { - Up == refCast(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();