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-------------------------------------------------------------------------------
10License
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
34template<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
50template<class Type>
53(
55 const fvPatch& p,
57 const fvPatchFieldMapper& mapper
58)
59:
60 mixedFvPatchField<Type>(ptf, p, iF, mapper)
61{}
62
63
64template<class Type>
67(
68 const fvPatch& p,
70 const dictionary& dict
71)
72:
73 mixedFvPatchField<Type>(p, iF, dict)
74{}
75
76
77template<class Type>
80(
82)
83:
84 mixedFvPatchField<Type>(ecmpf)
85{}
86
87
88template<class Type>
91(
94)
95:
96 mixedFvPatchField<Type>(ecmpf, iF)
97{}
98
99
100// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
101
102template<class Type>
104(
105 Ostream& os
106) const
107{
108 os << "# Values: value snGrad refValue refGrad valueFraction" << endl;
109}
110
111
112template<class Type>
114(
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;
131}
132
133
134template<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 }
160
161
162// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic templated field type.
Definition: Field.H:82
Generic input stream using a standard (STL) stream.
Definition: ISstream.H:58
ISstream & getLine(std::string &str, char delim='\n')
Raw, low-level getline (until delimiter) into a string.
Definition: ISstreamI.H:76
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:112
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Extends the mixed boundary condition with serialisation functions.
A FieldMapper for finite-volume patch fields.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
A line primitive.
Definition: line.H:68
This boundary condition provides a base class for 'mixed' type boundary conditions,...
virtual Field< Type > & refGrad()
virtual Field< Type > & refValue()
virtual scalarField & valueFraction()
@ SPACE
Space [isspace].
Definition: token.H:125
volScalarField & p
OBJstream os(runTime.globalPath()/outputName)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333