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
fvMesh
fvPatches
constraint
processor
processorFvPatch.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 "
processorFvPatch.H
"
27
#include <
OpenFOAM/addToRunTimeSelectionTable.H
>
28
#include <
OpenFOAM/transformField.H
>
29
30
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32
namespace
Foam
33
{
34
35
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36
37
defineTypeNameAndDebug
(processorFvPatch, 0);
38
addToRunTimeSelectionTable
(fvPatch, processorFvPatch, polyPatch);
39
40
41
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
42
43
void
processorFvPatch::makeWeights
(
scalarField
& w)
const
44
{
45
if
(
Pstream::parRun
())
46
{
47
// The face normals point in the opposite direction on the other side
48
scalarField
neighbFaceCentresCn
49
(
50
(
51
procPolyPatch_.
neighbFaceAreas
()
52
/(
mag
(procPolyPatch_.
neighbFaceAreas
()) + VSMALL)
53
)
54
& (
55
procPolyPatch_.
neighbFaceCentres
()
56
- procPolyPatch_.
neighbFaceCellCentres
())
57
);
58
59
w = neighbFaceCentresCn/((
nf
()&
fvPatch::delta
()) + neighbFaceCentresCn);
60
}
61
else
62
{
63
w = 1.0;
64
}
65
}
66
67
68
void
processorFvPatch::makeDeltaCoeffs
(
scalarField
& dc)
const
69
{
70
if
(
Pstream::parRun
())
71
{
72
dc = (1.0 -
weights
())/(
nf
() &
fvPatch::delta
());
73
}
74
else
75
{
76
dc = 1.0/(
nf
() &
fvPatch::delta
());
77
}
78
}
79
80
81
tmp<vectorField>
processorFvPatch::delta
()
const
82
{
83
if
(
Pstream::parRun
())
84
{
85
// To the transformation if necessary
86
if
(
parallel
())
87
{
88
return
89
fvPatch::delta
()
90
- (
91
procPolyPatch_.
neighbFaceCentres
()
92
- procPolyPatch_.
neighbFaceCellCentres
()
93
);
94
}
95
else
96
{
97
return
98
fvPatch::delta
()
99
-
transform
100
(
101
forwardT
(),
102
(
103
procPolyPatch_.
neighbFaceCentres
()
104
- procPolyPatch_.
neighbFaceCellCentres
()
105
)
106
);
107
}
108
}
109
else
110
{
111
return
fvPatch::delta
();
112
}
113
}
114
115
116
tmp<labelField>
processorFvPatch::interfaceInternalField
117
(
118
const
unallocLabelList
& internalData
119
)
const
120
{
121
return
patchInternalField(internalData);
122
}
123
124
125
void
processorFvPatch::initTransfer
126
(
127
const
Pstream::commsTypes
commsType,
128
const
unallocLabelList
& interfaceData
129
)
const
130
{
131
send(commsType, interfaceData);
132
}
133
134
135
tmp<labelField>
processorFvPatch::transfer
136
(
137
const
Pstream::commsTypes
commsType,
138
const
unallocLabelList
&
139
)
const
140
{
141
return
receive<label>(commsType, this->size());
142
}
143
144
145
void
processorFvPatch::initInternalFieldTransfer
146
(
147
const
Pstream::commsTypes
commsType,
148
const
unallocLabelList
& iF
149
)
const
150
{
151
send(commsType, patchInternalField(iF)());
152
}
153
154
155
tmp<labelField>
processorFvPatch::internalFieldTransfer
156
(
157
const
Pstream::commsTypes
commsType,
158
const
unallocLabelList
&
159
)
const
160
{
161
return
receive<label>(commsType, this->size());
162
}
163
164
165
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166
167
}
// End namespace Foam
168
169
// ************************ vim: set sw=4 sts=4 et: ************************ //