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-------------------------------------------------------------------------------
11License
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
38Foam::alphaFixedPressureFvPatchScalarField::
39alphaFixedPressureFvPatchScalarField
40(
41 const fvPatch& p,
43)
44:
45 fixedValueFvPatchScalarField(p, iF),
46 p_(p.size(), Zero)
47{}
48
49
50Foam::alphaFixedPressureFvPatchScalarField::
51alphaFixedPressureFvPatchScalarField
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
64Foam::alphaFixedPressureFvPatchScalarField::
65alphaFixedPressureFvPatchScalarField
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
89Foam::alphaFixedPressureFvPatchScalarField::
90alphaFixedPressureFvPatchScalarField
91(
93)
94:
95 fixedValueFvPatchScalarField(tppsf),
96 p_(tppsf.p_)
97{}
98
99
100Foam::alphaFixedPressureFvPatchScalarField::
101alphaFixedPressureFvPatchScalarField
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{
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
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
171namespace Foam
172{
174 (
177 );
178}
179
180// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
const uniformDimensionedVectorField & g
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void autoMap(const FieldMapper &map, const bool applyFlip=true)
Map from self.
Definition: Field.C:403
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
A fixed-pressure alphaContactAngle boundary.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
const scalarField & p() const
Return the alphaFixed pressure.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
Definition: dictionaryI.H:87
const Type & value() const
Return const reference to value.
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:82
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:408
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Definition: fvPatchField.H:676
Namespace for OpenFOAM.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:82
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dictionary dict
Foam::surfaceFields.