/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. \\/ 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \*---------------------------------------------------------------------------*/ #include "processorFvPatchField.H" #include "processorFvPatch.H" #include "IPstream.H" #include "OPstream.H" #include "demandDrivenData.H" #include "transformField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF ) : coupledFvPatchField(p, iF), procPatch_(refCast(p)) {} template processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF, const Field& f ) : coupledFvPatchField(p, iF, f), procPatch_(refCast(p)) {} // Construct by mapping given processorFvPatchField template processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : coupledFvPatchField(ptf, p, iF, mapper), procPatch_(refCast(p)) { if (!isType(this->patch())) { FatalErrorIn ( "processorFvPatchField::processorFvPatchField\n" "(\n" " const processorFvPatchField& ptf,\n" " const fvPatch& p,\n" " const DimensionedField& iF,\n" " const fvPatchFieldMapper& mapper\n" ")\n" ) << "\n patch type '" << p.type() << "' not constraint type '" << typeName << "'" << "\n for patch " << p.name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalIOError); } } template processorFvPatchField::processorFvPatchField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : coupledFvPatchField(p, iF, dict), procPatch_(refCast(p)) { if (!isType(p)) { FatalIOErrorIn ( "processorFvPatchField::processorFvPatchField\n" "(\n" " const fvPatch& p,\n" " const Field& field,\n" " const dictionary& dict\n" ")\n", dict ) << "\n patch type '" << p.type() << "' not constraint type '" << typeName << "'" << "\n for patch " << p.name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalIOError); } } template processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf ) : processorLduInterfaceField(), coupledFvPatchField(ptf), procPatch_(refCast(ptf.patch())) {} template processorFvPatchField::processorFvPatchField ( const processorFvPatchField& ptf, const DimensionedField& iF ) : coupledFvPatchField(ptf, iF), procPatch_(refCast(ptf.patch())) {} // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // template processorFvPatchField::~processorFvPatchField() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template tmp > processorFvPatchField::patchNeighbourField() const { return *this; } template void processorFvPatchField::initEvaluate ( const Pstream::commsTypes commsType ) { if (Pstream::parRun()) { procPatch_.compressedSend(commsType, this->patchInternalField()()); } } template void processorFvPatchField::evaluate ( const Pstream::commsTypes commsType ) { if (Pstream::parRun()) { procPatch_.compressedReceive(commsType, *this); if (doTransform()) { transform(*this, procPatch_.forwardT(), *this); } } } template tmp > processorFvPatchField::snGrad() const { return this->patch().deltaCoeffs()*(*this - this->patchInternalField()); } template void processorFvPatchField::initInterfaceMatrixUpdate ( const scalarField& psiInternal, scalarField&, const lduMatrix&, const scalarField&, const direction, const Pstream::commsTypes commsType ) const { procPatch_.compressedSend ( commsType, this->patch().patchInternalField(psiInternal)() ); } template void processorFvPatchField::updateInterfaceMatrix ( const scalarField&, scalarField& result, const lduMatrix&, const scalarField& coeffs, const direction cmpt, const Pstream::commsTypes commsType ) const { scalarField pnf ( procPatch_.compressedReceive(commsType, this->size())() ); // Transform according to the transformation tensor transformCoupleField(pnf, cmpt); // Multiply the field by coefficients and add into the result const unallocLabelList& faceCells = this->patch().faceCells(); forAll(faceCells, elemI) { result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //