OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

processorGAMGInterfaceField.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "processorGAMGInterfaceField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "lduMatrix.H"
00030 
00031 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035     defineTypeNameAndDebug(processorGAMGInterfaceField, 0);
00036     addToRunTimeSelectionTable
00037     (
00038         GAMGInterfaceField,
00039         processorGAMGInterfaceField,
00040         lduInterface
00041     );
00042 }
00043 
00044 
00045 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00046 
00047 Foam::processorGAMGInterfaceField::processorGAMGInterfaceField
00048 (
00049     const GAMGInterface& GAMGCp,
00050     const lduInterfaceField& fineInterface
00051 )
00052 :
00053     GAMGInterfaceField(GAMGCp, fineInterface),
00054     procInterface_(refCast<const processorGAMGInterface>(GAMGCp)),
00055     doTransform_(false),
00056     rank_(0)
00057 {
00058     const processorLduInterfaceField& p =
00059         refCast<const processorLduInterfaceField>(fineInterface);
00060 
00061     doTransform_ = p.doTransform();
00062     rank_ = p.rank();
00063 }
00064 
00065 
00066 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
00067 
00068 Foam::processorGAMGInterfaceField::~processorGAMGInterfaceField()
00069 {}
00070 
00071 
00072 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00073 
00074 void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
00075 (
00076     const scalarField& psiInternal,
00077     scalarField&,
00078     const lduMatrix&,
00079     const scalarField&,
00080     const direction,
00081     const Pstream::commsTypes commsType
00082 ) const
00083 {
00084     procInterface_.compressedSend
00085     (
00086         commsType,
00087         procInterface_.interfaceInternalField(psiInternal)()
00088     );
00089 }
00090 
00091 
00092 void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
00093 (
00094     const scalarField&,
00095     scalarField& result,
00096     const lduMatrix&,
00097     const scalarField& coeffs,
00098     const direction cmpt,
00099     const Pstream::commsTypes commsType
00100 ) const
00101 {
00102     scalarField pnf
00103     (
00104         procInterface_.compressedReceive<scalar>(commsType, coeffs.size())
00105     );
00106     transformCoupleField(pnf, cmpt);
00107 
00108     const unallocLabelList& faceCells = procInterface_.faceCells();
00109 
00110     forAll(faceCells, elemI)
00111     {
00112         result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
00113     }
00114 }
00115 
00116 
00117 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd