diff --git a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlus.H b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlus.H
similarity index 62%
rename from src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlus.H
rename to src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlus.H
index 6dbd55d1ec..78b4e2e815 100644
--- a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlus.H
+++ b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlus.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see .
Class
- Foam::FvWallInfoYPlus
+ Foam::WallLocationYPlus
Description
Holds information (coordinate and yStar) regarding nearest wall point.
@@ -33,58 +33,60 @@ Description
yStar to 1.
SourceFiles
- FvWallInfoYPlusI.H
+ WallLocationYPlusI.H
\*---------------------------------------------------------------------------*/
-#ifndef FvWallInfoYPlus_H
-#define FvWallInfoYPlus_H
+#ifndef WallLocationYPlus_H
+#define WallLocationYPlus_H
-#include "FvWallInfoData.H"
+#include "WallLocationData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
+// Forward declaration of classes
+class transformer;
+
/*---------------------------------------------------------------------------*\
- Class FvWallInfoYPlusBase Declaration
+ Class WallLocationYPlus Declaration
\*---------------------------------------------------------------------------*/
-template
-class FvWallInfoYPlusBase
+template
+class WallLocationYPlus
:
- public FvWallInfoDataBase
+ public WallLocationData
{
public:
- //- Class used to pass additional data in
- class trackData
- {
- public:
+ // Public Classes
- //- Cut off distance
- scalar yPlusCutOff;
- };
+ //- Class used to pass additional data in
+ class trackData
+ {
+ public:
+
+ //- Cut off distance
+ scalar yPlusCutOff;
+ };
protected:
- friend class FvWallInfoBase;
-
-
// Protected 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
+ // is nearer pt. Return true if w2 is closer to point, false
+ // otherwise.
+ template
inline bool update
(
- const point& pt,
- const FvWallInfoYPlusBase& w2,
+ const point&,
+ const WallLocationYPlus& w2,
const scalar tol,
- TrackingData& td
+ TrackingYPlus& td
);
@@ -93,28 +95,25 @@ public:
// Constructors
//- Construct null
- inline FvWallInfoYPlusBase();
+ inline WallLocationYPlus();
//- Inherit constructors
- using FvWallInfoDataBase::FvWallInfoDataBase;
+ using WallLocationData::WallLocationData;
};
-/*---------------------------------------------------------------------------*\
- Class FvWallInfoYPlus Declaration
-\*---------------------------------------------------------------------------*/
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-template
-class FvWallInfoYPlus
-:
- public FvWallInfoYPlusBase>
+class wallPoint;
+
+template
+class FvWallInfo;
+
+template<>
+inline bool contiguous>>()
{
- public:
-
- using
- FvWallInfoYPlusBase>::
- FvWallInfoYPlusBase;
-};
+ return true;
+}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -123,7 +122,7 @@ class FvWallInfoYPlus
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-#include "FvWallInfoYPlusI.H"
+#include "WallLocationYPlusI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlusI.H b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlusI.H
similarity index 63%
rename from src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlusI.H
rename to src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlusI.H
index d6a70da52e..b76214152a 100644
--- a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoYPlusI.H
+++ b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/WallLocationYPlusI.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -23,34 +23,29 @@ License
\*---------------------------------------------------------------------------*/
-#include "FvWallInfoYPlus.H"
+#include "WallLocationYPlus.H"
-// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
-template
-template
-inline bool Foam::FvWallInfoYPlusBase::update
+template
+template
+inline bool Foam::WallLocationYPlus::update
(
const point& pt,
- const FvWallInfoYPlusBase& w2,
+ const WallLocationYPlus& w2,
const scalar tol,
- TrackingData& td
+ TrackingYPlus& td
)
{
- FvWallInfoYPlusBase copy(*this);
+ WallLocationYPlus copy(*this);
bool result =
- FvWallInfoDataBase::update(pt, w2, tol, td);
+ WallLocationData::update(pt, w2, tol, td);
- if (result)
+ if (result && sqrt(this->distSqr())/w2.data() >= td.yPlusCutOff)
{
- const scalar yPlus = sqrt(this->distSqr())/w2.data();
-
- if (yPlus >= td.yPlusCutOff)
- {
- *this = copy;
- result = false;
- }
+ *this = copy;
+ result = false;
}
return result;
@@ -59,10 +54,10 @@ inline bool Foam::FvWallInfoYPlusBase::update
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-template
-inline Foam::FvWallInfoYPlusBase::FvWallInfoYPlusBase()
+template
+inline Foam::WallLocationYPlus::WallLocationYPlus()
:
- FvWallInfoDataBase()
+ WallLocationData()
{
// Important: The value of yStar where the meshWave does not come.
this->data() = 1.0;
diff --git a/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C
index 32db9f17d1..8043d40190 100644
--- a/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C
+++ b/src/MomentumTransportModels/momentumTransportModels/LES/LESdeltas/vanDriestDelta/vanDriestDelta.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -26,7 +26,7 @@ License
#include "vanDriestDelta.H"
#include "wallFvPatch.H"
#include "fvPatchDistWave.H"
-#include "FvWallInfoYPlus.H"
+#include "WallLocationYPlus.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@@ -84,10 +84,10 @@ void Foam::LESModels::vanDriestDelta::calcDelta()
volScalarField::New("y", mesh, dimensionedScalar(dimLength, great))
);
- FvWallInfoYPlus::trackData td;
+ WallLocationYPlus::trackData td;
td.yPlusCutOff = yPlusCutOff_;
- fvPatchDistWave::calculateAndCorrect
+ fvPatchDistWave::calculateAndCorrect
(
mesh,
mesh.boundaryMesh().findPatchIDs(),
diff --git a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfo.H b/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfo.H
index dc3abc3ebf..e2ec322a4c 100644
--- a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfo.H
+++ b/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfo.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -36,8 +36,8 @@ SourceFiles
#ifndef FvWallInfo_H
#define FvWallInfo_H
-#include "wallPoint.H"
-#include "wallFace.H"
+#include "fieldTypes.H"
+#include "labelPair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -50,26 +50,36 @@ class fvMesh;
class transformer;
/*---------------------------------------------------------------------------*\
- Class FvWallInfoBase Declaration
+ Class FvWallInfo Declaration
\*---------------------------------------------------------------------------*/
-template
-class FvWallInfoBase
+template
+class FvWallInfo
:
- public WallInfo::template type
+ public WallLocation
{
public:
// Constructors
//- Inherit constructors
- using WallInfo::template type::type;
+ using WallLocation::WallLocation;
// Member Functions
// Needed by FvFaceCellWave
+ //- Check for identical geometrical data. Used for cyclics checking.
+ template
+ inline bool sameGeometry
+ (
+ const fvMesh& mesh,
+ const FvWallInfo& w2,
+ const scalar tol,
+ TrackingData& td
+ ) const;
+
//- Transform across an interface
template
inline void transform
@@ -87,7 +97,7 @@ public:
const fvMesh&,
const label thisCelli,
const labelPair& neighbourPatchAndFacei,
- const FvWallInfoBase& neighbourInfo,
+ const FvWallInfo& neighbourInfo,
const scalar tol,
TrackingData& td
);
@@ -99,7 +109,7 @@ public:
const fvMesh&,
const labelPair& thisPatchAndFacei,
const label neighbourCelli,
- const FvWallInfoBase& neighbourInfo,
+ const FvWallInfo& neighbourInfo,
const scalar tol,
TrackingData& td
);
@@ -110,27 +120,41 @@ public:
(
const fvMesh&,
const labelPair& thisPatchAndFacei,
- const FvWallInfoBase& neighbourInfo,
+ const FvWallInfo& neighbourInfo,
const scalar tol,
TrackingData& td
);
};
-/*---------------------------------------------------------------------------*\
- Class FvWallInfo Declaration
-\*---------------------------------------------------------------------------*/
-template
-class FvWallInfo
-:
- public FvWallInfoBase>
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+class wallPoint;
+
+template<>
+inline bool contiguous>()
{
- public:
+ return true;
+}
- using
- FvWallInfoBase>::
- FvWallInfoBase;
-};
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template
+class WallLocationData;
+
+#define DefineContiguousFvWallLocationDataType(Type, nullArg) \
+ template<> \
+ inline bool contiguous>>() \
+ { \
+ return true; \
+ }
+
+DefineContiguousFvWallLocationDataType(bool, );
+DefineContiguousFvWallLocationDataType(label, );
+FOR_ALL_FIELD_TYPES(DefineContiguousFvWallLocationDataType);
+
+#undef DefineContiguousFvWallLocationDataType
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoData.H b/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoData.H
deleted file mode 100644
index b9b778eee8..0000000000
--- a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoData.H
+++ /dev/null
@@ -1,208 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-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::FvWallInfoData
-
-Description
- Holds information (coordinate and normal) regarding nearest wall point.
-
- Is like FvWallInfo but transfer extra (passive) data.
- Used e.g. in wall distance calculation with wall reflection vectors.
-
-SourceFiles
- FvWallInfoDataI.H
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef FvWallInfoData_H
-#define FvWallInfoData_H
-
-#include "FvWallInfo.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// Forward declaration of friend functions and operators
-template
-class FvWallInfoDataBase;
-
-template
-Istream& operator>>
-(
- Istream&,
- FvWallInfoDataBase&
-);
-
-template
-Ostream& operator<<
-(
- Ostream&,
- const FvWallInfoDataBase&
-);
-
-
-/*---------------------------------------------------------------------------*\
- Class FvWallInfoDataBase Declaration
-\*---------------------------------------------------------------------------*/
-
-template
-class FvWallInfoDataBase
-:
- public FvWallInfoBase
-{
- // Private Data
-
- //- Data at nearest wall center
- Type data_;
-
-
-protected:
-
- // Protected Member Functions
-
- //- Evaluate distance to point. Update distSqr, origin from whomever
- // is nearer pt. Return true if w2 is closer to point.
- template
- inline bool update
- (
- const point&,
- const FvWallInfoDataBase& w2,
- const scalar tol,
- TrackingData& td
- );
-
-
-public:
-
- friend class FvWallInfoBase;
-
-
- typedef Type dataType;
-
-
- // Constructors
-
- //- Construct null
- inline FvWallInfoDataBase();
-
- //- Construct from data and other geometry
- template
- inline FvWallInfoDataBase
- (
- const Type& data,
- const Geometry& ... geometry
- );
-
-
- // Member Functions
-
- // Access
-
- inline const Type& data() const;
-
- inline Type& data();
-
- template
- inline const Type& data(TrackingData& td) const;
-
-
- // Needed by meshWave
-
- //- Transform across an interface
- template
- inline void transform
- (
- const fvPatch& patch,
- const label patchFacei,
- const transformer& transform,
- TrackingData& td
- );
-
-
- // IOstream Operators
-
- friend Ostream& operator<<
- (
- Ostream&,
- const FvWallInfoDataBase&
- );
-
- friend Istream& operator>>
- (
- Istream&,
- FvWallInfoDataBase&
- );
-};
-
-
-/*---------------------------------------------------------------------------*\
- Class FvWallInfoData Declaration
-\*---------------------------------------------------------------------------*/
-
-template
-class FvWallInfoData
-:
- public FvWallInfoDataBase>
-{
- public:
-
- using
- FvWallInfoDataBase>::
- FvWallInfoDataBase;
-};
-
-
-#define DefineFvWallInfoType(Type, nullArg) \
- \
- template \
- using CAT(FvWallInfo, CAPITALIZE(Type)) = FvWallInfoData; \
- \
- template<> \
- inline bool contiguous>() \
- { \
- return contiguous>(); \
- }
-
-DefineFvWallInfoType(bool, nullArg)
-DefineFvWallInfoType(label, nullArg)
-FOR_ALL_FIELD_TYPES(DefineFvWallInfoType);
-
-#undef DefineFvWallInfoType
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#include "FvWallInfoDataI.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoI.H b/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoI.H
index 78b307b3a0..fb165a626c 100644
--- a/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoI.H
+++ b/src/finiteVolume/fvMesh/wallDist/FvWallInfo/FvWallInfoI.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -30,9 +30,23 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-template
+template
template
-inline void Foam::FvWallInfoBase::transform
+inline bool Foam::FvWallInfo::sameGeometry
+(
+ const fvMesh& mesh,
+ const FvWallInfo& w2,
+ const scalar tol,
+ TrackingData& td
+) const
+{
+ return WallLocation::sameGeometry(w2, tol, td);
+}
+
+
+template
+template
+inline void Foam::FvWallInfo::transform
(
const fvPatch& patch,
const label patchFacei,
@@ -40,47 +54,41 @@ inline void Foam::FvWallInfoBase::transform
TrackingData& td
)
{
- WallInfo::template type::transform
- (
- patch.patch(),
- patchFacei,
- transform,
- td
- );
+ WallLocation::transform(transform, td);
}
-template
+template
template
-inline bool Foam::FvWallInfoBase::updateCell
+inline bool Foam::FvWallInfo::updateCell
(
const fvMesh& mesh,
const label thisCelli,
const labelPair& neighbourPatchAndFacei,
- const FvWallInfoBase& neighbourWallInfo,
+ const FvWallInfo& neighbourWallInfo,
const scalar tol,
TrackingData& td
)
{
return
- static_cast(*this).update
+ WallLocation::update
(
mesh.C()[thisCelli],
- static_cast(neighbourWallInfo),
+ neighbourWallInfo,
tol,
td
);
}
-template
+template
template
-inline bool Foam::FvWallInfoBase::updateFace
+inline bool Foam::FvWallInfo::updateFace
(
const fvMesh& mesh,
const labelPair& thisPatchAndFacei,
const label neighbourCelli,
- const FvWallInfoBase& neighbourWallInfo,
+ const FvWallInfo& neighbourWallInfo,
const scalar tol,
TrackingData& td
)
@@ -89,25 +97,25 @@ inline bool Foam::FvWallInfoBase::updateFace
const label thisFacei = thisPatchAndFacei.second();
return
- static_cast(*this).update
+ WallLocation::update
(
thisPatchi == -1
? mesh.Cf()[thisFacei]
: mesh.Cf().boundaryField()[thisPatchi][thisFacei],
- static_cast(neighbourWallInfo),
+ neighbourWallInfo,
tol,
td
);
}
-template
+template
template
-inline bool Foam::FvWallInfoBase::updateFace
+inline bool Foam::FvWallInfo::updateFace
(
const fvMesh& mesh,
const labelPair& thisPatchAndFacei,
- const FvWallInfoBase& neighbourWallInfo,
+ const FvWallInfo& neighbourWallInfo,
const scalar tol,
TrackingData& td
)
@@ -116,12 +124,12 @@ inline bool Foam::FvWallInfoBase::updateFace
const label thisFacei = thisPatchAndFacei.second();
return
- static_cast(*this).update
+ WallLocation::update
(
thisPatchi == -1
? mesh.Cf()[thisFacei]
: mesh.Cf().boundaryField()[thisPatchi][thisFacei],
- static_cast(neighbourWallInfo),
+ neighbourWallInfo,
tol,
td
);
diff --git a/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWave.H b/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWave.H
index 96d4010bb8..1c8b6bc010 100644
--- a/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWave.H
+++ b/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWave.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -40,6 +40,8 @@ SourceFiles
#include "volFields.H"
#include "wallPoint.H"
#include "wallFace.H"
+#include "WallLocationData.H"
+#include "FvWallInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -66,7 +68,7 @@ List getChangedPatchAndFaces
// calculate/correct/calculateAndCorrect functions below.
template
<
- class WallInfo,
+ class FvWallInfoType,
class TrackingData,
template class PatchField,
class GeoMesh,
@@ -114,10 +116,12 @@ label calculateAndCorrect
GeometricField& distance
);
-//- Calculate distance and additional data from patches
+//- Calculate distance and additional data from patches, using an
+// arbitrary wall location wave class
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData = int
@@ -128,17 +132,16 @@ label calculate
const labelHashSet& patchIDs,
const scalar minFaceFraction,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
- TrackingData& td =
- FvFaceCellWave>::defaultTrackingData_
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
);
-//- Correct distance and additional data from patches
+//- Correct distance and additional data from patches, using an
+// arbitrary wall location wave class
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData = int
@@ -150,17 +153,16 @@ void correct
const scalar minFaceFraction,
const label nCorrections,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
- TrackingData& td =
- FvFaceCellWave>::defaultTrackingData_
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
);
-//- Calculate and correct distance and additional data from patches
+//- Calculate and correct distance and additional data from patches, using an
+// arbitrary wall location wave class
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData = int
@@ -172,11 +174,64 @@ label calculateAndCorrect
const scalar minFaceFraction,
const label nCorrections,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
- TrackingData& td =
- FvFaceCellWave>::defaultTrackingData_
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
+);
+
+//- Calculate distance and additional data from patches
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData = int
+>
+label calculate
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
+);
+
+//- Correct distance and additional data from patches
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData = int
+>
+void correct
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ const label nCorrections,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
+);
+
+//- Calculate and correct distance and additional data from patches
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData = int
+>
+label calculateAndCorrect
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ const label nCorrections,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td = FvFaceCellWave::defaultTrackingData_
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWaveTemplates.C b/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWaveTemplates.C
index 64f201e1b5..cbfdbf9454 100644
--- a/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWaveTemplates.C
+++ b/src/finiteVolume/fvMesh/wallDist/fvPatchDistWave/fvPatchDistWaveTemplates.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -33,21 +33,21 @@ namespace Foam
namespace fvPatchDistWave
{
-template
-const List& getInternalInfo
+template
+const List& getInternalInfo
(
const volScalarField& distance,
- FvFaceCellWave& wave
+ FvFaceCellWave& wave
)
{
return wave.cellInfo();
}
-template
-const List& getInternalInfo
+template
+const List& getInternalInfo
(
const surfaceScalarField& distance,
- FvFaceCellWave& wave
+ FvFaceCellWave& wave
)
{
return wave.internalFaceInfo();
@@ -61,7 +61,7 @@ const List& getInternalInfo
template
<
- class WallInfo,
+ class FvWallInfoType,
class TrackingData,
template class PatchField,
class GeoMesh,
@@ -86,7 +86,7 @@ Foam::label Foam::fvPatchDistWave::wave
if (!calculate && nCorrections == 0) return 0;
// Initialise changedFacesInfo to face centres on patches
- List changedFacesInfo(changedPatchAndFaces.size());
+ List changedFacesInfo(changedPatchAndFaces.size());
forAll(changedPatchAndFaces, changedFacei)
{
const label patchi =
@@ -95,7 +95,7 @@ Foam::label Foam::fvPatchDistWave::wave
changedPatchAndFaces[changedFacei].second();
changedFacesInfo[changedFacei] =
- WallInfo
+ FvWallInfoType
(
data.boundaryField()[patchi][patchFacei] ...,
mesh.boundaryMesh()[patchi][patchFacei],
@@ -106,25 +106,25 @@ Foam::label Foam::fvPatchDistWave::wave
}
// Do calculate patch distance by 'growing' from faces.
- List internalFaceInfo(mesh.nInternalFaces());
- List> patchFaceInfo
+ List internalFaceInfo(mesh.nInternalFaces());
+ List> patchFaceInfo
(
- FvFaceCellWave::template
- sizesListList>>
+ FvFaceCellWave::template
+ sizesListList>>
(
- FvFaceCellWave::template
+ FvFaceCellWave::template
listListSizes(mesh.boundary()),
- WallInfo()
+ FvWallInfoType()
)
);
- List cellInfo(mesh.nCells());
+ List cellInfo(mesh.nCells());
// Prevent hangs associated with generation of on-demand geometry
mesh.C();
mesh.Cf();
// Do the wave
- FvFaceCellWave wave
+ FvFaceCellWave wave
(
mesh,
internalFaceInfo,
@@ -148,7 +148,7 @@ Foam::label Foam::fvPatchDistWave::wave
}
// Copy distances into field
- const List& internalInfo = getInternalInfo(distance, wave);
+ const List& internalInfo = getInternalInfo(distance, wave);
label nUnset = 0;
forAll(internalInfo, internali)
{
@@ -276,7 +276,8 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData
@@ -287,14 +288,12 @@ Foam::label Foam::fvPatchDistWave::calculate
const labelHashSet& patchIDs,
const scalar minFaceFraction,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
+ GeometricField& data,
TrackingData& td
)
{
return
- wave, TrackingData>
+ wave>, TrackingData>
(
mesh,
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
@@ -308,7 +307,8 @@ Foam::label Foam::fvPatchDistWave::calculate
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData
@@ -320,13 +320,11 @@ void Foam::fvPatchDistWave::correct
const scalar minFaceFraction,
const label nCorrections,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
+ GeometricField& data,
TrackingData& td
)
{
- wave, TrackingData>
+ wave>, TrackingData>
(
mesh,
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
@@ -340,7 +338,8 @@ void Foam::fvPatchDistWave::correct
template
<
- template class WallInfoData,
+ template class WallLocation,
+ class DataType,
template class PatchField,
class GeoMesh,
class TrackingData
@@ -352,9 +351,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
const scalar minFaceFraction,
const label nCorrections,
GeometricField& distance,
- GeometricField
- ::dataType, PatchField, GeoMesh>&
- data,
+ GeometricField& data,
TrackingData& td
)
{
@@ -362,7 +359,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction);
const label nUnset =
- wave, TrackingData>
+ wave>, TrackingData>
(
mesh,
changedPatchAndFaces,
@@ -372,7 +369,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
data
);
- wave, TrackingData>
+ wave>, TrackingData>
(
mesh,
changedPatchAndFaces,
@@ -386,4 +383,110 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
}
+namespace Foam
+{
+namespace fvPatchDistWave
+{
+ template
+ struct WallLocationDataType
+ {
+ template
+ using type = WallLocationData;
+ };
+}
+}
+
+
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData
+>
+Foam::label Foam::fvPatchDistWave::calculate
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td
+)
+{
+ return
+ calculate::template type>
+ (
+ mesh,
+ getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
+ -1,
+ distance,
+ td,
+ data
+ );
+}
+
+
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData
+>
+void Foam::fvPatchDistWave::correct
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ const label nCorrections,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td
+)
+{
+ correct::template type>
+ (
+ mesh,
+ getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
+ nCorrections,
+ distance,
+ td,
+ data
+ );
+}
+
+
+template
+<
+ class DataType,
+ template class PatchField,
+ class GeoMesh,
+ class TrackingData
+>
+Foam::label Foam::fvPatchDistWave::calculateAndCorrect
+(
+ const fvMesh& mesh,
+ const labelHashSet& patchIDs,
+ const scalar minFaceFraction,
+ const label nCorrections,
+ GeometricField& distance,
+ GeometricField& data,
+ TrackingData& td
+)
+{
+ return
+ calculateAndCorrect::template type>
+ (
+ mesh,
+ patchIDs,
+ minFaceFraction,
+ nCorrections,
+ distance,
+ data,
+ td
+ );
+}
+
+
// ************************************************************************* //
diff --git a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C
index ea0d6f750b..9937066b44 100644
--- a/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C
+++ b/src/finiteVolume/fvMesh/wallDist/patchDistMethods/meshWave/meshWavePatchDistMethod.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
- \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -27,7 +27,6 @@ License
#include "fvMesh.H"
#include "volFields.H"
#include "fvPatchDistWave.H"
-#include "FvWallInfoData.H"
#include "emptyFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
@@ -103,7 +102,7 @@ bool Foam::patchDistMethods::meshWave::correct
y = dimensionedScalar(dimLength, great);
const label nUnset =
- fvPatchDistWave::calculateAndCorrect
+ fvPatchDistWave::calculateAndCorrect
(
mesh_,
patchIDs_,
diff --git a/src/meshTools/patchDist/WallInfo/WallInfo.H b/src/meshTools/patchDist/WallInfo/WallInfo.H
new file mode 100644
index 0000000000..db49f53675
--- /dev/null
+++ b/src/meshTools/patchDist/WallInfo/WallInfo.H
@@ -0,0 +1,171 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+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::WallInfo
+
+Description
+ Holds information regarding nearest wall point. Used in wall distance
+ calculation.
+
+SourceFiles
+ WallInfoI.H
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef WallInfo_H
+#define WallInfo_H
+
+#include "fieldTypes.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class polyPatch;
+class polyMesh;
+class transformer;
+
+/*---------------------------------------------------------------------------*\
+ Class WallInfo Declaration
+\*---------------------------------------------------------------------------*/
+
+template
+class WallInfo
+:
+ public WallLocation
+{
+public:
+
+ // Constructors
+
+ //- Inherit constructors
+ using WallLocation::WallLocation;
+
+
+ // Member Functions
+
+ // Needed by FaceCellWave
+
+ //- Check for identical geometrical data. Used for cyclics checking.
+ template
+ inline bool sameGeometry
+ (
+ const polyMesh& mesh,
+ const WallInfo& w2,
+ const scalar tol,
+ TrackingData& td
+ ) const;
+
+ //- Transform across an interface
+ template
+ inline void transform
+ (
+ const polyPatch& patch,
+ const label patchFacei,
+ const transformer& transform,
+ TrackingData& td
+ );
+
+ //- Influence of neighbouring face.
+ template
+ inline bool updateCell
+ (
+ const polyMesh&,
+ const label thisCelli,
+ const label neighbourFacei,
+ const WallInfo& neighbourInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of neighbouring cell.
+ template
+ inline bool updateFace
+ (
+ const polyMesh&,
+ const label thisFacei,
+ const label neighbourCelli,
+ const WallInfo& neighbourInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+
+ //- Influence of different value on same face.
+ template
+ inline bool updateFace
+ (
+ const polyMesh&,
+ const label thisFacei,
+ const WallInfo& neighbourInfo,
+ const scalar tol,
+ TrackingData& td
+ );
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+class wallPoint;
+
+template<>
+inline bool contiguous>()
+{
+ return true;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+template
+class WallLocationData;
+
+#define DefineContiguousWallLocationDataType(Type, nullArg) \
+ template<> \
+ inline bool contiguous>>() \
+ { \
+ return true; \
+ }
+
+DefineContiguousWallLocationDataType(bool, );
+DefineContiguousWallLocationDataType(label, );
+FOR_ALL_FIELD_TYPES(DefineContiguousWallLocationDataType);
+
+#undef DefineContiguousWallLocationDataType
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "WallInfoI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/meshTools/patchDist/WallInfo/WallInfoI.H b/src/meshTools/patchDist/WallInfo/WallInfoI.H
new file mode 100644
index 0000000000..b00813e239
--- /dev/null
+++ b/src/meshTools/patchDist/WallInfo/WallInfoI.H
@@ -0,0 +1,127 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+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 "WallInfo.H"
+#include "polyMesh.H"
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+template
+inline bool Foam::WallInfo::sameGeometry
+(
+ const polyMesh& mesh,
+ const WallInfo& w2,
+ const scalar tol,
+ TrackingData& td
+) const
+{
+ return WallLocation::sameGeometry(w2, tol, td);
+}
+
+
+template
+template