alphaFixedPressureFvPatchScalarField.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
31 #include "fvPatchFieldMapper.H"
32 #include "volFields.H"
33 #include "surfaceFields.H"
34 #include "gravityMeshObject.H"
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
40 (
41  const fvPatch& p,
43 )
44 :
45  fixedValueFvPatchScalarField(p, iF),
46  p_(p.size(), Zero)
47 {}
48 
49 
52 (
54  const fvPatch& p,
56  const fvPatchFieldMapper& mapper
57 )
58 :
59  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
60  p_(ptf.p_, mapper)
61 {}
62 
63 
66 (
67  const fvPatch& p,
69  const dictionary& dict
70 )
71 :
72  fixedValueFvPatchScalarField(p, iF, dict, false),
73  p_("p", dict, p.size())
74 {
75  if (dict.found("value"))
76  {
78  (
79  scalarField("value", dict, p.size())
80  );
81  }
82  else
83  {
85  }
86 }
87 
88 
91 (
93 )
94 :
95  fixedValueFvPatchScalarField(tppsf),
96  p_(tppsf.p_)
97 {}
98 
99 
102 (
105 )
106 :
107  fixedValueFvPatchScalarField(tppsf, iF),
108  p_(tppsf.p_)
109 {}
110 
111 
112 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
113 
115 (
116  const fvPatchFieldMapper& m
117 )
118 {
119  scalarField::autoMap(m);
120  p_.autoMap(m);
121 }
122 
123 
125 (
126  const fvPatchScalarField& ptf,
127  const labelList& addr
128 )
129 {
130  fixedValueFvPatchScalarField::rmap(ptf, addr);
131 
133  refCast<const alphaFixedPressureFvPatchScalarField>(ptf);
134 
135  p_.rmap(tiptf.p_, addr);
136 }
137 
138 
140 {
141  if (updated())
142  {
143  return;
144  }
145 
147  meshObjects::gravity::New(db().time());
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  p_.writeEntry("p", os);
165  writeEntry("value", os);
166 }
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 namespace Foam
172 {
174  (
177  );
178 }
179 
180 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:51
volFields.H
Foam::fvPatchField< scalar >::write
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:384
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::alphaFixedPressureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: alphaFixedPressureFvPatchScalarField.C:125
Foam::alphaFixedPressureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: alphaFixedPressureFvPatchScalarField.C:115
gravityMeshObject.H
surfaceFields.H
Foam::surfaceFields.
fvPatchFieldMapper.H
rho
rho
Definition: readInitialConditions.H:88
Foam::UniformDimensionedField< vector >
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::alphaFixedPressureFvPatchScalarField::alphaFixedPressureFvPatchScalarField
alphaFixedPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: alphaFixedPressureFvPatchScalarField.C:40
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::alphaFixedPressureFvPatchScalarField
A fixed-pressure alphaContactAngle boundary.
Definition: alphaFixedPressureFvPatchScalarField.H:50
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
g
const uniformDimensionedVectorField & g
Definition: createFluidFields.H:26
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
Foam::alphaFixedPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: alphaFixedPressureFvPatchScalarField.C:159
Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: alphaFixedPressureFvPatchScalarField.C:139
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
alphaFixedPressureFvPatchScalarField.H
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::meshObjects::gravity::New
static const gravity & New(const Time &runTime)
Construct on Time.
Definition: gravityMeshObject.H:93
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54