/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "basicSymmetryFvPatchField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::basicSymmetryFvPatchField::basicSymmetryFvPatchField
(
const fvPatch& p,
const DimensionedField& iF
)
:
transformFvPatchField(p, iF)
{}
template
Foam::basicSymmetryFvPatchField::basicSymmetryFvPatchField
(
const fvPatch& p,
const DimensionedField& iF,
const dictionary& dict
)
:
transformFvPatchField(p, iF, dict)
{
this->evaluate();
}
template
Foam::basicSymmetryFvPatchField::basicSymmetryFvPatchField
(
const basicSymmetryFvPatchField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fieldMapper& mapper
)
:
transformFvPatchField(ptf, p, iF, mapper)
{}
template
Foam::basicSymmetryFvPatchField::basicSymmetryFvPatchField
(
const basicSymmetryFvPatchField& ptf,
const DimensionedField& iF
)
:
transformFvPatchField(ptf, iF)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
Foam::tmp>
Foam::basicSymmetryFvPatchField::snGrad() const
{
tmp nHat = patch().nf();
const Field iF(patchInternalField());
return
(transform(I - 2.0*sqr(nHat), iF) - iF)
*(patch().deltaCoeffs()/2.0);
}
template
void Foam::basicSymmetryFvPatchField::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
tmp nHat = patch().nf();
const Field iF(patchInternalField());
Field::operator=
(
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
);
transformFvPatchField::evaluate();
}
template
Foam::tmp>
Foam::basicSymmetryFvPatchField::snGradTransformDiag() const
{
const vectorField nHat(patch().nf());
vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X)));
diag.replace(vector::Y, mag(nHat.component(vector::Y)));
diag.replace(vector::Z, mag(nHat.component(vector::Z)));
return transformMask
(
pTraits::zero,
pow::rank>(diag)
);
}
// ************************************************************************* //