diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files
index f313468299..3999c34c43 100644
--- a/src/finiteVolume/Make/files
+++ b/src/finiteVolume/Make/files
@@ -46,6 +46,7 @@ $(wallDist)/patchDistMethods/patchDistMethod/patchDistMethod.C
$(wallDist)/patchDistMethods/meshWave/meshWavePatchDistMethod.C
$(wallDist)/patchDistMethods/Poisson/PoissonPatchDistMethod.C
$(wallDist)/patchDistMethods/advectionDiffusion/advectionDiffusionPatchDistMethod.C
+$(wallDist)/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C
fvMeshMapper = fvMesh/fvMeshMapper
diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C
new file mode 100644
index 0000000000..864437b985
--- /dev/null
+++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.C
@@ -0,0 +1,160 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "patchDataWave.H"
+#include "directionalMeshWavePatchDistMethod.H"
+#include "fvMesh.H"
+#include "volFields.H"
+#include "directionalWallPointData.H"
+#include "emptyFvPatchFields.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace patchDistMethods
+{
+ defineTypeNameAndDebug(directionalMeshWave, 0);
+ addToRunTimeSelectionTable
+ (
+ patchDistMethod,
+ directionalMeshWave,
+ dictionary
+ );
+}
+}
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::patchDistMethods::directionalMeshWave::directionalMeshWave
+(
+ const dictionary& dict,
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs
+)
+:
+ Foam::patchDistMethods::meshWave(dict, mesh, patchIDs),
+ n_(dict.get("n"))
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::patchDistMethods::directionalMeshWave::correct(volScalarField& y)
+{
+ y = dimensionedScalar(dimLength, GREAT);
+
+ volVectorField n
+ (
+ IOobject
+ (
+ "nWall",
+ y.time().timeName(),
+ mesh_,
+ IOobject::NO_READ,
+ IOobject::NO_WRITE,
+ false
+ ),
+ mesh_,
+ dimensionedVector(dimless, Zero),
+ patchDistMethod::patchTypes(mesh_, patchIDs_)
+ );
+
+ const fvPatchList& patches = mesh_.boundary();
+
+ volVectorField::Boundary& nbf = n.boundaryFieldRef();
+
+ for (const label patchi : patchIDs_)
+ {
+ nbf[patchi] == patches[patchi].nf();
+ }
+
+ return correct(y, n);
+}
+
+
+bool Foam::patchDistMethods::directionalMeshWave::correct
+(
+ volScalarField& y,
+ volVectorField& n
+)
+{
+ y = dimensionedScalar(dimLength, GREAT);
+
+ // Collect pointers to data on patches
+ UPtrList patchData(mesh_.boundaryMesh().size());
+
+ volVectorField::Boundary& nbf = n.boundaryFieldRef();
+
+ forAll(nbf, patchi)
+ {
+ patchData.set(patchi, &nbf[patchi]);
+ }
+
+ // Do mesh wave
+ vector testDirection(n_);
+
+ patchDataWave, vector> wave
+ (
+ mesh_,
+ patchIDs_,
+ patchData,
+ correctWalls_,
+ testDirection
+ );
+
+ // Transfer cell values from wave into y and n
+ y.transfer(wave.distance());
+
+ n.transfer(wave.cellData());
+
+ // Transfer values on patches into boundaryField of y and n
+ volScalarField::Boundary& ybf = y.boundaryFieldRef();
+
+ forAll(ybf, patchi)
+ {
+ scalarField& waveFld = wave.patchDistance()[patchi];
+
+ if (!isA(ybf[patchi]))
+ {
+ ybf[patchi].transfer(waveFld);
+
+ vectorField& wavePatchData = wave.patchData()[patchi];
+
+ nbf[patchi].transfer(wavePatchData);
+ }
+ }
+
+ // Transfer number of unset values
+ this->nUnset_ = wave.nUnset();
+
+ return this->nUnset_ > 0;
+}
+
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.H b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.H
new file mode 100644
index 0000000000..929be6d22f
--- /dev/null
+++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/directionalMeshWave/directionalMeshWavePatchDistMethod.H
@@ -0,0 +1,139 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::patchDistMethods::directionalMeshWave
+
+Description
+ Variant of \c meshWave distance-to-patch method.
+
+ Ignores the component in the specified direction. Can be used e.g. to
+ calculate the distance in the z-direction only.
+
+Usage
+ Example of specification in \c fvSchemes.wallDist:
+ \verbatim
+ wallDist
+ {
+ // Mandatory entries (unmodifiable)
+ method directionalMeshWave;
+ n (0 0 1);
+
+ // Optional (inherited) entries (unmodifiable)
+ ...
+ }
+ \endverbatim
+
+ where the entries mean:
+ \table
+ Property | Description | Type | Req'd | Dflt
+ method | Method name: directionalMeshWave | word | yes | -
+ n | The direction component to ignore | vector | yes | -
+ \endtable
+
+ The inherited entries are elaborated in:
+ - \link meshWavePatchDistMethod.H \endlink
+
+See also
+ Foam::wallDist
+ Foam::patchDistMethod::meshWave
+ Foam::patchDistMethod::Poisson
+ Foam::directionalWallPoint
+
+SourceFiles
+ directionalMeshWavePatchDistMethod.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef directionalMeshWavePatchDistMethod_H
+#define directionalMeshWavePatchDistMethod_H
+
+#include "meshWavePatchDistMethod.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace patchDistMethods
+{
+
+/*---------------------------------------------------------------------------*\
+ Class directionalMeshWave Declaration
+\*---------------------------------------------------------------------------*/
+
+class directionalMeshWave
+:
+ public meshWave
+{
+ // Private Member Data
+
+ //- The direction component to ignore
+ const vector n_;
+
+ //- No copy construct
+ directionalMeshWave(const directionalMeshWave&) = delete;
+
+ //- No copy assignment
+ void operator=(const directionalMeshWave&) = delete;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("directionalMeshWave");
+
+
+ // Constructors
+
+ //- Construct from coefficients dictionary, mesh
+ //- and fixed-value patch set
+ directionalMeshWave
+ (
+ const dictionary& dict,
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs
+ );
+
+
+ // Member Functions
+
+ //- Correct the given distance-to-patch field
+ virtual bool correct(volScalarField& y);
+
+ //- Correct the given distance-to-patch and normal-to-patch fields
+ virtual bool correct(volScalarField& y, volVectorField& n);
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace patchDistMethods
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.H b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.H
index cdbfb0492d..2b5979fe34 100644
--- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.H
+++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.H
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
+ Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -77,7 +78,9 @@ class meshWave
:
public patchDistMethod
{
- // Private Member Data
+protected:
+
+ // Protected Member Data
//- Do accurate distance calculation for near-wall cells.
const bool correctWalls_;
@@ -86,6 +89,8 @@ class meshWave
mutable label nUnset_;
+private:
+
// Private Member Functions
//- No copy construct
@@ -126,11 +131,6 @@ public:
// Member Functions
- label nUnset() const
- {
- return nUnset_;
- }
-
//- Correct the given distance-to-patch field
virtual bool correct(volScalarField& y);
diff --git a/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.C b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.C
new file mode 100644
index 0000000000..3cfd8fa383
--- /dev/null
+++ b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.C
@@ -0,0 +1,64 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "Ostream.H"
+#include "Istream.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
+
+template
+Ostream& operator<<
+(
+ Ostream& os,
+ const directionalWallPointData& wDist
+)
+{
+ return os<< static_cast&>(wDist);
+}
+
+
+template
+Istream& operator>>
+(
+ Istream& is,
+ directionalWallPointData& wDist
+)
+{
+ return is>> static_cast&>(wDist);
+}
+
+
+// ************************************************************************* //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.H b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.H
new file mode 100644
index 0000000000..23b37f1ab7
--- /dev/null
+++ b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointData.H
@@ -0,0 +1,197 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::directionalWallPointData
+
+Description
+ Holds information (coordinate and normal) regarding the nearest wall point.
+
+ Variant of \c wallPointData that ignores the specified normal component
+ before comparing. This is used e.g. to find the distance to the wall
+ in the z-direction only.
+
+SourceFiles
+ directionalWallPointDataI.H
+ directionalWallPointData.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef directionalWallPointData_H
+#define directionalWallPointData_H
+
+#include "wallPointData.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+template class directionalWallPointData;
+
+// Forward declaration of friend functions and operators
+
+template Istream&
+operator>>(Istream&, directionalWallPointData&);
+template Ostream&
+operator<<(Ostream&, const directionalWallPointData&);
+
+
+/*---------------------------------------------------------------------------*\
+ Class directionalWallPointData Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class directionalWallPointData
+:
+ public wallPointData
+{
+ // Private Member Functions
+
+ //- Evaluate distance to point. Update distSqr, origin from whomever
+ // is nearer pt. Return true if w2 is closer to point,
+ // false otherwise.
+ template
+ inline bool update
+ (
+ const point&,
+ const directionalWallPointData& w2,
+ const scalar tol,
+ TrackingData& td
+ );
+
+
+public:
+
+ typedef Type dataType;
+
+
+ // Constructors
+
+ //- Construct null
+ inline directionalWallPointData();
+
+ //- Construct from origin, normal, distance
+ inline directionalWallPointData
+ (
+ const point& origin,
+ const Type& data,
+ const scalar distSqr
+ );
+
+
+ // Member Functions
+
+ // Needed by meshWave
+
+ //- Influence of neighbouring face.
+ // Calls update(...) with cellCentre of celli
+ template
+ inline bool updateCell
+ (
+ const polyMesh& mesh,
+ const label thisCelli,
+ const label neighbourFacei,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of neighbouring cell.
+ // Calls update(...) with faceCentre of facei
+ template
+ inline bool updateFace
+ (
+ const polyMesh& mesh,
+ const label thisFacei,
+ const label neighbourCelli,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of different value on same face.
+ // Merge new and old info.
+ // Calls update(...) with faceCentre of facei
+ template
+ inline bool updateFace
+ (
+ const polyMesh& mesh,
+ const label thisFacei,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ // Member Operators
+
+ // IOstream Operators
+
+ friend Ostream& operator<<
+ (
+ Ostream&,
+ const directionalWallPointData&
+ );
+ friend Istream& operator>>
+ (
+ Istream&,
+ directionalWallPointData&
+ );
+};
+
+
+// Data associated with directionalWallPointData type are contiguous. List the
+// usual ones.
+
+template<> struct is_contiguous> :
+is_contiguous {};
+
+template<> struct is_contiguous> :
+is_contiguous_label {};
+
+template<> struct is_contiguous> :
+is_contiguous_scalar {};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#ifdef NoRepository
+ #include "directionalWallPointData.C"
+#endif
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "directionalWallPointDataI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/meshTools/cellDist/directionalWallPoint/directionalWallPointDataI.H b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointDataI.H
new file mode 100644
index 0000000000..8b98db3140
--- /dev/null
+++ b/src/meshTools/cellDist/directionalWallPoint/directionalWallPointDataI.H
@@ -0,0 +1,192 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | www.openfoam.com
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+ Copyright (C) 2020 OpenCFD Ltd.
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+// Update this with w2 if w2 nearer to pt.
+template
+template
+inline bool directionalWallPointData::update
+(
+ const point& pt,
+ const directionalWallPointData& w2,
+ const scalar tol,
+ TrackingData& n
+)
+{
+ vector d(pt - w2.origin());
+ // Knock out component in direction of n
+ d -= n*(d&n);
+ scalar dist2 = magSqr(d);
+
+ if (this->valid(n))
+ {
+ vector d(pt - this->origin());
+ // Knock out component in direction of n
+ d -= n*(d&n);
+ scalar currentDistSqr(magSqr(d));
+
+ scalar diff = currentDistSqr - dist2;
+
+ if (diff < 0)
+ {
+ // already nearer to pt
+ return false;
+ }
+
+ if
+ (
+ (diff < SMALL)
+ || ((currentDistSqr > SMALL) && (diff/currentDistSqr < tol))
+ )
+ {
+ // don't propagate small changes
+ return false;
+ }
+ }
+
+ // Either *this is not yet valid or w2 is closer
+ {
+ // current not yet set so use any value
+ this->distSqr() = magSqr(pt - w2.origin());
+ this->origin() = w2.origin();
+ this->data() = w2.data();
+
+ return true;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+// Null constructor
+template
+inline directionalWallPointData::directionalWallPointData()
+:
+ wallPointData()
+{}
+
+
+// Construct from components
+template
+inline directionalWallPointData::directionalWallPointData
+(
+ const point& origin,
+ const Type& data,
+ const scalar distSqr
+)
+:
+ wallPointData(origin, data, distSqr)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+// Update this with w2 if w2 nearer to pt.
+template
+template
+inline bool directionalWallPointData::updateCell
+(
+ const polyMesh& mesh,
+ const label thisCelli,
+ const label,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ const vectorField& cellCentres = mesh.primitiveMesh::cellCentres();
+
+ return update
+ (
+ cellCentres[thisCelli],
+ neighbourWallInfo,
+ tol,
+ td
+ );
+}
+
+
+// Update this with w2 if w2 nearer to pt.
+template
+template
+inline bool directionalWallPointData::updateFace
+(
+ const polyMesh& mesh,
+ const label thisFacei,
+ const label,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ const vectorField& faceCentres = mesh.faceCentres();
+
+ return update
+ (
+ faceCentres[thisFacei],
+ neighbourWallInfo,
+ tol,
+ td
+ );
+}
+
+
+// Update this with w2 if w2 nearer to pt.
+template
+template
+inline bool directionalWallPointData::updateFace
+(
+ const polyMesh& mesh,
+ const label thisFacei,
+ const directionalWallPointData& neighbourWallInfo,
+ const scalar tol,
+ TrackingData& td
+)
+{
+ const vectorField& faceCentres = mesh.faceCentres();
+
+ return update
+ (
+ faceCentres[thisFacei],
+ neighbourWallInfo,
+ tol,
+ td
+ );
+}
+
+
+// ************************************************************************* //
+
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/meshTools/cellDist/patchWave/patchDataWave.C b/src/meshTools/cellDist/patchWave/patchDataWave.C
index 0ad83776ae..dfa48df725 100644
--- a/src/meshTools/cellDist/patchWave/patchDataWave.C
+++ b/src/meshTools/cellDist/patchWave/patchDataWave.C
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
+ Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -27,11 +28,17 @@ License
#include "patchDataWave.H"
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+template
+int Foam::patchDataWave::dummyTrackData_ = 12345;
+
+
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Set initial set of changed faces (= all wall faces)
-template
-void Foam::patchDataWave::setChangedFaces
+template
+void Foam::patchDataWave::setChangedFaces
(
const labelHashSet& patchIDs,
labelList& changedFaces,
@@ -72,10 +79,10 @@ void Foam::patchDataWave::setChangedFaces
// Copy from MeshWave data into *this (distance) and field_ (transported data)
-template
-Foam::label Foam::patchDataWave::getValues
+template
+Foam::label Foam::patchDataWave::getValues
(
- const MeshWave& waveInfo
+ const MeshWave& waveInfo
)
{
const polyMesh& mesh = cellDistFuncs::mesh();
@@ -169,41 +176,43 @@ Foam::label Foam::patchDataWave::getValues
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
-template
-Foam::patchDataWave::patchDataWave
+template
+Foam::patchDataWave::patchDataWave
(
const polyMesh& mesh,
const labelHashSet& patchIDs,
const UPtrList>& initialPatchValuePtrs,
- const bool correctWalls
+ const bool correctWalls,
+ TrackingData& td
)
:
cellDistFuncs(mesh),
patchIDs_(patchIDs),
initialPatchValuePtrs_(initialPatchValuePtrs),
correctWalls_(correctWalls),
+ td_(td),
nUnset_(0),
distance_(mesh.nCells()),
patchDistance_(mesh.boundaryMesh().size()),
cellData_(mesh.nCells()),
patchData_(mesh.boundaryMesh().size())
{
- patchDataWave::correct();
+ patchDataWave::correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-template
-Foam::patchDataWave::~patchDataWave()
+template
+Foam::patchDataWave::~patchDataWave()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Correct for mesh geom/topo changes
-template
-void Foam::patchDataWave::correct()
+template
+void Foam::patchDataWave::correct()
{
//
// Set initial changed faces: set TransferType for wall faces
@@ -222,12 +231,13 @@ void Foam::patchDataWave::correct()
// Do calculate wall distance by 'growing' from faces.
//
- MeshWave waveInfo
+ MeshWave waveInfo
(
mesh(),
changedFaces,
faceDist,
- mesh().globalData().nTotalCells()+1 // max iterations
+ mesh().globalData().nTotalCells()+1, // max iterations
+ td_
);
diff --git a/src/meshTools/cellDist/patchWave/patchDataWave.H b/src/meshTools/cellDist/patchWave/patchDataWave.H
index 87a650cd2f..f7f79707e5 100644
--- a/src/meshTools/cellDist/patchWave/patchDataWave.H
+++ b/src/meshTools/cellDist/patchWave/patchDataWave.H
@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
+ Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -62,7 +63,7 @@ class wallPoint;
Class patchDataWave Declaration
\*---------------------------------------------------------------------------*/
-template
+template
class patchDataWave
:
public cellDistFuncs
@@ -84,6 +85,10 @@ private:
//- Do accurate distance calculation for near-wall cells.
bool correctWalls_;
+ //- Additional data to be passed into underlying containers
+ TrackingData& td_;
+
+
//
// After construction:
//
@@ -115,7 +120,14 @@ private:
) const;
//- Copy MeshWave values into *this
- label getValues(const MeshWave&);
+ label getValues(const MeshWave&);
+
+
+ // Private static data
+
+ //- Used as default trackdata value to satisfy default template
+ // argument.
+ static int dummyTrackData_;
public:
@@ -131,7 +143,8 @@ public:
const polyMesh& mesh,
const labelHashSet& patchIDs,
const UPtrList>& initialPatchValuePtrs,
- bool correctWalls = true
+ const bool correctWalls = true,
+ TrackingData& td = dummyTrackData_
);
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0/pointDisplacement b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0.orig/pointDisplacement
similarity index 99%
rename from tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0/pointDisplacement
rename to tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0.orig/pointDisplacement
index 35ad78b936..c705fa1952 100644
--- a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0/pointDisplacement
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/0.orig/pointDisplacement
@@ -10,7 +10,6 @@ FoamFile
version 2.0;
format ascii;
class pointVectorField;
- location "0";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allclean b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allclean
new file mode 100755
index 0000000000..fb1f384730
--- /dev/null
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allclean
@@ -0,0 +1,8 @@
+#!/bin/sh
+cd "${0%/*}" || exit # Run from this directory
+. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
+#------------------------------------------------------------------------------
+
+cleanCase0
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allrun b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allrun
new file mode 100755
index 0000000000..dd255004c8
--- /dev/null
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/Allrun
@@ -0,0 +1,19 @@
+#!/bin/sh
+cd "${0%/*}" || exit # Run from this directory
+. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
+#------------------------------------------------------------------------------
+
+restore0Dir
+
+runApplication blockMesh
+
+runApplication decomposePar
+
+runParallel $(getApplication)
+
+runParallel redistributePar -reconstruct
+
+# test `directionalMeshWave`
+runApplication checkMesh -writeAllFields -latestTime
+
+#------------------------------------------------------------------------------
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/constant/dynamicMeshDict b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/constant/dynamicMeshDict
index c1baf29d2c..0469f7b617 100644
--- a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/constant/dynamicMeshDict
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/constant/dynamicMeshDict
@@ -13,7 +13,6 @@ FoamFile
location "system";
object dynamicMeshDict;
}
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/blockMeshDict b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/blockMeshDict
index 782dd9404e..ce6efede72 100644
--- a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/blockMeshDict
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/blockMeshDict
@@ -12,7 +12,6 @@ FoamFile
class dictionary;
object blockMeshDict;
}
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/fvSchemes b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/fvSchemes
index 8682501862..c9e7a6d083 100644
--- a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/fvSchemes
+++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/fvSchemes
@@ -46,5 +46,11 @@ snGradSchemes
default corrected;
}
+wallDist
+{
+ method directionalMeshWave;
+ n (0 0 1);
+}
+
// ************************************************************************* //