freeSurfacePressureFvPatchScalarField.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) 2019 Zeljko Tukovic, FSB Zagreb.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "fvPatchFieldMapper.H"
31 #include "volFields.H"
32 #include "gravityMeshObject.H"
36 
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 
41 (
42  const fvPatch& p,
44 )
45 :
46  fixedValueFvPatchScalarField(p, iF),
47  pa_(p.size(), Zero)
48 {}
49 
50 
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
59  fixedValueFvPatchScalarField(p, iF, dict, false),
60  pa_("pa", dict, p.size())
61 {
62  if (dict.found("value"))
63  {
64  fvPatchScalarField::operator=
65  (
66  scalarField("value", dict, p.size())
67  );
68  }
69  else
70  {
72  }
73 }
74 
75 
78 (
80  const fvPatch& p,
82  const fvPatchFieldMapper& mapper
83 )
84 :
85  fixedValueFvPatchScalarField(ptf, p, iF, mapper),
86  pa_(ptf.pa_, mapper)
87 {}
88 
89 
92 (
94 )
95 :
96  fixedValueFvPatchScalarField(ptf),
97  pa_(ptf.pa_)
98 {}
99 
100 
103 (
106 )
107 :
108  fixedValueFvPatchScalarField(ptf, iF),
109  pa_(ptf.pa_)
110 {}
111 
112 
113 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
114 
116 (
117  const fvPatchFieldMapper& m
118 )
119 {
120  fixedValueFvPatchScalarField::autoMap(m);
121  pa_.autoMap(m);
122 }
123 
124 
126 (
127  const fvPatchScalarField& ptf,
128  const labelList& addr
129 )
130 {
131  fixedValueFvPatchScalarField::rmap(ptf, addr);
132 
134  refCast<const freeSurfacePressureFvPatchScalarField>(ptf);
135 
136  pa_.rmap(tiptf.pa_, addr);
137 }
138 
139 
141 {
142  if (updated())
143  {
144  return;
145  }
146 
147  const fvMesh& mesh = patch().boundaryMesh().mesh();
148 
150  refCast<interfaceTrackingFvMesh>
151  (
152  const_cast<dynamicFvMesh&>
153  (
154  mesh.lookupObject<dynamicFvMesh>("fvSolution")
155  )
156  );
157 
158  operator==
159  (
161  );
162 
163  fixedValueFvPatchScalarField::updateCoeffs();
164 }
165 
166 
168 {
170  pa_.writeEntry("pa", os);
171  writeEntry("value", os);
172 }
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 namespace Foam
178 {
180  (
183  );
184 }
185 
186 // ************************************************************************* //
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::freeSurfacePressureFvPatchScalarField::freeSurfacePressureFvPatchScalarField
freeSurfacePressureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
Definition: freeSurfacePressureFvPatchScalarField.C:41
Foam::freeSurfacePressureFvPatchScalarField::rmap
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: freeSurfacePressureFvPatchScalarField.C:126
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
singlePhaseTransportModel.H
Foam::dictionary::found
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
turbulentTransportModel.H
Foam::interfaceTrackingFvMesh
The interfaceTrackingFvMesh.
Definition: interfaceTrackingFvMesh.H:58
gravityMeshObject.H
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:78
fvPatchFieldMapper.H
Foam::freeSurfacePressureFvPatchScalarField::pa_
scalarField pa_
Ambient pressure.
Definition: freeSurfacePressureFvPatchScalarField.H:115
Foam::interfaceTrackingFvMesh::freeSurfacePressureJump
tmp< scalarField > freeSurfacePressureJump()
Return free surface pressure jump.
Definition: interfaceTrackingFvMesh.C:1875
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
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
interfaceTrackingFvMesh.H
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::freeSurfacePressureFvPatchScalarField
This boundary condition provides static pressure condition for p_rgh, calculated as:
Definition: freeSurfacePressureFvPatchScalarField.H:106
Foam::freeSurfacePressureFvPatchScalarField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: freeSurfacePressureFvPatchScalarField.C:140
Foam::freeSurfacePressureFvPatchScalarField::autoMap
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
Definition: freeSurfacePressureFvPatchScalarField.C:116
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< label >
freeSurfacePressureFvPatchScalarField.H
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
Foam::makePatchTypeField
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Foam::freeSurfacePressureFvPatchScalarField::write
virtual void write(Ostream &) const
Write.
Definition: freeSurfacePressureFvPatchScalarField.C:167
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54