Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
finiteVolume
cfdTools
general
porousMedia
porousZones.C
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
\*---------------------------------------------------------------------------*/
25
26
#include "
porousZones.H
"
27
#include <
OpenFOAM/Time.H
>
28
#include <
finiteVolume/volFields.H
>
29
30
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31
32
namespace
Foam
33
{
34
defineTemplateTypeNameAndDebug
(IOPtrList<porousZone>, 0);
35
}
36
37
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38
39
Foam::porousZones::porousZones
40
(
41
const
fvMesh
&
mesh
42
)
43
:
44
IOPtrList<porousZone>
45
(
46
IOobject
47
(
48
"porousZones"
,
49
mesh.
time
().
constant
(),
50
mesh
,
51
IOobject::READ_IF_PRESENT,
52
IOobject::NO_WRITE
53
),
54
porousZone::iNew
(mesh)
55
),
56
mesh_(mesh)
57
{}
58
59
60
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61
62
void
Foam::porousZones::addResistance
(
fvVectorMatrix
&
UEqn
)
const
63
{
64
forAll
(*
this
, i)
65
{
66
operator[]
(i).
addResistance
(UEqn);
67
}
68
}
69
70
71
void
Foam::porousZones::addResistance
72
(
73
const
fvVectorMatrix
&
UEqn
,
74
volTensorField
&
AU
75
)
const
76
{
77
// addResistance for each zone, delaying the correction of the
78
// precessor BCs of AU
79
forAll
(*
this
, i)
80
{
81
operator[](i).addResistance(UEqn, AU,
false
);
82
}
83
84
// Correct the boundary conditions of the tensorial diagonal to ensure
85
// processor bounaries are correctly handled when AU^-1 is interpolated
86
// for the pressure equation.
87
AU.
correctBoundaryConditions
();
88
}
89
90
91
bool
Foam::porousZones::readData
(
Istream
& is)
92
{
93
clear
();
94
95
IOPtrList<porousZone>
newLst
96
(
97
IOobject
98
(
99
"porousZones"
,
100
mesh_.time().constant(),
101
mesh_,
102
IOobject::MUST_READ
,
103
IOobject::NO_WRITE
,
104
false
// Don't re-register new zones with objectRegistry
105
),
106
porousZone::iNew
(mesh_)
107
);
108
109
transfer(newLst);
110
111
return
is.
good
();
112
}
113
114
115
bool
Foam::porousZones::writeData
(
Ostream
& os,
bool
subDict)
const
116
{
117
// Write size of list
118
os <<
nl
<< size();
119
120
// Write beginning of contents
121
os <<
nl
<<
token::BEGIN_LIST
;
122
123
// Write list contents
124
forAll
(*
this
, i)
125
{
126
os <<
nl
;
127
operator[](i).writeDict(os, subDict);
128
}
129
130
// Write end of contents
131
os <<
token::END_LIST
<<
nl
;
132
133
// Check state of IOstream
134
return
os.
good
();
135
}
136
137
138
// ************************ vim: set sw=4 sts=4 et: ************************ //