patchDistWave, fvPatchDistWave: Simplified wall location structure
This commit is contained in:
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 WallInfo, class Derived>
|
||||
class FvWallInfoYPlusBase
|
||||
template<class WallLocation>
|
||||
class WallLocationYPlus
|
||||
:
|
||||
public FvWallInfoDataBase<WallInfo, scalar, Derived>
|
||||
public WallLocationData<WallLocation, scalar>
|
||||
{
|
||||
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<WallInfo, Derived>;
|
||||
|
||||
|
||||
// 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<class TrackingData>
|
||||
// is nearer pt. Return true if w2 is closer to point, false
|
||||
// otherwise.
|
||||
template<class TrackingYPlus>
|
||||
inline bool update
|
||||
(
|
||||
const point& pt,
|
||||
const FvWallInfoYPlusBase<WallInfo, Derived>& w2,
|
||||
const point&,
|
||||
const WallLocationYPlus<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
TrackingYPlus& td
|
||||
);
|
||||
|
||||
|
||||
@ -93,28 +95,25 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline FvWallInfoYPlusBase();
|
||||
inline WallLocationYPlus();
|
||||
|
||||
//- Inherit constructors
|
||||
using FvWallInfoDataBase<WallInfo, scalar, Derived>::FvWallInfoDataBase;
|
||||
using WallLocationData<WallLocation, scalar>::WallLocationData;
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FvWallInfoYPlus Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo>
|
||||
class FvWallInfoYPlus
|
||||
:
|
||||
public FvWallInfoYPlusBase<WallInfo, FvWallInfoYPlus<WallInfo>>
|
||||
class wallPoint;
|
||||
|
||||
template<class WallLocation>
|
||||
class FvWallInfo;
|
||||
|
||||
template<>
|
||||
inline bool contiguous<FvWallInfo<WallLocationYPlus<wallPoint>>>()
|
||||
{
|
||||
public:
|
||||
|
||||
using
|
||||
FvWallInfoYPlusBase<WallInfo, FvWallInfoYPlus<WallInfo>>::
|
||||
FvWallInfoYPlusBase;
|
||||
};
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -123,7 +122,7 @@ class FvWallInfoYPlus
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "FvWallInfoYPlusI.H"
|
||||
#include "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<class WallInfo, class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::FvWallInfoYPlusBase<WallInfo, Derived>::update
|
||||
template<class WallLocation>
|
||||
template<class TrackingYPlus>
|
||||
inline bool Foam::WallLocationYPlus<WallLocation>::update
|
||||
(
|
||||
const point& pt,
|
||||
const FvWallInfoYPlusBase<WallInfo, Derived>& w2,
|
||||
const WallLocationYPlus<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
TrackingYPlus& td
|
||||
)
|
||||
{
|
||||
FvWallInfoYPlusBase<WallInfo, Derived> copy(*this);
|
||||
WallLocationYPlus<WallLocation> copy(*this);
|
||||
|
||||
bool result =
|
||||
FvWallInfoDataBase<WallInfo, scalar, Derived>::update(pt, w2, tol, td);
|
||||
WallLocationData<WallLocation, scalar>::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<WallInfo, Derived>::update
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo, class Derived>
|
||||
inline Foam::FvWallInfoYPlusBase<WallInfo, Derived>::FvWallInfoYPlusBase()
|
||||
template<class WallLocation>
|
||||
inline Foam::WallLocationYPlus<WallLocation>::WallLocationYPlus()
|
||||
:
|
||||
FvWallInfoDataBase<WallInfo, scalar, Derived>()
|
||||
WallLocationData<WallLocation, scalar>()
|
||||
{
|
||||
// Important: The value of yStar where the meshWave does not come.
|
||||
this->data() = 1.0;
|
||||
@ -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<wallPoint>::trackData td;
|
||||
WallLocationYPlus<wallPoint>::trackData td;
|
||||
td.yPlusCutOff = yPlusCutOff_;
|
||||
|
||||
fvPatchDistWave::calculateAndCorrect<FvWallInfoYPlus>
|
||||
fvPatchDistWave::calculateAndCorrect<WallLocationYPlus>
|
||||
(
|
||||
mesh,
|
||||
mesh.boundaryMesh().findPatchIDs<wallPolyPatch>(),
|
||||
|
||||
@ -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 WallInfo, class Derived>
|
||||
class FvWallInfoBase
|
||||
template<class WallLocation>
|
||||
class FvWallInfo
|
||||
:
|
||||
public WallInfo::template type<Derived>
|
||||
public WallLocation
|
||||
{
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Inherit constructors
|
||||
using WallInfo::template type<Derived>::type;
|
||||
using WallLocation::WallLocation;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Needed by FvFaceCellWave
|
||||
|
||||
//- Check for identical geometrical data. Used for cyclics checking.
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const FvWallInfo<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
//- Transform across an interface
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
@ -87,7 +97,7 @@ public:
|
||||
const fvMesh&,
|
||||
const label thisCelli,
|
||||
const labelPair& neighbourPatchAndFacei,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -99,7 +109,7 @@ public:
|
||||
const fvMesh&,
|
||||
const labelPair& thisPatchAndFacei,
|
||||
const label neighbourCelli,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -110,27 +120,41 @@ public:
|
||||
(
|
||||
const fvMesh&,
|
||||
const labelPair& thisPatchAndFacei,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FvWallInfo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class WallInfo>
|
||||
class FvWallInfo
|
||||
:
|
||||
public FvWallInfoBase<WallInfo, FvWallInfo<WallInfo>>
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
class wallPoint;
|
||||
|
||||
template<>
|
||||
inline bool contiguous<FvWallInfo<wallPoint>>()
|
||||
{
|
||||
public:
|
||||
return true;
|
||||
}
|
||||
|
||||
using
|
||||
FvWallInfoBase<WallInfo, FvWallInfo<WallInfo>>::
|
||||
FvWallInfoBase;
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallLocation, class Type>
|
||||
class WallLocationData;
|
||||
|
||||
#define DefineContiguousFvWallLocationDataType(Type, nullArg) \
|
||||
template<> \
|
||||
inline bool contiguous<FvWallInfo<WallLocationData<wallPoint, Type>>>() \
|
||||
{ \
|
||||
return true; \
|
||||
}
|
||||
|
||||
DefineContiguousFvWallLocationDataType(bool, );
|
||||
DefineContiguousFvWallLocationDataType(label, );
|
||||
FOR_ALL_FIELD_TYPES(DefineContiguousFvWallLocationDataType);
|
||||
|
||||
#undef DefineContiguousFvWallLocationDataType
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 WallInfo, class Type, class Derived>
|
||||
class FvWallInfoDataBase;
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
Istream& operator>>
|
||||
(
|
||||
Istream&,
|
||||
FvWallInfoDataBase<WallInfo, Type, Derived>&
|
||||
);
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const FvWallInfoDataBase<WallInfo, Type, Derived>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FvWallInfoDataBase Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
class FvWallInfoDataBase
|
||||
:
|
||||
public FvWallInfoBase<WallInfo, Derived>
|
||||
{
|
||||
// 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<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const point&,
|
||||
const FvWallInfoDataBase<WallInfo, Type, Derived>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
friend class FvWallInfoBase<WallInfo, Derived>;
|
||||
|
||||
|
||||
typedef Type dataType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline FvWallInfoDataBase();
|
||||
|
||||
//- Construct from data and other geometry
|
||||
template<class ... Geometry>
|
||||
inline FvWallInfoDataBase
|
||||
(
|
||||
const Type& data,
|
||||
const Geometry& ... geometry
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline const Type& data() const;
|
||||
|
||||
inline Type& data();
|
||||
|
||||
template<class TrackingData>
|
||||
inline const Type& data(TrackingData& td) const;
|
||||
|
||||
|
||||
// Needed by meshWave
|
||||
|
||||
//- Transform across an interface
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const fvPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <WallInfo, Type, Derived>
|
||||
(
|
||||
Ostream&,
|
||||
const FvWallInfoDataBase<WallInfo, Type, Derived>&
|
||||
);
|
||||
|
||||
friend Istream& operator>> <WallInfo, Type, Derived>
|
||||
(
|
||||
Istream&,
|
||||
FvWallInfoDataBase<WallInfo, Type, Derived>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class FvWallInfoData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class WallInfo, class Type>
|
||||
class FvWallInfoData
|
||||
:
|
||||
public FvWallInfoDataBase<WallInfo, Type, FvWallInfoData<WallInfo, Type>>
|
||||
{
|
||||
public:
|
||||
|
||||
using
|
||||
FvWallInfoDataBase<WallInfo, Type, FvWallInfoData<WallInfo, Type>>::
|
||||
FvWallInfoDataBase;
|
||||
};
|
||||
|
||||
|
||||
#define DefineFvWallInfoType(Type, nullArg) \
|
||||
\
|
||||
template<class WallInfo> \
|
||||
using CAT(FvWallInfo, CAPITALIZE(Type)) = FvWallInfoData<WallInfo, Type>; \
|
||||
\
|
||||
template<> \
|
||||
inline bool contiguous<CAT(FvWallInfo, CAPITALIZE(Type))<wallPoint>>() \
|
||||
{ \
|
||||
return contiguous<FvWallInfo<wallPoint>>(); \
|
||||
}
|
||||
|
||||
DefineFvWallInfoType(bool, nullArg)
|
||||
DefineFvWallInfoType(label, nullArg)
|
||||
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType);
|
||||
|
||||
#undef DefineFvWallInfoType
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "FvWallInfoDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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<class WallInfo, class Derived>
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline void Foam::FvWallInfoBase<WallInfo, Derived>::transform
|
||||
inline bool Foam::FvWallInfo<WallLocation>::sameGeometry
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const FvWallInfo<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return WallLocation::sameGeometry(w2, tol, td);
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline void Foam::FvWallInfo<WallLocation>::transform
|
||||
(
|
||||
const fvPatch& patch,
|
||||
const label patchFacei,
|
||||
@ -40,47 +54,41 @@ inline void Foam::FvWallInfoBase<WallInfo, Derived>::transform
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
WallInfo::template type<Derived>::transform
|
||||
(
|
||||
patch.patch(),
|
||||
patchFacei,
|
||||
transform,
|
||||
td
|
||||
);
|
||||
WallLocation::transform(transform, td);
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Derived>
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::FvWallInfoBase<WallInfo, Derived>::updateCell
|
||||
inline bool Foam::FvWallInfo<WallLocation>::updateCell
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const label thisCelli,
|
||||
const labelPair& neighbourPatchAndFacei,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourWallInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
WallLocation::update
|
||||
(
|
||||
mesh.C()[thisCelli],
|
||||
static_cast<const Derived&>(neighbourWallInfo),
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Derived>
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::FvWallInfoBase<WallInfo, Derived>::updateFace
|
||||
inline bool Foam::FvWallInfo<WallLocation>::updateFace
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelPair& thisPatchAndFacei,
|
||||
const label neighbourCelli,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourWallInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
@ -89,25 +97,25 @@ inline bool Foam::FvWallInfoBase<WallInfo, Derived>::updateFace
|
||||
const label thisFacei = thisPatchAndFacei.second();
|
||||
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
WallLocation::update
|
||||
(
|
||||
thisPatchi == -1
|
||||
? mesh.Cf()[thisFacei]
|
||||
: mesh.Cf().boundaryField()[thisPatchi][thisFacei],
|
||||
static_cast<const Derived&>(neighbourWallInfo),
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Derived>
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::FvWallInfoBase<WallInfo, Derived>::updateFace
|
||||
inline bool Foam::FvWallInfo<WallLocation>::updateFace
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelPair& thisPatchAndFacei,
|
||||
const FvWallInfoBase<WallInfo, Derived>& neighbourWallInfo,
|
||||
const FvWallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
@ -116,12 +124,12 @@ inline bool Foam::FvWallInfoBase<WallInfo, Derived>::updateFace
|
||||
const label thisFacei = thisPatchAndFacei.second();
|
||||
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
WallLocation::update
|
||||
(
|
||||
thisPatchi == -1
|
||||
? mesh.Cf()[thisFacei]
|
||||
: mesh.Cf().boundaryField()[thisPatchi][thisFacei],
|
||||
static_cast<const Derived&>(neighbourWallInfo),
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
|
||||
@ -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<labelPair> getChangedPatchAndFaces
|
||||
// calculate/correct/calculateAndCorrect functions below.
|
||||
template
|
||||
<
|
||||
class WallInfo,
|
||||
class FvWallInfoType,
|
||||
class TrackingData,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
@ -114,10 +116,12 @@ label calculateAndCorrect
|
||||
GeometricField<scalar, PatchField, GeoMesh>& 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> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
@ -128,17 +132,16 @@ label calculate
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
TrackingData& td =
|
||||
FvFaceCellWave<WallInfoData<wallPoint>>::defaultTrackingData_
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::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> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
@ -150,17 +153,16 @@ void correct
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
TrackingData& td =
|
||||
FvFaceCellWave<WallInfoData<wallPoint>>::defaultTrackingData_
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::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> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
@ -172,11 +174,64 @@ label calculateAndCorrect
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
TrackingData& td =
|
||||
FvFaceCellWave<WallInfoData<wallPoint>>::defaultTrackingData_
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::defaultTrackingData_
|
||||
);
|
||||
|
||||
//- Calculate distance and additional data from patches
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
>
|
||||
label calculate
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::defaultTrackingData_
|
||||
);
|
||||
|
||||
//- Correct distance and additional data from patches
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
>
|
||||
void correct
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::defaultTrackingData_
|
||||
);
|
||||
|
||||
//- Calculate and correct distance and additional data from patches
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData = int
|
||||
>
|
||||
label calculateAndCorrect
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td = FvFaceCellWave<nil>::defaultTrackingData_
|
||||
);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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<class WallInfo, class TrackingData>
|
||||
const List<WallInfo>& getInternalInfo
|
||||
template<class FvWallInfoType, class TrackingData>
|
||||
const List<FvWallInfoType>& getInternalInfo
|
||||
(
|
||||
const volScalarField& distance,
|
||||
FvFaceCellWave<WallInfo, TrackingData>& wave
|
||||
FvFaceCellWave<FvWallInfoType, TrackingData>& wave
|
||||
)
|
||||
{
|
||||
return wave.cellInfo();
|
||||
}
|
||||
|
||||
template<class WallInfo, class TrackingData>
|
||||
const List<WallInfo>& getInternalInfo
|
||||
template<class FvWallInfoType, class TrackingData>
|
||||
const List<FvWallInfoType>& getInternalInfo
|
||||
(
|
||||
const surfaceScalarField& distance,
|
||||
FvFaceCellWave<WallInfo, TrackingData>& wave
|
||||
FvFaceCellWave<FvWallInfoType, TrackingData>& wave
|
||||
)
|
||||
{
|
||||
return wave.internalFaceInfo();
|
||||
@ -61,7 +61,7 @@ const List<WallInfo>& getInternalInfo
|
||||
|
||||
template
|
||||
<
|
||||
class WallInfo,
|
||||
class FvWallInfoType,
|
||||
class TrackingData,
|
||||
template<class> 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<WallInfo> changedFacesInfo(changedPatchAndFaces.size());
|
||||
List<FvWallInfoType> 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<WallInfo> internalFaceInfo(mesh.nInternalFaces());
|
||||
List<List<WallInfo>> patchFaceInfo
|
||||
List<FvWallInfoType> internalFaceInfo(mesh.nInternalFaces());
|
||||
List<List<FvWallInfoType>> patchFaceInfo
|
||||
(
|
||||
FvFaceCellWave<WallInfo, TrackingData>::template
|
||||
sizesListList<List<List<WallInfo>>>
|
||||
FvFaceCellWave<FvWallInfoType, TrackingData>::template
|
||||
sizesListList<List<List<FvWallInfoType>>>
|
||||
(
|
||||
FvFaceCellWave<WallInfo, TrackingData>::template
|
||||
FvFaceCellWave<FvWallInfoType, TrackingData>::template
|
||||
listListSizes(mesh.boundary()),
|
||||
WallInfo()
|
||||
FvWallInfoType()
|
||||
)
|
||||
);
|
||||
List<WallInfo> cellInfo(mesh.nCells());
|
||||
List<FvWallInfoType> cellInfo(mesh.nCells());
|
||||
|
||||
// Prevent hangs associated with generation of on-demand geometry
|
||||
mesh.C();
|
||||
mesh.Cf();
|
||||
|
||||
// Do the wave
|
||||
FvFaceCellWave<WallInfo, TrackingData> wave
|
||||
FvFaceCellWave<FvWallInfoType, TrackingData> wave
|
||||
(
|
||||
mesh,
|
||||
internalFaceInfo,
|
||||
@ -148,7 +148,7 @@ Foam::label Foam::fvPatchDistWave::wave
|
||||
}
|
||||
|
||||
// Copy distances into field
|
||||
const List<WallInfo>& internalInfo = getInternalInfo(distance, wave);
|
||||
const List<FvWallInfoType>& internalInfo = getInternalInfo(distance, wave);
|
||||
label nUnset = 0;
|
||||
forAll(internalInfo, internali)
|
||||
{
|
||||
@ -276,7 +276,8 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
@ -287,14 +288,12 @@ Foam::label Foam::fvPatchDistWave::calculate
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
wave<WallInfoData<wallPoint>, TrackingData>
|
||||
wave<FvWallInfo<WallLocation<wallPoint>>, TrackingData>
|
||||
(
|
||||
mesh,
|
||||
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
|
||||
@ -308,7 +307,8 @@ Foam::label Foam::fvPatchDistWave::calculate
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
@ -320,13 +320,11 @@ void Foam::fvPatchDistWave::correct
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
wave<WallInfoData<wallFace>, TrackingData>
|
||||
wave<FvWallInfo<WallLocation<wallFace>>, TrackingData>
|
||||
(
|
||||
mesh,
|
||||
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
|
||||
@ -340,7 +338,8 @@ void Foam::fvPatchDistWave::correct
|
||||
|
||||
template
|
||||
<
|
||||
template<class> class WallInfoData,
|
||||
template<class> class WallLocation,
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
@ -352,9 +351,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField
|
||||
<typename WallInfoData<wallPoint>::dataType, PatchField, GeoMesh>&
|
||||
data,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
@ -362,7 +359,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction);
|
||||
|
||||
const label nUnset =
|
||||
wave<WallInfoData<wallPoint>, TrackingData>
|
||||
wave<FvWallInfo<WallLocation<wallPoint>>, TrackingData>
|
||||
(
|
||||
mesh,
|
||||
changedPatchAndFaces,
|
||||
@ -372,7 +369,7 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
data
|
||||
);
|
||||
|
||||
wave<WallInfoData<wallFace>, TrackingData>
|
||||
wave<FvWallInfo<WallLocation<wallFace>>, TrackingData>
|
||||
(
|
||||
mesh,
|
||||
changedPatchAndFaces,
|
||||
@ -386,4 +383,110 @@ Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
}
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace fvPatchDistWave
|
||||
{
|
||||
template<class Type>
|
||||
struct WallLocationDataType
|
||||
{
|
||||
template<class WallLocation>
|
||||
using type = WallLocationData<WallLocation, Type>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
>
|
||||
Foam::label Foam::fvPatchDistWave::calculate
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
calculate<WallLocationDataType<DataType>::template type>
|
||||
(
|
||||
mesh,
|
||||
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
|
||||
-1,
|
||||
distance,
|
||||
td,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
>
|
||||
void Foam::fvPatchDistWave::correct
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
correct<WallLocationDataType<DataType>::template type>
|
||||
(
|
||||
mesh,
|
||||
getChangedPatchAndFaces(mesh, patchIDs, minFaceFraction),
|
||||
nCorrections,
|
||||
distance,
|
||||
td,
|
||||
data
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class DataType,
|
||||
template<class> class PatchField,
|
||||
class GeoMesh,
|
||||
class TrackingData
|
||||
>
|
||||
Foam::label Foam::fvPatchDistWave::calculateAndCorrect
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const labelHashSet& patchIDs,
|
||||
const scalar minFaceFraction,
|
||||
const label nCorrections,
|
||||
GeometricField<scalar, PatchField, GeoMesh>& distance,
|
||||
GeometricField<DataType, PatchField, GeoMesh>& data,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
calculateAndCorrect<WallLocationDataType<DataType>::template type>
|
||||
(
|
||||
mesh,
|
||||
patchIDs,
|
||||
minFaceFraction,
|
||||
nCorrections,
|
||||
distance,
|
||||
data,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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<FvWallInfoVector>
|
||||
fvPatchDistWave::calculateAndCorrect
|
||||
(
|
||||
mesh_,
|
||||
patchIDs_,
|
||||
|
||||
171
src/meshTools/patchDist/WallInfo/WallInfo.H
Normal file
171
src/meshTools/patchDist/WallInfo/WallInfo.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 WallLocation>
|
||||
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<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const WallInfo<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
//- Transform across an interface
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face.
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const WallInfo<WallLocation>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
class wallPoint;
|
||||
|
||||
template<>
|
||||
inline bool contiguous<WallInfo<wallPoint>>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallLocation, class Type>
|
||||
class WallLocationData;
|
||||
|
||||
#define DefineContiguousWallLocationDataType(Type, nullArg) \
|
||||
template<> \
|
||||
inline bool contiguous<WallInfo<WallLocationData<wallPoint, Type>>>() \
|
||||
{ \
|
||||
return true; \
|
||||
}
|
||||
|
||||
DefineContiguousWallLocationDataType(bool, );
|
||||
DefineContiguousWallLocationDataType(label, );
|
||||
FOR_ALL_FIELD_TYPES(DefineContiguousWallLocationDataType);
|
||||
|
||||
#undef DefineContiguousWallLocationDataType
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "WallInfoI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
127
src/meshTools/patchDist/WallInfo/WallInfoI.H
Normal file
127
src/meshTools/patchDist/WallInfo/WallInfoI.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "WallInfo.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallInfo<WallLocation>::sameGeometry
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const WallInfo<WallLocation>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return WallLocation::sameGeometry(w2, tol, td);
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline void Foam::WallInfo<WallLocation>::transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
WallLocation::transform(transform, td);
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallInfo<WallLocation>::updateCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
WallLocation::update
|
||||
(
|
||||
mesh.cellCentres()[thisCelli],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallInfo<WallLocation>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
WallLocation::update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallInfo<WallLocation>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const WallInfo<WallLocation>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
WallLocation::update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
157
src/meshTools/patchDist/WallLocation/WallLocationData.H
Normal file
157
src/meshTools/patchDist/WallLocation/WallLocationData.H
Normal file
@ -0,0 +1,157 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::WallLocationData
|
||||
|
||||
Description
|
||||
Holds information regarding nearest wall point. Used in wall distance
|
||||
calculation.
|
||||
|
||||
SourceFiles
|
||||
WallLocationDataI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef WallLocationData_H
|
||||
#define WallLocationData_H
|
||||
|
||||
#include "point.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class transformer;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class WallLocation, class Type>
|
||||
class WallLocationData;
|
||||
template<class WallLocation, class Type>
|
||||
Ostream& operator<<(Ostream&, const WallLocationData<WallLocation, Type>&);
|
||||
template<class WallLocation, class Type>
|
||||
Istream& operator>>(Istream&, WallLocationData<WallLocation, Type>&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class WallLocationData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class WallLocation, class Type>
|
||||
class WallLocationData
|
||||
:
|
||||
public WallLocation
|
||||
{
|
||||
// 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, false
|
||||
// otherwise.
|
||||
template<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const point& pt,
|
||||
const WallLocationData<WallLocation, Type>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Public Typedefs
|
||||
|
||||
//- The type of the stored data
|
||||
typedef Type dataType;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline WallLocationData();
|
||||
|
||||
//- Construct from data and other geometry
|
||||
template<class ... Geometry>
|
||||
inline WallLocationData(const Type& data, const Geometry& ... geometry);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
inline const Type& data() const;
|
||||
|
||||
inline Type& data();
|
||||
|
||||
template<class TrackingData>
|
||||
inline const Type& data(TrackingData& td) const;
|
||||
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
//- Transform across an interface
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <WallLocation, Type>
|
||||
(
|
||||
Ostream&,
|
||||
const WallLocationData<WallLocation, Type>&
|
||||
);
|
||||
friend Istream& operator>> <WallLocation, Type>
|
||||
(
|
||||
Istream&,
|
||||
WallLocationData<WallLocation, Type>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "WallLocationDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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,22 +23,22 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "FvWallInfoData.H"
|
||||
#include "WallLocationData.H"
|
||||
#include "transformer.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class WallLocation, class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::update
|
||||
inline bool Foam::WallLocationData<WallLocation, Type>::update
|
||||
(
|
||||
const point& pt,
|
||||
const FvWallInfoDataBase<WallInfo, Type, Derived>& w2,
|
||||
const WallLocationData<WallLocation, Type>& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const bool result =
|
||||
FvWallInfoBase<WallInfo, Derived>::update(pt, w2, tol, td);
|
||||
const bool result = WallLocation::update(pt, w2, tol, td);
|
||||
|
||||
if (result)
|
||||
{
|
||||
@ -51,71 +51,63 @@ inline bool Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::update
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
inline Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::FvWallInfoDataBase()
|
||||
template<class WallLocation, class Type>
|
||||
inline Foam::WallLocationData<WallLocation, Type>::WallLocationData()
|
||||
:
|
||||
FvWallInfoBase<WallInfo, Derived>(),
|
||||
WallLocation(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class WallLocation, class Type>
|
||||
template<class ... Geometry>
|
||||
inline Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::FvWallInfoDataBase
|
||||
inline Foam::WallLocationData<WallLocation, Type>::WallLocationData
|
||||
(
|
||||
const Type& data,
|
||||
const Geometry& ... geometry
|
||||
)
|
||||
:
|
||||
FvWallInfoBase<WallInfo, Derived>(geometry ...),
|
||||
WallLocation(geometry ...),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
inline const Type&
|
||||
Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::data() const
|
||||
template<class WallLocation, class Type>
|
||||
inline const Type& Foam::WallLocationData<WallLocation, Type>::data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
inline Type&
|
||||
Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::data()
|
||||
template<class WallLocation, class Type>
|
||||
inline Type& Foam::WallLocationData<WallLocation, Type>::data()
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class WallLocation, class Type>
|
||||
template<class TrackingData>
|
||||
inline const Type&
|
||||
Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::data(TrackingData& td) const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class TrackingData>
|
||||
inline void Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::transform
|
||||
inline const Type& Foam::WallLocationData<WallLocation, Type>::data
|
||||
(
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class WallLocation, class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::WallLocationData<WallLocation, Type>::transform
|
||||
(
|
||||
const fvPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
FvWallInfoBase<WallInfo, Derived>::transform
|
||||
(
|
||||
patch,
|
||||
patchFacei,
|
||||
transform,
|
||||
td
|
||||
);
|
||||
WallLocation::transform(transform, td);
|
||||
|
||||
data_ = transform.transform(data_);
|
||||
}
|
||||
@ -123,30 +115,26 @@ inline void Foam::FvWallInfoDataBase<WallInfo, Type, Derived>::transform
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class WallLocation, class Type>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const FvWallInfoDataBase<WallInfo, Type, Derived>& w
|
||||
const WallLocationData<WallLocation, Type>& w
|
||||
)
|
||||
{
|
||||
return os
|
||||
<< static_cast<const FvWallInfoBase<WallInfo, Derived>&>(w)
|
||||
<< token::SPACE
|
||||
<< w.data();
|
||||
return
|
||||
os << static_cast<const WallLocation&>(w) << token::SPACE << w.data();
|
||||
}
|
||||
|
||||
|
||||
template<class WallInfo, class Type, class Derived>
|
||||
template<class WallLocation, class Type>
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
FvWallInfoDataBase<WallInfo, Type, Derived>& w
|
||||
WallLocationData<WallLocation, Type>& w
|
||||
)
|
||||
{
|
||||
return is
|
||||
>> static_cast<FvWallInfoBase<WallInfo, Derived>&>(w)
|
||||
>> w.data_;
|
||||
return is >> static_cast<WallLocation&>(w) >> w.data_;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -45,24 +45,18 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class transformer;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class Derived>
|
||||
class WallFaceBase;
|
||||
template<class Derived>
|
||||
Ostream& operator<<(Ostream&, const WallFaceBase<Derived>&);
|
||||
template<class Derived>
|
||||
Istream& operator>>(Istream&, WallFaceBase<Derived>&);
|
||||
class wallFace;
|
||||
Ostream& operator<<(Ostream&, const wallFace&);
|
||||
Istream& operator>>(Istream&, wallFace&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class WallFaceBase Declaration
|
||||
Class wallFace Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Derived>
|
||||
class WallFaceBase
|
||||
class wallFace
|
||||
{
|
||||
// Private Data
|
||||
|
||||
@ -77,12 +71,14 @@ protected:
|
||||
|
||||
// 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<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const point& pt,
|
||||
const WallFaceBase<Derived>& w2,
|
||||
const wallFace& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -93,10 +89,10 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline WallFaceBase();
|
||||
inline wallFace();
|
||||
|
||||
//- Construct from face, distance
|
||||
inline WallFaceBase
|
||||
inline wallFace
|
||||
(
|
||||
const face& f,
|
||||
const pointField& points,
|
||||
@ -104,7 +100,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from face, distance
|
||||
inline WallFaceBase
|
||||
inline wallFace
|
||||
(
|
||||
const face& f,
|
||||
const pointField& points,
|
||||
@ -131,7 +127,7 @@ public:
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
//- Check whether the WallFaceBase has been changed at all or still
|
||||
//- Check whether the wallFace has been changed at all or still
|
||||
// contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
@ -141,8 +137,7 @@ public:
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const WallFaceBase<Derived>&,
|
||||
const wallFace&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
@ -151,90 +146,29 @@ public:
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallFaceBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallFaceBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const WallFaceBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Test equality
|
||||
template<class TrackingData>
|
||||
inline bool equal
|
||||
(
|
||||
const WallFaceBase<Derived>&,
|
||||
const wallFace&,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
inline bool operator==(const WallFaceBase<Derived>&) const;
|
||||
inline bool operator!=(const WallFaceBase<Derived>&) const;
|
||||
inline bool operator==(const wallFace&) const;
|
||||
inline bool operator!=(const wallFace&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <Derived>
|
||||
(
|
||||
Ostream&,
|
||||
const WallFaceBase<Derived>&
|
||||
);
|
||||
|
||||
friend Istream& operator>> <Derived>
|
||||
(
|
||||
Istream&,
|
||||
WallFaceBase<Derived>&
|
||||
);
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallFace Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallFace
|
||||
:
|
||||
public WallFaceBase<wallFace>
|
||||
{
|
||||
public:
|
||||
|
||||
using WallFaceBase<wallFace>::WallFaceBase;
|
||||
|
||||
template<class Derived> using type = WallFaceBase<Derived>;
|
||||
inline friend Ostream& operator<<(Ostream&, const wallFace&);
|
||||
inline friend Istream& operator>>(Istream&, wallFace&);
|
||||
};
|
||||
|
||||
|
||||
@ -29,12 +29,11 @@ License
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::update
|
||||
inline bool Foam::wallFace::update
|
||||
(
|
||||
const point& pt,
|
||||
const WallFaceBase<Derived>& w2,
|
||||
const wallFace& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
@ -74,16 +73,14 @@ inline bool Foam::WallFaceBase<Derived>::update
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallFaceBase<Derived>::WallFaceBase()
|
||||
inline Foam::wallFace::wallFace()
|
||||
:
|
||||
points_(0),
|
||||
distSqr_(-great)
|
||||
{}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallFaceBase<Derived>::WallFaceBase
|
||||
inline Foam::wallFace::wallFace
|
||||
(
|
||||
const face& f,
|
||||
const pointField& points,
|
||||
@ -95,8 +92,7 @@ inline Foam::WallFaceBase<Derived>::WallFaceBase
|
||||
{}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallFaceBase<Derived>::WallFaceBase
|
||||
inline Foam::wallFace::wallFace
|
||||
(
|
||||
const face& f,
|
||||
const pointField& points,
|
||||
@ -111,167 +107,76 @@ inline Foam::WallFaceBase<Derived>::WallFaceBase
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline const Foam::pointField& Foam::WallFaceBase<Derived>::points() const
|
||||
inline const Foam::pointField& Foam::wallFace::points() const
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::pointField& Foam::WallFaceBase<Derived>::points()
|
||||
inline Foam::pointField& Foam::wallFace::points()
|
||||
{
|
||||
return points_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::scalar Foam::WallFaceBase<Derived>::distSqr() const
|
||||
inline Foam::scalar Foam::wallFace::distSqr() const
|
||||
{
|
||||
return distSqr_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::scalar& Foam::WallFaceBase<Derived>::distSqr()
|
||||
inline Foam::scalar& Foam::wallFace::distSqr()
|
||||
{
|
||||
return distSqr_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline Foam::scalar Foam::WallFaceBase<Derived>::dist(TrackingData& td) const
|
||||
inline Foam::scalar Foam::wallFace::dist(TrackingData& td) const
|
||||
{
|
||||
return valid(td) ? sqrt(distSqr_) : great;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::valid(TrackingData& td) const
|
||||
inline bool Foam::wallFace::valid(TrackingData& td) const
|
||||
{
|
||||
return distSqr_ > -small;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::sameGeometry
|
||||
inline bool Foam::wallFace::sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const WallFaceBase<Derived>& w2,
|
||||
const wallFace& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
scalar diff = mag(distSqr() - w2.distSqr());
|
||||
const scalar diff = mag(distSqr() - w2.distSqr());
|
||||
|
||||
if (diff < small)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((distSqr() > small) && ((diff/distSqr()) < tol))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return
|
||||
diff < small
|
||||
|| ((distSqr() > small) && (diff/distSqr() < tol));
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline void Foam::WallFaceBase<Derived>::transform
|
||||
inline void Foam::wallFace::transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
// Note that distSqr_ is not affected by crossing an interface
|
||||
transform.transformPosition(points_, points_);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::updateCell
|
||||
inline bool Foam::wallFace::equal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallFaceBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.cellCentres()[thisCelli],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallFaceBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const WallFaceBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallFaceBase<Derived>::equal
|
||||
(
|
||||
const WallFaceBase<Derived>& rhs,
|
||||
const wallFace& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
@ -281,20 +186,18 @@ inline bool Foam::WallFaceBase<Derived>::equal
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline bool Foam::WallFaceBase<Derived>::operator==
|
||||
inline bool Foam::wallFace::operator==
|
||||
(
|
||||
const Foam::WallFaceBase<Derived>& rhs
|
||||
const Foam::wallFace& rhs
|
||||
) const
|
||||
{
|
||||
return points() == rhs.points();
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline bool Foam::WallFaceBase<Derived>::operator!=
|
||||
inline bool Foam::wallFace::operator!=
|
||||
(
|
||||
const Foam::WallFaceBase<Derived>& rhs
|
||||
const Foam::wallFace& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
@ -303,15 +206,13 @@ inline bool Foam::WallFaceBase<Derived>::operator!=
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const WallFaceBase<Derived>& w)
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const wallFace& w)
|
||||
{
|
||||
return os << w.points() << token::SPACE << w.distSqr();
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, WallFaceBase<Derived>& w)
|
||||
Foam::Istream& Foam::operator>>(Istream& is, wallFace& w)
|
||||
{
|
||||
return is >> w.points() >> w.distSqr();
|
||||
}
|
||||
@ -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
|
||||
@ -45,24 +45,18 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class transformer;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class Derived>
|
||||
class WallPointBase;
|
||||
template<class Derived>
|
||||
Ostream& operator<<(Ostream&, const WallPointBase<Derived>&);
|
||||
template<class Derived>
|
||||
Istream& operator>>(Istream&, WallPointBase<Derived>&);
|
||||
class wallPoint;
|
||||
Ostream& operator<<(Ostream&, const wallPoint&);
|
||||
Istream& operator>>(Istream&, wallPoint&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class WallPointBase Declaration
|
||||
Class wallPoint Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Derived>
|
||||
class WallPointBase
|
||||
class wallPoint
|
||||
{
|
||||
// Private Data
|
||||
|
||||
@ -78,13 +72,13 @@ protected:
|
||||
// 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.
|
||||
// is nearer pt. Return true if w2 is closer to point, false
|
||||
// otherwise.
|
||||
template<class TrackingData>
|
||||
inline bool update
|
||||
(
|
||||
const point&,
|
||||
const WallPointBase<Derived>& w2,
|
||||
const wallPoint& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
@ -95,13 +89,13 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline WallPointBase();
|
||||
inline wallPoint();
|
||||
|
||||
//- Construct from origin, distance
|
||||
inline WallPointBase(const point& origin, const scalar distSqr);
|
||||
inline wallPoint(const point& origin, const scalar distSqr);
|
||||
|
||||
//- Construct from face, distance
|
||||
inline WallPointBase
|
||||
inline wallPoint
|
||||
(
|
||||
const face& f,
|
||||
const pointField& ps,
|
||||
@ -137,8 +131,7 @@ public:
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const WallPointBase<Derived>&,
|
||||
const wallPoint&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
@ -147,102 +140,32 @@ public:
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face.
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallPointBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallPointBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face.
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const WallPointBase<Derived>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Same (like operator==)
|
||||
template<class TrackingData>
|
||||
inline bool equal
|
||||
(
|
||||
const WallPointBase<Derived>&,
|
||||
const wallPoint&,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
inline bool operator==(const WallPointBase<Derived>&) const;
|
||||
inline bool operator!=(const WallPointBase<Derived>&) const;
|
||||
inline bool operator==(const wallPoint&) const;
|
||||
inline bool operator!=(const wallPoint&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <Derived>
|
||||
(
|
||||
Ostream&,
|
||||
const WallPointBase<Derived>&
|
||||
);
|
||||
|
||||
friend Istream& operator>> <Derived>
|
||||
(
|
||||
Istream&,
|
||||
WallPointBase<Derived>&
|
||||
);
|
||||
inline friend Ostream& operator<<(Ostream&, const wallPoint&);
|
||||
inline friend Istream& operator>>(Istream&, wallPoint&);
|
||||
};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class wallPoint Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class wallPoint
|
||||
:
|
||||
public WallPointBase<wallPoint>
|
||||
{
|
||||
public:
|
||||
|
||||
using WallPointBase<wallPoint>::WallPointBase;
|
||||
|
||||
template<class Derived> using type = WallPointBase<Derived>;
|
||||
};
|
||||
|
||||
|
||||
//- Data associated with wallPoint type are contiguous
|
||||
template<>
|
||||
inline bool contiguous<wallPoint>()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
@ -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
|
||||
@ -24,18 +24,16 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "wallPoint.H"
|
||||
#include "polyMesh.H"
|
||||
#include "transformer.H"
|
||||
#include "SubField.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::update
|
||||
inline bool Foam::wallPoint::update
|
||||
(
|
||||
const point& pt,
|
||||
const WallPointBase<Derived>& w2,
|
||||
const wallPoint& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
@ -69,16 +67,14 @@ inline bool Foam::WallPointBase<Derived>::update
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallPointBase<Derived>::WallPointBase()
|
||||
inline Foam::wallPoint::wallPoint()
|
||||
:
|
||||
origin_(point::max),
|
||||
distSqr_(-great)
|
||||
{}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallPointBase<Derived>::WallPointBase
|
||||
inline Foam::wallPoint::wallPoint
|
||||
(
|
||||
const point& origin,
|
||||
const scalar distSqr
|
||||
@ -89,8 +85,7 @@ inline Foam::WallPointBase<Derived>::WallPointBase
|
||||
{}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::WallPointBase<Derived>::WallPointBase
|
||||
inline Foam::wallPoint::wallPoint
|
||||
(
|
||||
const face& f,
|
||||
const pointField& points,
|
||||
@ -105,86 +100,63 @@ inline Foam::WallPointBase<Derived>::WallPointBase
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline const Foam::point& Foam::WallPointBase<Derived>::origin() const
|
||||
inline const Foam::point& Foam::wallPoint::origin() const
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::point& Foam::WallPointBase<Derived>::origin()
|
||||
inline Foam::point& Foam::wallPoint::origin()
|
||||
{
|
||||
return origin_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::scalar Foam::WallPointBase<Derived>::distSqr() const
|
||||
inline Foam::scalar Foam::wallPoint::distSqr() const
|
||||
{
|
||||
return distSqr_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline Foam::scalar& Foam::WallPointBase<Derived>::distSqr()
|
||||
inline Foam::scalar& Foam::wallPoint::distSqr()
|
||||
{
|
||||
return distSqr_;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline Foam::scalar Foam::WallPointBase<Derived>::dist(TrackingData& td) const
|
||||
inline Foam::scalar Foam::wallPoint::dist(TrackingData& td) const
|
||||
{
|
||||
return valid(td) ? sqrt(distSqr_) : great;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::valid(TrackingData& td) const
|
||||
inline bool Foam::wallPoint::valid(TrackingData& td) const
|
||||
{
|
||||
return distSqr_ > -small;
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::sameGeometry
|
||||
inline bool Foam::wallPoint::sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const WallPointBase<Derived>& w2,
|
||||
const wallPoint& w2,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
scalar diff = mag(distSqr() - w2.distSqr());
|
||||
const scalar diff = mag(distSqr() - w2.distSqr());
|
||||
|
||||
if (diff < small)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((distSqr() > small) && ((diff/distSqr()) < tol))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return
|
||||
diff < small
|
||||
|| ((distSqr() > small) && (diff/distSqr() < tol));
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline void Foam::WallPointBase<Derived>::transform
|
||||
inline void Foam::wallPoint::transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
)
|
||||
@ -194,79 +166,10 @@ inline void Foam::WallPointBase<Derived>::transform
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::updateCell
|
||||
inline bool Foam::wallPoint::equal
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const WallPointBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.cellCentres()[thisCelli],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const WallPointBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const WallPointBase<Derived>& neighbourWallInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
return
|
||||
static_cast<Derived&>(*this).update
|
||||
(
|
||||
mesh.faceCentres()[thisFacei],
|
||||
neighbourWallInfo,
|
||||
tol,
|
||||
td
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::WallPointBase<Derived>::equal
|
||||
(
|
||||
const WallPointBase<Derived>& rhs,
|
||||
const wallPoint& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
@ -276,20 +179,18 @@ inline bool Foam::WallPointBase<Derived>::equal
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
inline bool Foam::WallPointBase<Derived>::operator==
|
||||
inline bool Foam::wallPoint::operator==
|
||||
(
|
||||
const Foam::WallPointBase<Derived>& rhs
|
||||
const Foam::wallPoint& rhs
|
||||
) const
|
||||
{
|
||||
return origin() == rhs.origin();
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
inline bool Foam::WallPointBase<Derived>::operator!=
|
||||
inline bool Foam::wallPoint::operator!=
|
||||
(
|
||||
const Foam::WallPointBase<Derived>& rhs
|
||||
const Foam::wallPoint& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
@ -298,15 +199,13 @@ inline bool Foam::WallPointBase<Derived>::operator!=
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Derived>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const WallPointBase<Derived>& w)
|
||||
inline Foam::Ostream& Foam::operator<<(Ostream& os, const wallPoint& w)
|
||||
{
|
||||
return os << w.origin() << token::SPACE << w.distSqr();
|
||||
}
|
||||
|
||||
|
||||
template<class Derived>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, WallPointBase<Derived>& w)
|
||||
inline Foam::Istream& Foam::operator>>(Istream& is, wallPoint& w)
|
||||
{
|
||||
return is >> w.origin() >> w.distSqr();
|
||||
}
|
||||
@ -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,6 +26,7 @@ License
|
||||
#include "patchDistWave.H"
|
||||
#include "FaceCellWave.H"
|
||||
#include "wallPoint.H"
|
||||
#include "WallInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,18 +73,18 @@ Foam::label Foam::patchDistWave::wave
|
||||
)
|
||||
{
|
||||
// Initialise changedFacesInfo to face centres on patches
|
||||
List<wallPoint> changedFacesInfo(changedFaces.size());
|
||||
List<WallInfo<wallPoint>> changedFacesInfo(changedFaces.size());
|
||||
forAll(changedFaces, changedFacei)
|
||||
{
|
||||
const label facei = changedFaces[changedFacei];
|
||||
|
||||
changedFacesInfo[changedFacei] =
|
||||
wallPoint(mesh.faceCentres()[facei], scalar(0));
|
||||
WallInfo<wallPoint>(mesh.faceCentres()[facei], scalar(0));
|
||||
}
|
||||
|
||||
// Do calculate patch distance by 'growing' from faces.
|
||||
List<wallPoint> faceInfo(mesh.nFaces()), cellInfo(mesh.nCells());
|
||||
FaceCellWave<wallPoint> wave
|
||||
List<WallInfo<wallPoint>> faceInfo(mesh.nFaces()), cellInfo(mesh.nCells());
|
||||
FaceCellWave<WallInfo<wallPoint>> wave
|
||||
(
|
||||
mesh,
|
||||
changedFaces,
|
||||
|
||||
Reference in New Issue
Block a user