/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "basicSymmetryFaPatchField.H" #include "symmTransformField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::basicSymmetryFaPatchField::basicSymmetryFaPatchField ( const faPatch& p, const DimensionedField& iF ) : transformFaPatchField(p, iF) {} template Foam::basicSymmetryFaPatchField::basicSymmetryFaPatchField ( const basicSymmetryFaPatchField& ptf, const faPatch& p, const DimensionedField& iF, const faPatchFieldMapper& mapper ) : transformFaPatchField(ptf, p, iF, mapper) {} template Foam::basicSymmetryFaPatchField::basicSymmetryFaPatchField ( const faPatch& p, const DimensionedField& iF, const dictionary& dict ) : transformFaPatchField(p, iF, dict) { this->evaluate(); } template Foam::basicSymmetryFaPatchField::basicSymmetryFaPatchField ( const basicSymmetryFaPatchField& ptf, const DimensionedField& iF ) : transformFaPatchField(ptf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template Foam::tmp> Foam::basicSymmetryFaPatchField::snGrad() const { if constexpr (!is_rotational_vectorspace_v) { // Rotational-invariant type : treat like zero-gradient return tmp>::New(this->size(), Foam::zero{}); } else { tmp nHat = this->patch().edgeNormals(); const auto& dc = this->patch().deltaCoeffs(); const Field pif(this->patchInternalField()); return ( (0.5*dc) * (transform(I - 2.0*sqr(nHat), pif) - pif) ); } } template void Foam::basicSymmetryFaPatchField::evaluate(const Pstream::commsTypes) { if (!this->updated()) { this->updateCoeffs(); } if constexpr (!is_rotational_vectorspace_v) { // Rotational-invariant type : treat like zero-gradient this->extrapolateInternal(); } else { tmp nHat = this->patch().edgeNormals(); const Field pif(this->patchInternalField()); Field::operator= ( 0.5*(pif + transform(I - 2.0*sqr(nHat), pif)) ); } transformFaPatchField::evaluate(); } template Foam::tmp> Foam::basicSymmetryFaPatchField::snGradTransformDiag() const { tmp diag(cmptMag(this->patch().edgeNormals())); return transformFieldMask(pow::rank>(diag)); } // ************************************************************************* //