ENH: replace patchField specializations with if constexpr
- simplifies future code changes STYLE: noexcept access for wedgePatch methods
This commit is contained in:
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedgePointPatch_H
|
||||
#define wedgePointPatch_H
|
||||
#ifndef Foam_wedgePointPatch_H
|
||||
#define Foam_wedgePointPatch_H
|
||||
|
||||
#include "facePointPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
@ -53,9 +53,9 @@ class wedgePointPatch
|
||||
:
|
||||
public facePointPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Local reference cast into the symmetryPlane patch
|
||||
//- Local reference cast into the wedgePolyPatch patch
|
||||
const wedgePolyPatch& wedgePolyPatch_;
|
||||
|
||||
|
||||
@ -120,8 +120,8 @@ public:
|
||||
pointConstraint&
|
||||
) const;
|
||||
|
||||
//- Return symmetry plane normal
|
||||
const vector& n() const
|
||||
//- Return the normal to the patch
|
||||
const vector& n() const noexcept
|
||||
{
|
||||
return wedgePolyPatch_.n();
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedgePolyPatch_H
|
||||
#define wedgePolyPatch_H
|
||||
#ifndef Foam_wedgePolyPatch_H
|
||||
#define Foam_wedgePolyPatch_H
|
||||
|
||||
#include "polyPatch.H"
|
||||
|
||||
@ -52,7 +52,7 @@ class wedgePolyPatch
|
||||
:
|
||||
public polyPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Axis of the wedge
|
||||
vector axis_;
|
||||
@ -173,45 +173,27 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- Return axis of the wedge
|
||||
const vector& axis() const
|
||||
{
|
||||
return axis_;
|
||||
}
|
||||
//- Return axis of the wedge
|
||||
const vector& axis() const noexcept { return axis_; }
|
||||
|
||||
//- Return plane normal between the wedge boundaries
|
||||
const vector& centreNormal() const
|
||||
{
|
||||
return centreNormal_;
|
||||
}
|
||||
//- Return plane normal between the wedge boundaries
|
||||
const vector& centreNormal() const noexcept { return centreNormal_; }
|
||||
|
||||
//- Return the normal to the patch
|
||||
const vector& n() const
|
||||
{
|
||||
return n_;
|
||||
}
|
||||
//- Return the normal to the patch
|
||||
const vector& n() const noexcept { return n_; }
|
||||
|
||||
//- Return the cosine of the wedge angle
|
||||
scalar cosAngle() const
|
||||
{
|
||||
return cosAngle_;
|
||||
}
|
||||
//- Return the cosine of the wedge angle
|
||||
scalar cosAngle() const noexcept { return cosAngle_; }
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensor& faceT() const
|
||||
{
|
||||
return faceT_;
|
||||
}
|
||||
//- Return face transformation tensor
|
||||
const tensor& faceT() const noexcept { return faceT_; }
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& cellT() const
|
||||
{
|
||||
return cellT_;
|
||||
}
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& cellT() const noexcept { return cellT_; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@ $(faPatchFields)/faPatchField/faPatchFieldBase.C
|
||||
$(faPatchFields)/faPatchField/faPatchFields.C
|
||||
|
||||
basicFaPatchFields = $(faPatchFields)/basic
|
||||
$(basicFaPatchFields)/basicSymmetry/basicSymmetryFaPatchFields.C
|
||||
$(basicFaPatchFields)/calculated/calculatedFaPatchFields.C
|
||||
$(basicFaPatchFields)/extrapolatedCalculated/extrapolatedCalculatedFaPatchFields.C
|
||||
$(basicFaPatchFields)/coupled/coupledFaPatchFields.C
|
||||
|
||||
@ -93,16 +93,12 @@ Foam::wedgeFaPatch::wedgeFaPatch
|
||||
<< this->name() << exit(FatalError);
|
||||
}
|
||||
|
||||
const auto* wedgePtr = isA<wedgePolyPatch>
|
||||
wedgePolyPatchPtr_ = isA<wedgePolyPatch>
|
||||
(
|
||||
bm.mesh().mesh().boundaryMesh()[ngbPolyPatchIndex()]
|
||||
);
|
||||
|
||||
if (wedgePtr)
|
||||
{
|
||||
wedgePolyPatchPtr_ = wedgePtr;
|
||||
}
|
||||
else
|
||||
if (!wedgePolyPatchPtr_)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Neighbour polyPatch is not of type "
|
||||
|
||||
@ -77,7 +77,9 @@ public:
|
||||
//- Runtime type information
|
||||
TypeName("wedge");
|
||||
|
||||
//- Construct from dictionary
|
||||
//- Construct from dictionary.
|
||||
// Fatal if ngbPolyPatchIndex is not defined
|
||||
// or does not correspond to a wedgePolyPatch
|
||||
wedgeFaPatch
|
||||
(
|
||||
const word& name,
|
||||
@ -97,25 +99,25 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return axis of the wedge
|
||||
const vector& axis() const
|
||||
const vector& axis() const noexcept
|
||||
{
|
||||
return wedgePolyPatchPtr_->axis();
|
||||
}
|
||||
|
||||
//- Return plane normal between the wedge boundaries
|
||||
const vector& centreNormal() const
|
||||
const vector& centreNormal() const noexcept
|
||||
{
|
||||
return wedgePolyPatchPtr_->centreNormal();
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensor& edgeT() const
|
||||
const tensor& edgeT() const noexcept
|
||||
{
|
||||
return wedgePolyPatchPtr_->faceT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& faceT() const
|
||||
const tensor& faceT() const noexcept
|
||||
{
|
||||
return wedgePolyPatchPtr_->cellT();
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,13 +86,25 @@ template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::basicSymmetryFaPatchField<Type>::snGrad() const
|
||||
{
|
||||
const vectorField nHat(this->patch().edgeNormals());
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<vectorField> nHat = this->patch().edgeNormals();
|
||||
|
||||
return
|
||||
(
|
||||
transform(I - 2.0*sqr(nHat), this->patchInternalField())
|
||||
- this->patchInternalField()
|
||||
)*(this->patch().deltaCoeffs()/2.0);
|
||||
const auto& dc = this->patch().deltaCoeffs();
|
||||
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
return
|
||||
(
|
||||
(0.5*dc)
|
||||
* (transform(I - 2.0*sqr(nHat), pif) - pif)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,14 +116,22 @@ void Foam::basicSymmetryFaPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
const vectorField nHat(this->patch().edgeNormals());
|
||||
Field<Type>::operator=
|
||||
(
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<vectorField> nHat = this->patch().edgeNormals();
|
||||
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
Field<Type>::operator=
|
||||
(
|
||||
this->patchInternalField()
|
||||
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
|
||||
)/2.0
|
||||
);
|
||||
0.5*(pif + transform(I - 2.0*sqr(nHat), pif))
|
||||
);
|
||||
}
|
||||
|
||||
transformFaPatchField<Type>::evaluate();
|
||||
}
|
||||
|
||||
@ -143,18 +143,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> basicSymmetryFaPatchField<scalar>::snGrad() const;
|
||||
|
||||
template<>
|
||||
void basicSymmetryFaPatchField<scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicSymmetryFaPatchField.H"
|
||||
#include "areaFields.H"
|
||||
|
||||
// No run-time selection
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::basicSymmetryFaPatchField<Foam::scalar>::snGrad() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::basicSymmetryFaPatchField<Foam::scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
if (!updated())
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
scalarField::operator=(patchInternalField());
|
||||
transformFaPatchField<scalar>::evaluate();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -37,7 +37,7 @@ Foam::transformFaPatchField<Type>::transformFaPatchField
|
||||
const DimensionedField<Type, areaMesh>& iF
|
||||
)
|
||||
:
|
||||
faPatchField<Type>(p, iF)
|
||||
faPatchField<Type>(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -148,12 +148,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> transformFaPatchField<scalar>::gradientInternalCoeffs() const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -37,14 +37,4 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::transformFaPatchField<Foam::scalar>::gradientInternalCoeffs() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -104,13 +104,25 @@ Foam::wedgeFaPatchField<Type>::wedgeFaPatchField
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::wedgeFaPatchField<Type>::snGrad() const
|
||||
{
|
||||
const Field<Type> pif (this->patchInternalField());
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type: treat like zero-gradient
|
||||
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& rot = refCast<const wedgeFaPatch>(this->patch()).faceT();
|
||||
|
||||
return
|
||||
(
|
||||
transform(refCast<const wedgeFaPatch>(this->patch()).faceT(), pif)
|
||||
- pif
|
||||
)*(0.5*this->patch().deltaCoeffs());
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
const auto& dc = this->patch().deltaCoeffs();
|
||||
|
||||
return
|
||||
(
|
||||
(0.5*dc)
|
||||
* (transform(rot, pif) - pif)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,14 +134,20 @@ void Foam::wedgeFaPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
faPatchField<Type>::operator==
|
||||
(
|
||||
transform
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type: treat like zero-gradient
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& rot = refCast<const wedgeFaPatch>(this->patch()).edgeT();
|
||||
|
||||
faPatchField<Type>::operator==
|
||||
(
|
||||
refCast<const wedgeFaPatch>(this->patch()).edgeT(),
|
||||
this->patchInternalField()
|
||||
)
|
||||
);
|
||||
transform(rot, this->patchInternalField())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -133,18 +133,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> wedgeFaPatchField<scalar>::snGrad() const;
|
||||
|
||||
template<>
|
||||
void wedgeFaPatchField<scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -36,26 +36,4 @@ namespace Foam
|
||||
makeFaPatchFields(wedge);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::wedgeFaPatchField<Foam::scalar>::snGrad() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::wedgeFaPatchField<Foam::scalar>::evaluate(const Pstream::commsTypes)
|
||||
{
|
||||
if (!updated())
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
this->operator==(patchInternalField());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -128,7 +128,6 @@ $(fvPatchFields)/fvPatchField/fvPatchFieldBase.C
|
||||
$(fvPatchFields)/fvPatchField/fvPatchFields.C
|
||||
|
||||
basicFvPatchFields = $(fvPatchFields)/basic
|
||||
$(basicFvPatchFields)/basicSymmetry/basicSymmetryFvPatchFields.C
|
||||
$(basicFvPatchFields)/calculated/calculatedFvPatchFields.C
|
||||
$(basicFvPatchFields)/extrapolatedCalculated/extrapolatedCalculatedFvPatchFields.C
|
||||
$(basicFvPatchFields)/coupled/coupledFvPatchFields.C
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,13 +86,25 @@ template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::basicSymmetryFvPatchField<Type>::snGrad() const
|
||||
{
|
||||
tmp<vectorField> nHat = this->patch().nf();
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<vectorField> nHat = this->patch().nf();
|
||||
|
||||
const Field<Type> iF(this->patchInternalField());
|
||||
const auto& dc = this->patch().deltaCoeffs();
|
||||
|
||||
return
|
||||
(transform(I - 2.0*sqr(nHat), iF) - iF)
|
||||
*(this->patch().deltaCoeffs()/2.0);
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
return
|
||||
(
|
||||
(0.5*dc)
|
||||
* (transform(I - 2.0*sqr(nHat), pif) - pif)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -103,14 +116,22 @@ void Foam::basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
tmp<vectorField> nHat = this->patch().nf();
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp<vectorField> nHat = this->patch().nf();
|
||||
|
||||
const Field<Type> iF(this->patchInternalField());
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
Field<Type>::operator=
|
||||
(
|
||||
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
|
||||
);
|
||||
Field<Type>::operator=
|
||||
(
|
||||
0.5*(pif + transform(I - 2.0*sqr(nHat), pif))
|
||||
);
|
||||
}
|
||||
|
||||
transformFvPatchField<Type>::evaluate();
|
||||
}
|
||||
|
||||
@ -139,18 +139,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> basicSymmetryFvPatchField<scalar>::snGrad() const;
|
||||
|
||||
template<>
|
||||
void basicSymmetryFvPatchField<scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
-------------------------------------------------------------------------------
|
||||
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 "basicSymmetryFvPatchField.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// No run-time selection
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::basicSymmetryFvPatchField<Foam::scalar>::snGrad() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::basicSymmetryFvPatchField<Foam::scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
if (!updated())
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
scalarField::operator=(patchInternalField());
|
||||
transformFvPatchField<scalar>::evaluate();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -157,18 +157,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> transformFvPatchField<scalar>::valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const;
|
||||
|
||||
template<>
|
||||
tmp<scalarField> transformFvPatchField<scalar>::gradientInternalCoeffs() const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -37,25 +37,4 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::transformFvPatchField<Foam::scalar>::valueInternalCoeffs
|
||||
(
|
||||
const tmp<scalarField>&
|
||||
) const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), 1.0);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::transformFvPatchField<Foam::scalar>::gradientInternalCoeffs() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +28,6 @@ License
|
||||
|
||||
#include "symmetryPlaneFvPatchField.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -120,13 +120,25 @@ template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::symmetryPlaneFvPatchField<Type>::snGrad() const
|
||||
{
|
||||
vector nHat(symmetryPlanePatch_.n());
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type: treat like zero-gradient
|
||||
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
|
||||
}
|
||||
else
|
||||
{
|
||||
const symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n()));
|
||||
|
||||
const Field<Type> iF(this->patchInternalField());
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
return
|
||||
(transform(I - 2.0*sqr(nHat), iF) - iF)
|
||||
*(this->patch().deltaCoeffs()/2.0);
|
||||
const auto& dc = this->patch().deltaCoeffs();
|
||||
|
||||
return
|
||||
(
|
||||
(0.5*dc)
|
||||
* (transform(rot, pif) - pif)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,14 +150,19 @@ void Foam::symmetryPlaneFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
vector nHat(symmetryPlanePatch_.n());
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type: treat like zero-gradient
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
const symmTensor rot(I - 2.0*sqr(symmetryPlanePatch_.n()));
|
||||
|
||||
const Field<Type> iF(this->patchInternalField());
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
Field<Type>::operator=
|
||||
(
|
||||
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
|
||||
);
|
||||
Field<Type>::operator=(0.5*(pif + transform(rot, pif)));
|
||||
}
|
||||
|
||||
transformFvPatchField<Type>::evaluate();
|
||||
}
|
||||
|
||||
@ -49,8 +49,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef symmetryPlaneFvPatchField_H
|
||||
#define symmetryPlaneFvPatchField_H
|
||||
#ifndef Foam_symmetryPlaneFvPatchField_H
|
||||
#define Foam_symmetryPlaneFvPatchField_H
|
||||
|
||||
#include "basicSymmetryFvPatchField.H"
|
||||
#include "symmetryPlaneFvPatch.H"
|
||||
@ -61,7 +61,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class symmetryPlaneFvPatchField Declaration
|
||||
Class symmetryPlaneFvPatchField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
@ -153,18 +153,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> symmetryPlaneFvPatchField<scalar>::snGrad() const;
|
||||
|
||||
template<>
|
||||
void symmetryPlaneFvPatchField<scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -37,30 +37,4 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::symmetryPlaneFvPatchField<Foam::scalar>::snGrad() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::symmetryPlaneFvPatchField<Foam::scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
if (!updated())
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
scalarField::operator=(patchInternalField());
|
||||
transformFvPatchField<scalar>::evaluate();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2024 OpenCFD Ltd.
|
||||
Copyright (C) 2024-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -119,12 +119,25 @@ Foam::wedgeFvPatchField<Type>::wedgeFvPatchField
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>> Foam::wedgeFvPatchField<Type>::snGrad() const
|
||||
{
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
return tmp<Field<Type>>::New(this->size(), Foam::zero{});
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& rot = refCast<const wedgeFvPatch>(this->patch()).cellT();
|
||||
|
||||
return
|
||||
(
|
||||
transform(refCast<const wedgeFvPatch>(this->patch()).cellT(), pif) - pif
|
||||
)*(0.5*this->patch().deltaCoeffs());
|
||||
const Field<Type> pif(this->patchInternalField());
|
||||
|
||||
const auto& dc = this->patch().deltaCoeffs();
|
||||
|
||||
return
|
||||
(
|
||||
(0.5*dc)
|
||||
* (transform(rot, pif) - pif)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -136,14 +149,20 @@ void Foam::wedgeFvPatchField<Type>::evaluate(const Pstream::commsTypes)
|
||||
this->updateCoeffs();
|
||||
}
|
||||
|
||||
fvPatchField<Type>::operator==
|
||||
(
|
||||
transform
|
||||
if constexpr (!is_rotational_vectorspace_v<Type>)
|
||||
{
|
||||
// Rotational-invariant type : treat like zero-gradient
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto& rot = refCast<const wedgeFvPatch>(this->patch()).faceT();
|
||||
|
||||
fvPatchField<Type>::operator==
|
||||
(
|
||||
refCast<const wedgeFvPatch>(this->patch()).faceT(),
|
||||
this->patchInternalField()
|
||||
)
|
||||
);
|
||||
transform(rot, this->patchInternalField())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
//- Return gradient at boundary
|
||||
virtual tmp<Field<Type>> snGrad() const;
|
||||
@ -154,18 +154,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * Template Specialisations * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
tmp<scalarField> wedgeFvPatchField<scalar>::snGrad() const;
|
||||
|
||||
template<>
|
||||
void wedgeFvPatchField<scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -37,29 +37,4 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Specialisations * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::wedgeFvPatchField<Foam::scalar>::snGrad() const
|
||||
{
|
||||
return tmp<scalarField>::New(size(), Zero);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void Foam::wedgeFvPatchField<Foam::scalar>::evaluate
|
||||
(
|
||||
const Pstream::commsTypes
|
||||
)
|
||||
{
|
||||
if (!updated())
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
this->operator==(patchInternalField());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -33,23 +33,23 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(wedgeFvPatch, 0);
|
||||
addToRunTimeSelectionTable(fvPatch, wedgeFvPatch, polyPatch);
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
wedgeFvPatch::wedgeFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
|
||||
Foam::wedgeFvPatch::wedgeFvPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const fvBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
fvPatch(patch, bm),
|
||||
wedgePolyPatch_(refCast<const wedgePolyPatch>(patch))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef wedgeFvPatch_H
|
||||
#define wedgeFvPatch_H
|
||||
#ifndef Foam_wedgeFvPatch_H
|
||||
#define Foam_wedgeFvPatch_H
|
||||
|
||||
#include "fvPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
@ -53,7 +53,7 @@ class wedgeFvPatch
|
||||
:
|
||||
public fvPatch
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
const wedgePolyPatch& wedgePolyPatch_;
|
||||
|
||||
@ -70,21 +70,21 @@ public:
|
||||
wedgeFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm);
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
// Access
|
||||
|
||||
//- Return face transformation tensor
|
||||
const tensor& faceT() const
|
||||
{
|
||||
return wedgePolyPatch_.faceT();
|
||||
}
|
||||
//- Return face transformation tensor
|
||||
const tensor& faceT() const noexcept
|
||||
{
|
||||
return wedgePolyPatch_.faceT();
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& cellT() const
|
||||
{
|
||||
return wedgePolyPatch_.cellT();
|
||||
}
|
||||
//- Return neighbour-cell transformation tensor
|
||||
const tensor& cellT() const noexcept
|
||||
{
|
||||
return wedgePolyPatch_.cellT();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user