/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2019-2024 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 "jumpCyclicFvPatchField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField& iF ) : cyclicFvPatchField(p, iF) {} template Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : cyclicFvPatchField(ptf, p, iF, mapper) {} template Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict, const bool needValue ) : cyclicFvPatchField(p, iF, dict, needValue) {} template Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf ) : cyclicFvPatchField(ptf) {} template Foam::jumpCyclicFvPatchField::jumpCyclicFvPatchField ( const jumpCyclicFvPatchField& ptf, const DimensionedField& iF ) : cyclicFvPatchField(ptf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::jumpCyclicFvPatchField::patchNeighbourField ( UList& pnf ) const { const Field& iField = this->primitiveField(); const labelUList& nbrFaceCells = this->cyclicPatch().neighbFvPatch().faceCells(); Field jf(this->jump()); if (!this->cyclicPatch().owner()) { jf *= -1.0; } if (this->doTransform()) { const auto& rot = this->forwardT()[0]; forAll(pnf, i) { pnf[i] = (transform(rot, iField[nbrFaceCells[i]]) - jf[i]); } } else { forAll(pnf, i) { pnf[i] = (iField[nbrFaceCells[i]] - jf[i]); } } } template Foam::tmp> Foam::jumpCyclicFvPatchField::patchNeighbourField() const { auto tpnf = tmp>::New(this->size()); this->patchNeighbourField(tpnf.ref()); return tpnf; } template void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix ( solveScalarField& result, const bool add, const lduAddressing& lduAddr, const label patchId, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt, const Pstream::commsTypes ) const { NotImplemented; } template void Foam::jumpCyclicFvPatchField::updateInterfaceMatrix ( Field& result, const bool add, const lduAddressing& lduAddr, const label patchId, const Field& psiInternal, const scalarField& coeffs, const Pstream::commsTypes ) const { Field pnf(this->size()); const labelUList& nbrFaceCells = lduAddr.patchAddr ( this->cyclicPatch().neighbPatchID() ); // only apply jump to original field if (&psiInternal == &this->primitiveField()) { Field jf(this->jump()); if (!this->cyclicPatch().owner()) { jf *= -1.0; } forAll(pnf, facei) { pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei]; } } else { forAll(pnf, facei) { pnf[facei] = psiInternal[nbrFaceCells[facei]]; } } // Transform according to the transformation tensors this->transformCoupleField(pnf); const labelUList& faceCells = lduAddr.patchAddr(patchId); // Multiply the field by coefficients and add into the result this->addToInternalField(result, !add, faceCells, coeffs, pnf); } // ************************************************************************* //