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

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