From d5820be68b1874f4ea77631875bf2bb828068efa Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 21 Apr 2022 12:25:25 +0100 Subject: [PATCH] layerAverage: Re-write layer generation using mesh wave This change means this function is determining the sequence in which points are plotted topologically. This makes it possible to plot a layer average along a pipe that goes through many changes of direction. Previously, the function determined the order by means of a geometric sort in the plot direction. This only worked when the layers were perpendicular to one of the coordinate axes. --- .../postProcessing/graphs/graphLayerAverage | 6 +- .../meshes/meshShapes/cell/oppositeCellFace.C | 21 +- .../field/layerAverage/layerAverage.C | 281 ++++++------------ .../field/layerAverage/layerAverage.H | 25 +- .../layerAverage/layerAverageTemplates.C | 6 +- .../field/layerAverage/layerInfo.H | 200 +++++++++++++ .../field/layerAverage/layerInfoI.H | 244 +++++++++++++++ 7 files changed, 559 insertions(+), 224 deletions(-) create mode 100644 src/functionObjects/field/layerAverage/layerInfo.H create mode 100644 src/functionObjects/field/layerAverage/layerInfoI.H diff --git a/etc/caseDicts/postProcessing/graphs/graphLayerAverage b/etc/caseDicts/postProcessing/graphs/graphLayerAverage index c114db9a79..23223ac58a 100644 --- a/etc/caseDicts/postProcessing/graphs/graphLayerAverage +++ b/etc/caseDicts/postProcessing/graphs/graphLayerAverage @@ -14,8 +14,10 @@ patches (); // Patches from which layers extrude zones (); // Zones from which layers extrude -axis ; // The independent variable of the graph. Can - // be "x", "y" or "z". +axis distance; // The independent variable of the graph. Can + // be "x", "y", "z", "xyz" (all coordinates + // written out), or "distance" (from the start + // point). symmetric false; // Are the layers symmetric about the centre? diff --git a/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C b/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C index 24f6a6a63b..72b42de90f 100644 --- a/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C +++ b/src/OpenFOAM/meshes/meshShapes/cell/oppositeCellFace.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,11 +42,13 @@ Foam::label Foam::cell::opposingFaceLabel const faceUList& meshFaces ) const { - // Algorithm: // Go through all the faces of the cell and find the one which - // does not share a single vertex with the master face. If there - // are two or more such faces, return the first one and issue a - // warning; if there is no opposite face, return -1; + // does not share a single vertex with the master face + // + // If there are no such faces (e.g., a tetrahedron), return -1 + // + // If there are more than one such faces (e.g., a hex with split faces), + // return -2 const face& masterFace = meshFaces[masterFaceLabel]; @@ -96,12 +98,9 @@ Foam::label Foam::cell::opposingFaceLabel } else { - // There has already been an opposite face. - // Non-prismatic cell - Info<< "Multiple faces not sharing vertex: " - << oppositeFaceLabel << " and " - << curFaceLabels[facei] << endl; - return -1; + // There has already been a face with no shared points. + // This cell is not prismatic. + return -2; } } } diff --git a/src/functionObjects/field/layerAverage/layerAverage.C b/src/functionObjects/field/layerAverage/layerAverage.C index 51a98df1d9..e322ef4d87 100644 --- a/src/functionObjects/field/layerAverage/layerAverage.C +++ b/src/functionObjects/field/layerAverage/layerAverage.C @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ #include "layerAverage.H" +#include "FaceCellWave.H" +#include "layerInfo.H" #include "regionSplit.H" #include "syncTools.H" #include "volFields.H" @@ -39,204 +41,61 @@ namespace Foam defineTypeNameAndDebug(layerAverage, 0); addToRunTimeSelectionTable(functionObject, layerAverage, dictionary); } - - template<> - const char* - Foam::NamedEnum::names[] = - {"x", "y", "z"}; } -const Foam::NamedEnum - Foam::functionObjects::layerAverage::axisNames_; - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::functionObjects::layerAverage::walkOppositeFaces -( - const labelList& startFaces, - const boolList& startFaceIntoOwners, - boolList& blockedFace, - boolList& cellIsLayer -) -{ - // Initialise the front - DynamicList