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

cyclicGAMGInterfaceField.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 "cyclicGAMGInterfaceField.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "lduMatrix.H"
00030 
00031 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035     defineTypeNameAndDebug(cyclicGAMGInterfaceField, 0);
00036     addToRunTimeSelectionTable
00037     (
00038         GAMGInterfaceField,
00039         cyclicGAMGInterfaceField,
00040         lduInterface
00041     );
00042 }
00043 
00044 
00045 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00046 
00047 Foam::cyclicGAMGInterfaceField::cyclicGAMGInterfaceField
00048 (
00049     const GAMGInterface& GAMGCp,
00050     const lduInterfaceField& fineInterface
00051 )
00052 :
00053     GAMGInterfaceField(GAMGCp, fineInterface),
00054     cyclicInterface_(refCast<const cyclicGAMGInterface>(GAMGCp)),
00055     doTransform_(false),
00056     rank_(0)
00057 {
00058     const cyclicLduInterfaceField& p =
00059         refCast<const cyclicLduInterfaceField>(fineInterface);
00060 
00061     doTransform_ = p.doTransform();
00062     rank_ = p.rank();
00063 }
00064 
00065 
00066 // * * * * * * * * * * * * * * * * Desstructor * * * * * * * * * * * * * * * //
00067 
00068 Foam::cyclicGAMGInterfaceField::~cyclicGAMGInterfaceField()
00069 {}
00070 
00071 
00072 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00073 
00074 void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
00075 (
00076     const scalarField& psiInternal,
00077     scalarField& result,
00078     const lduMatrix&,
00079     const scalarField& coeffs,
00080     const direction cmpt,
00081     const Pstream::commsTypes
00082 ) const
00083 {
00084     scalarField pnf(size());
00085 
00086     label sizeby2 = size()/2;
00087 
00088     const unallocLabelList& faceCells = cyclicInterface_.faceCells();
00089 
00090     for (label facei=0; facei<sizeby2; facei++)
00091     {
00092         pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
00093         pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
00094     }
00095 
00096     transformCoupleField(pnf, cmpt);
00097 
00098     forAll(faceCells, elemI)
00099     {
00100         result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
00101     }
00102 }
00103 
00104 
00105 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd