alphaFixedPressureFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
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 
28 #include "fvPatchFieldMapper.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
37 (
38  const fvPatch& p,
40 )
41 :
42  fixedValueFvPatchScalarField(p, iF),
43  p_(p.size(), 0.0)
44 {}
45 
46 
49 (
50  const fvPatch& p,
52  const dictionary& dict
53 )
54 :
55  fixedValueFvPatchScalarField(p, iF, dict, false),
56  p_("p", dict, p.size())
57 {
58  if (dict.found("value"))
59  {
61  (
62  scalarField("value", dict, p.size())
63  );
64  }
65  else
66  {
68  }
69 }
70 
71 
74 (
76  const fvPatch& p,
78  const fvPatchFieldMapper& mapper
79 )
80 :
81  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
82  p_(mapper(ptf.p_))
83 {}
84 
85 
88 (
91 )
92 :
93  fixedValueFvPatchScalarField(tppsf, iF),
94  p_(tppsf.p_)
95 {}
96 
97 
98 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
99 
101 (
102  const fvPatchFieldMapper& m
103 )
104 {
105  m(*this, *this);
106  m(p_, p_);
107 }
108 
109 
111 (
112  const fvPatchScalarField& ptf,
113  const labelList& addr
114 )
115 {
116  fixedValueFvPatchScalarField::rmap(ptf, addr);
117 
119  refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
120 
121  p_.rmap(tiptf.p_, addr);
122 }
123 
124 
126 (
127  const fvPatchScalarField& ptf
128 )
129 {
130  fixedValueFvPatchScalarField::reset(ptf);
131 
133  refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
134 
135  p_.reset(tiptf.p_);
136 }
137 
138 
140 {
141  if (updated())
142  {
143  return;
144  }
145 
147  db().lookupObject<uniformDimensionedVectorField>("g");
148 
149  const fvPatchField<scalar>& rho =
150  patch().lookupPatchField<volScalarField, scalar>("rho");
151 
152  operator==(p_ - rho*(g.value() & patch().Cf()));
153 
154  fixedValueFvPatchScalarField::updateCoeffs();
155 }
156 
157 
159 (
160  Ostream& os
161 ) const
162 {
164  writeEntry(os, "p", p_);
165  writeEntry(os, "value", *this);
166 }
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 namespace Foam
172 {
174  (
177  );
178 }
179 
180 // ************************************************************************* //
Foam::surfaceFields.
alphaFixedPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:663
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:243
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Foam::fvPatchFieldMapper.
const Type & value() const
Return const reference to value.
virtual label size() const
Return size.
Definition: fvPatch.H:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
volScalarField scalarField(fieldObject, mesh)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
A fixed-pressure alphaContactAngle boundary.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const dimensionedVector & g
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.