uniformDensityHydrostaticPressureFvPatchScalarField.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 "gravityMeshObject.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
39 (
40  const fvPatch& p,
42 )
43 :
44  fixedValueFvPatchScalarField(p, iF),
45  rho_(0.0),
46  pRefValue_(0.0),
47  pRefPoint_(Zero)
48 {}
49 
50 
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
59  fixedValueFvPatchScalarField(p, iF, dict, false),
60  rho_(dict.get<scalar>("rho")),
61  pRefValue_(dict.get<scalar>("pRefValue")),
62  pRefPoint_(dict.lookup("pRefPoint"))
63 {
64  if (dict.found("value"))
65  {
67  (
68  scalarField("value", dict, p.size())
69  );
70  }
71  else
72  {
74  }
75 }
76 
77 
80 (
81  const uniformDensityHydrostaticPressureFvPatchScalarField& ptf,
82  const fvPatch& p,
83  const DimensionedField<scalar, volMesh>& iF,
84  const fvPatchFieldMapper& mapper
85 )
86 :
87  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
88  rho_(ptf.rho_),
89  pRefValue_(ptf.pRefValue_),
90  pRefPoint_(ptf.pRefPoint_)
91 {}
92 
93 
96 (
98 )
99 :
100  fixedValueFvPatchScalarField(ptf),
101  rho_(ptf.rho_),
102  pRefValue_(ptf.pRefValue_),
103  pRefPoint_(ptf.pRefPoint_)
104 {}
105 
106 
109 (
112 )
113 :
114  fixedValueFvPatchScalarField(ptf, iF),
115  rho_(ptf.rho_),
116  pRefValue_(ptf.pRefValue_),
117  pRefPoint_(ptf.pRefPoint_)
118 {}
119 
120 
121 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
122 
124 {
125  if (updated())
126  {
127  return;
128  }
129 
131  meshObjects::gravity::New(db().time());
132 
133  operator==
134  (
135  pRefValue_
136  + rho_*((g.value() & patch().Cf()) - (g.value() & pRefPoint_))
137  );
138 
139  fixedValueFvPatchScalarField::updateCoeffs();
140 }
141 
142 
144 (
145  Ostream& os
146 ) const
147 {
149  os.writeEntry("rho", rho_);
150  os.writeEntry("pRefValue", pRefValue_);
151  os.writeEntry("pRefPoint", pRefPoint_);
152  writeEntry("value", os);
153 }
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 namespace Foam
159 {
161  (
163  uniformDensityHydrostaticPressureFvPatchScalarField
164  );
165 }
166 
167 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:47
Foam::fvPatchScalarField
fvPatchField< scalar > fvPatchScalarField
Definition: fvPatchFieldsFwd.H:33
volFields.H
Foam::fvPatchField::write
virtual void write(Ostream &) const
Definition: fvPatchField.C:377
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:46
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Zero
static constexpr const zero Zero
Definition: zero.H:131
gravityMeshObject.H
fvPatchFieldMapper.H
Foam::dimensioned::value
const Type & value() const
Definition: dimensionedType.C:427
uniformDensityHydrostaticPressureFvPatchScalarField.H
Foam::UniformDimensionedField< vector >
Foam::uniformDimensionedVectorField
UniformDimensionedField< vector > uniformDimensionedVectorField
Definition: uniformDimensionedFields.H:46
Foam::uniformDensityHydrostaticPressureFvPatchScalarField
This boundary condition provides a hydrostatic pressure condition, calculated as:
Definition: uniformDensityHydrostaticPressureFvPatchScalarField.H:123
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::radiation::lookup
Lookup type of boundary radiation properties.
Definition: lookup.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:119
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
Definition: atmBoundaryLayer.C:26
Foam::uniformDensityHydrostaticPressureFvPatchScalarField::write
virtual void write(Ostream &) const
Definition: uniformDensityHydrostaticPressureFvPatchScalarField.C:137
Foam::uniformDensityHydrostaticPressureFvPatchScalarField::uniformDensityHydrostaticPressureFvPatchScalarField
uniformDensityHydrostaticPressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Definition: uniformDensityHydrostaticPressureFvPatchScalarField.C:32
Foam::foamVersion::patch
const std::string patch
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Definition: Ostream.H:232
Foam::PtrListOps::get
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
Foam::uniformDensityHydrostaticPressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Definition: uniformDensityHydrostaticPressureFvPatchScalarField.C:116
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:41
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::meshObjects::gravity::New
static const gravity & New(const Time &runTime)
Definition: gravityMeshObject.H:89
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:50
Foam::stringOps::evaluate
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
Definition: stringOpsEvaluate.C:30