freestreamFvPatchField.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 | Copyright (C) 2011 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 
26 #include "freestreamFvPatchField.H"
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 (
38  const fvPatch& p,
40 )
41 :
43 {}
44 
45 
46 template<class Type>
48 (
50  const fvPatch& p,
52  const fvPatchFieldMapper& mapper
53 )
54 :
55  inletOutletFvPatchField<Type>(ptf, p, iF, mapper)
56 {}
57 
58 
59 template<class Type>
61 (
62  const fvPatch& p,
64  const dictionary& dict
65 )
66 :
68 {
69  this->phiName_ = dict.lookupOrDefault<word>("phi","phi");
70 
71  freestreamValue() = Field<Type>("freestreamValue", dict, p.size());
72 
73  if (dict.found("value"))
74  {
76  (
77  Field<Type>("value", dict, p.size())
78  );
79  }
80  else
81  {
82  fvPatchField<Type>::operator=(freestreamValue());
83  }
84 }
85 
86 
87 template<class Type>
89 (
91 )
92 :
94 {}
95 
96 
97 template<class Type>
99 (
100  const freestreamFvPatchField<Type>& ptf,
102 )
103 :
105 {}
106 
107 
108 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
109 
110 template<class Type>
112 {
114  if (this->phiName_ != "phi")
115  {
116  os.writeKeyword("phi")
117  << this->phiName_ << token::END_STATEMENT << nl;
118  }
119  freestreamValue().writeEntry("freestreamValue", os);
120  this->writeEntry("value", os);
121 }
122 
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 } // End namespace Foam
127 
128 // ************************************************************************* //
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:387
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
freestreamFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
A class for handling words, derived from string.
Definition: word.H:59
void size(const label)
Override size to be inconsistent with allocated storage.
virtual void write(Ostream &) const
Write.
Foam::fvPatchFieldMapper.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:354
Namespace for OpenFOAM.
dictionary dict
static const char nl
Definition: Ostream.H:260
volScalarField & p
Definition: createFields.H:51
This boundary condition provides a generic outflow condition, with specified inflow for the case of r...
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:65
Pre-declare SubField and related Field type.
Definition: Field.H:57
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
Definition: Ostream.C:59
This boundary condition provides a free-stream condition. It is a &#39;mixed&#39; condition derived from the ...
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61