/*---------------------------------------------------------------------------*\ ========= | \\ / 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 "partialSlipFvPatchField.H" #include "symmTransformField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::partialSlipFvPatchField::partialSlipFvPatchField ( const fvPatch& p, const DimensionedField& iF ) : transformFvPatchField(p, iF), valueFraction_(p.size(), 1.0) {} template Foam::partialSlipFvPatchField::partialSlipFvPatchField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : transformFvPatchField(p, iF), valueFraction_("valueFraction", units::fraction, dict, p.size()) { evaluate(); } template Foam::partialSlipFvPatchField::partialSlipFvPatchField ( const partialSlipFvPatchField& ptf, const fvPatch& p, const DimensionedField& iF, const fieldMapper& mapper ) : transformFvPatchField(ptf, p, iF, mapper), valueFraction_(mapper(ptf.valueFraction_)) {} template Foam::partialSlipFvPatchField::partialSlipFvPatchField ( const partialSlipFvPatchField& ptf, const DimensionedField& iF ) : transformFvPatchField(ptf, iF), valueFraction_(ptf.valueFraction_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::partialSlipFvPatchField::map ( const fvPatchField& ptf, const fieldMapper& mapper ) { transformFvPatchField::map(ptf, mapper); const partialSlipFvPatchField& dmptf = refCast>(ptf); mapper(valueFraction_, dmptf.valueFraction_); } template void Foam::partialSlipFvPatchField::reset ( const fvPatchField& ptf ) { transformFvPatchField::reset(ptf); const partialSlipFvPatchField& dmptf = refCast>(ptf); valueFraction_.reset(dmptf.valueFraction_); } template Foam::tmp> Foam::partialSlipFvPatchField::snGrad() const { tmp nHat = patch().nf(); const Field pif(patchInternalField()); return ( (1.0 - valueFraction_)*transform(I - sqr(nHat), pif) - pif )*patch().deltaCoeffs(); } template void Foam::partialSlipFvPatchField::evaluate ( const Pstream::commsTypes ) { if (!this->updated()) { this->updateCoeffs(); } tmp nHat = patch().nf(); Field::operator= ( (1.0 - valueFraction_) *transform(I - sqr(nHat), patchInternalField()) ); transformFvPatchField::evaluate(); } template Foam::tmp> Foam::partialSlipFvPatchField::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 valueFraction_*pTraits::one + (1.0 - valueFraction_) *transformMask ( pTraits::zero, pow::rank>(diag) ); } template void Foam::partialSlipFvPatchField::write(Ostream& os) const { transformFvPatchField::write(os); writeEntry(os, "valueFraction", valueFraction_); } // ************************************************************************* //