FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

porousZones.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "porousZones.H"
00027 #include <OpenFOAM/Time.H>
00028 #include <finiteVolume/volFields.H>
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034     defineTemplateTypeNameAndDebug(IOPtrList<porousZone>, 0);
00035 }
00036 
00037 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00038 
00039 Foam::porousZones::porousZones
00040 (
00041     const fvMesh& mesh
00042 )
00043 :
00044     IOPtrList<porousZone>
00045     (
00046         IOobject
00047         (
00048             "porousZones",
00049             mesh.time().constant(),
00050             mesh,
00051             IOobject::READ_IF_PRESENT,
00052             IOobject::NO_WRITE
00053         ),
00054         porousZone::iNew(mesh)
00055     ),
00056     mesh_(mesh)
00057 {}
00058 
00059 
00060 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00061 
00062 void Foam::porousZones::addResistance(fvVectorMatrix& UEqn) const
00063 {
00064     forAll(*this, i)
00065     {
00066         operator[](i).addResistance(UEqn);
00067     }
00068 }
00069 
00070 
00071 void Foam::porousZones::addResistance
00072 (
00073     const fvVectorMatrix& UEqn,
00074     volTensorField& AU
00075 ) const
00076 {
00077     // addResistance for each zone, delaying the correction of the
00078     // precessor BCs of AU
00079     forAll(*this, i)
00080     {
00081         operator[](i).addResistance(UEqn, AU, false);
00082     }
00083 
00084     // Correct the boundary conditions of the tensorial diagonal to ensure
00085     // processor bounaries are correctly handled when AU^-1 is interpolated
00086     // for the pressure equation.
00087     AU.correctBoundaryConditions();
00088 }
00089 
00090 
00091 bool Foam::porousZones::readData(Istream& is)
00092 {
00093     clear();
00094 
00095     IOPtrList<porousZone> newLst
00096     (
00097         IOobject
00098         (
00099             "porousZones",
00100             mesh_.time().constant(),
00101             mesh_,
00102             IOobject::MUST_READ,
00103             IOobject::NO_WRITE,
00104             false     // Don't re-register new zones with objectRegistry
00105         ),
00106         porousZone::iNew(mesh_)
00107     );
00108 
00109     transfer(newLst);
00110 
00111     return is.good();
00112 }
00113 
00114 
00115 bool Foam::porousZones::writeData(Ostream& os, bool subDict) const
00116 {
00117     // Write size of list
00118     os << nl << size();
00119 
00120     // Write beginning of contents
00121     os << nl << token::BEGIN_LIST;
00122 
00123     // Write list contents
00124     forAll(*this, i)
00125     {
00126         os << nl;
00127         operator[](i).writeDict(os, subDict);
00128     }
00129 
00130     // Write end of contents
00131     os << token::END_LIST << nl;
00132 
00133     // Check state of IOstream
00134     return os.good();
00135 }
00136 
00137 
00138 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines