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
fields
fvPatchFields
derived
fixedPressureCompressibleDensity
fixedPressureCompressibleDensityFvPatchScalarField.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 "
fixedPressureCompressibleDensityFvPatchScalarField.H
"
27
#include <
OpenFOAM/addToRunTimeSelectionTable.H
>
28
#include <
finiteVolume/fvPatchFieldMapper.H
>
29
#include <
finiteVolume/surfaceFields.H
>
30
#include <
finiteVolume/volFields.H
>
31
32
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34
namespace
Foam
35
{
36
37
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38
39
fixedPressureCompressibleDensityFvPatchScalarField::
40
fixedPressureCompressibleDensityFvPatchScalarField
41
(
42
const
fvPatch
&
p
,
43
const
DimensionedField<scalar, volMesh>
& iF
44
)
45
:
46
fixedValueFvPatchField<scalar>
(
p
, iF),
47
pName_(
"pNameIsUndefined"
)
48
{}
49
50
51
fixedPressureCompressibleDensityFvPatchScalarField::
52
fixedPressureCompressibleDensityFvPatchScalarField
53
(
54
const
fixedPressureCompressibleDensityFvPatchScalarField
& ptf,
55
const
fvPatch
& p,
56
const
DimensionedField<scalar, volMesh>
& iF,
57
const
fvPatchFieldMapper
& mapper
58
)
59
:
60
fixedValueFvPatchField<scalar>
(ptf,
p
, iF, mapper),
61
pName_(ptf.pName_)
62
{}
63
64
65
fixedPressureCompressibleDensityFvPatchScalarField::
66
fixedPressureCompressibleDensityFvPatchScalarField
67
(
68
const
fvPatch
& p,
69
const
DimensionedField<scalar, volMesh>
& iF,
70
const
dictionary
& dict
71
)
72
:
73
fixedValueFvPatchField<scalar>
(
p
, iF, dict),
74
pName_(dict.
lookup
(
"p"
))
75
{}
76
77
78
fixedPressureCompressibleDensityFvPatchScalarField::
79
fixedPressureCompressibleDensityFvPatchScalarField
80
(
81
const
fixedPressureCompressibleDensityFvPatchScalarField
& ptf
82
)
83
:
84
fixedValueFvPatchField<scalar>
(ptf),
85
pName_(ptf.pName_)
86
{}
87
88
89
fixedPressureCompressibleDensityFvPatchScalarField::
90
fixedPressureCompressibleDensityFvPatchScalarField
91
(
92
const
fixedPressureCompressibleDensityFvPatchScalarField
& ptf,
93
const
DimensionedField<scalar, volMesh>
& iF
94
)
95
:
96
fixedValueFvPatchField<scalar>
(ptf, iF),
97
pName_(ptf.pName_)
98
{}
99
100
101
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102
103
void
fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs
()
104
{
105
if
(updated())
106
{
107
return
;
108
}
109
110
const
fvPatchField<scalar>
& pp =
111
patch().lookupPatchField<
volScalarField
, scalar>(pName_);
112
113
const
dictionary
& thermoProps =
114
db().lookupObject<
IOdictionary
>(
"thermodynamicProperties"
);
115
116
const
scalar rholSat =
117
dimensionedScalar
(thermoProps.lookup(
"rholSat"
)).value();
118
119
const
scalar
pSat
=
120
dimensionedScalar
(thermoProps.lookup(
"pSat"
)).value();
121
122
const
scalar psil =
dimensionedScalar
(thermoProps.lookup(
"psil"
)).value();
123
124
operator==
(rholSat + psil*(pp - pSat));
125
126
fixedValueFvPatchField<scalar>::updateCoeffs
();
127
}
128
129
130
void
fixedPressureCompressibleDensityFvPatchScalarField::write
131
(
132
Ostream
& os
133
)
const
134
{
135
fvPatchField<scalar>::write
(os);
136
os.
writeKeyword
(
"p"
) << pName_ <<
token::END_STATEMENT
<<
nl
;
137
writeEntry(
"value"
, os);
138
}
139
140
141
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142
143
makePatchTypeField
144
(
145
fvPatchScalarField
,
146
fixedPressureCompressibleDensityFvPatchScalarField
147
);
148
149
150
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151
152
}
// End namespace Foam
153
154
// ************************ vim: set sw=4 sts=4 et: ************************ //