externalCoupledMixedFvPatchField.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) 2013-2015 OpenFOAM Foundation
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 
29 #include "fvPatchFieldMapper.H"
30 #include "ISstream.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type>
37 (
38  const fvPatch& p,
40 )
41 :
42  mixedFvPatchField<Type>(p, iF)
43 {
44  this->refValue() = Type(Zero);
45  this->refGrad() = Type(Zero);
46  this->valueFraction() = 0.0;
47 }
48 
49 
50 template<class Type>
53 (
55  const fvPatch& p,
57  const fvPatchFieldMapper& mapper
58 )
59 :
60  mixedFvPatchField<Type>(ptf, p, iF, mapper)
61 {}
62 
63 
64 template<class Type>
67 (
68  const fvPatch& p,
70  const dictionary& dict
71 )
72 :
73  mixedFvPatchField<Type>(p, iF, dict)
74 {}
75 
76 
77 template<class Type>
80 (
82 )
83 :
84  mixedFvPatchField<Type>(ecmpf)
85 {}
86 
87 
88 template<class Type>
91 (
94 )
95 :
96  mixedFvPatchField<Type>(ecmpf, iF)
97 {}
98 
99 
100 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101 
102 template<class Type>
104 (
105  Ostream& os
106 ) const
107 {
108  os << "# Values: value snGrad refValue refGrad valueFraction" << endl;
109 }
110 
111 
112 template<class Type>
114 (
115  Ostream& os
116 ) const
117 {
118  const Field<Type> snGrad(this->snGrad());
119  const Field<Type>& refValue(this->refValue());
120  const Field<Type>& refGrad(this->refGrad());
121  const scalarField& valueFraction(this->valueFraction());
122 
123  forAll(refValue, facei)
124  {
125  os << this->operator[](facei) << token::SPACE
126  << snGrad[facei] << token::SPACE
127  << refValue[facei] << token::SPACE
128  << refGrad[facei] << token::SPACE
129  << valueFraction[facei] << nl;
130  }
131 }
132 
133 
134 template<class Type>
136 {
137  // Assume generic input stream so we can do line-based format and skip
138  // unused columns
139  ISstream& iss = dynamic_cast<ISstream&>(is);
140 
141  string line;
142 
143  forAll(*this, facei)
144  {
145  iss.getLine(line);
146  IStringStream lineStr(line);
147 
148  // For symmetry with writing ignore value, snGrad columns
149 
150  Type value, snGrad;
151 
152  lineStr
153  >> value
154  >> snGrad
155  >> this->refValue()[facei]
156  >> this->refGrad()[facei]
157  >> this->valueFraction()[facei];
158  }
159 }
160 
161 
162 // ************************************************************************* //
dictionary dict
Extends the mixed boundary condition with serialisation functions.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:70
This boundary condition provides a base class for &#39;mixed&#39; type boundary conditions, i.e. conditions that mix fixed value and patch-normal gradient conditions.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
Generic templated field type.
Definition: Field.H:62
A FieldMapper for finite-volume patch fields.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
externalCoupledMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
virtual void writeData(Ostream &os) const
Write data.
virtual void writeHeader(Ostream &os) const
Write header.
volScalarField & p
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:40
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127