/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-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 "jumpCyclicAMIFvPatchField.H" #include "transformField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField ( const fvPatch& p, const DimensionedField& iF ) : cyclicAMIFvPatchField(p, iF) {} template Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField ( const jumpCyclicAMIFvPatchField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : cyclicAMIFvPatchField(ptf, p, iF, mapper) {} template Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : cyclicAMIFvPatchField(p, iF, dict) { // Call this evaluation in derived classes //this->evaluate(Pstream::commsTypes::buffered); } template Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField ( const jumpCyclicAMIFvPatchField& ptf ) : cyclicAMIFvPatchField(ptf) {} template Foam::jumpCyclicAMIFvPatchField::jumpCyclicAMIFvPatchField ( const jumpCyclicAMIFvPatchField& ptf, const DimensionedField& iF ) : cyclicAMIFvPatchField(ptf, iF) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template Foam::tmp> Foam::jumpCyclicAMIFvPatchField::patchNeighbourField() const { const Field& iField = this->primitiveField(); const labelUList& nbrFaceCells = this->cyclicAMIPatch().cyclicAMIPatch().neighbPatch().faceCells(); Field pnf(iField, nbrFaceCells); tmp> tpnf; if (this->cyclicAMIPatch().applyLowWeightCorrection()) { tpnf = this->cyclicAMIPatch().interpolate ( pnf, this->patchInternalField()() ); } else { tpnf = this->cyclicAMIPatch().interpolate(pnf); } if (this->doTransform()) { transform(tpnf.ref(), this->forwardT(), tpnf()); } tmp> tjf = jump(); if (!this->cyclicAMIPatch().owner()) { tjf = -tjf; } return tpnf - tjf; } template void Foam::jumpCyclicAMIFvPatchField::initEvaluate ( const Pstream::commsTypes commsType ) { // Bypass cyclicAMI to avoid caching coupledFvPatchField::initEvaluate(commsType); } template void Foam::jumpCyclicAMIFvPatchField::evaluate ( const Pstream::commsTypes commsType ) { // Bypass cyclicAMI to avoid caching coupledFvPatchField::evaluate(commsType); } template void Foam::jumpCyclicAMIFvPatchField::initInterfaceMatrixUpdate ( solveScalarField& result, const bool add, const lduAddressing& lduAddr, const label patchId, const solveScalarField& psiInternal, const scalarField& coeffs, const direction cmpt, const Pstream::commsTypes commsType ) const { // Bypass cyclicAMI to avoid caching coupledFvPatchField::initInterfaceMatrixUpdate ( result, add, lduAddr, patchId, psiInternal, coeffs, cmpt, commsType ); } template void Foam::jumpCyclicAMIFvPatchField::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::jumpCyclicAMIFvPatchField::initInterfaceMatrixUpdate ( Field& result, const bool add, const lduAddressing& lduAddr, const label patchId, const Field& psiInternal, const scalarField& coeffs, const Pstream::commsTypes commsType ) const { // Bypass cyclicAMI to avoid caching coupledFvPatchField::initInterfaceMatrixUpdate ( result, add, lduAddr, patchId, psiInternal, coeffs, commsType ); } template void Foam::jumpCyclicAMIFvPatchField::updateInterfaceMatrix ( Field& result, const bool add, const lduAddressing& lduAddr, const label patchId, const Field& psiInternal, const scalarField& coeffs, const Pstream::commsTypes ) const { const labelUList& nbrFaceCells = lduAddr.patchAddr ( this->cyclicAMIPatch().neighbPatchID() ); Field pnf(psiInternal, nbrFaceCells); if (this->cyclicAMIPatch().applyLowWeightCorrection()) { pnf = this->cyclicAMIPatch().interpolate ( pnf, this->patchInternalField()() ); } else { pnf = this->cyclicAMIPatch().interpolate(pnf); } // only apply jump to original field if (&psiInternal == &this->primitiveField()) { Field jf(this->jump()); if (!this->cyclicAMIPatch().owner()) { jf *= -1.0; } pnf -= jf; } // 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); } // ************************************************************************* //