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 | Copyright (C) 2013-2015 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 
27 #include "fvPatchFieldMapper.H"
28 #include "ISstream.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Type>
35 (
36  const fvPatch& p,
38 )
39 :
41 {
42  this->refValue() = pTraits<Type>::zero;
43  this->refGrad() = pTraits<Type>::zero;
44  this->valueFraction() = 0.0;
45 }
46 
47 
48 template<class Type>
51 (
53  const fvPatch& p,
55  const fvPatchFieldMapper& mapper
56 )
57 :
58  mixedFvPatchField<Type>(ptf, p, iF, mapper)
59 {}
60 
61 
62 template<class Type>
65 (
66  const fvPatch& p,
68  const dictionary& dict
69 )
70 :
72 {}
73 
74 
75 template<class Type>
78 (
80 )
81 :
83 {}
84 
85 
86 template<class Type>
89 (
92 )
93 :
94  mixedFvPatchField<Type>(ecmpf, iF)
95 {}
96 
97 
98 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
99 
100 template<class Type>
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
108 template<class Type>
110 (
111  Ostream& os
112 ) const
113 {
114  os << "# Values: value snGrad refValue refGrad valueFraction" << endl;
115 }
116 
117 
118 template<class Type>
120 (
121  Ostream& os
122 ) const
123 {
124  const Field<Type> snGrad(this->snGrad());
125  const Field<Type>& refValue(this->refValue());
126  const Field<Type>& refGrad(this->refGrad());
127  const scalarField& valueFraction(this->valueFraction());
128 
129  forAll(refValue, faceI)
130  {
131  os << this->operator[](faceI) << token::SPACE
132  << snGrad[faceI] << token::SPACE
133  << refValue[faceI] << token::SPACE
134  << refGrad[faceI] << token::SPACE
135  << valueFraction[faceI] << nl;
136  }
137 }
138 
139 
140 template<class Type>
142 {
143  // Assume generic input stream so we can do line-based format and skip
144  // unused columns
145  ISstream& iss = dynamic_cast<ISstream&>(is);
146 
147  string line;
148 
149  forAll(*this, faceI)
150  {
151  iss.getLine(line);
152  IStringStream lineStr(line);
153 
154  // For symmetry with writing ignore value, snGrad columns
155 
156  Type value, snGrad;
157 
158  lineStr
159  >> value
160  >> snGrad
161  >> this->refValue()[faceI]
162  >> this->refGrad()[faceI]
163  >> this->valueFraction()[faceI];
164  }
165 }
166 
167 
168 // ************************************************************************* //
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
Foam::externalCoupledMixedFvPatchField::readData
virtual void readData(Istream &)
Read data.
Definition: externalCoupledMixedFvPatchField.C:141
p
p
Definition: pEqn.H:62
Foam::externalCoupledMixedFvPatchField::writeHeader
virtual void writeHeader(Ostream &) const
Write header.
Definition: externalCoupledMixedFvPatchField.C:110
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
ISstream.H
Foam::ISstream
Generic input stream.
Definition: ISstream.H:51
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvPatchFieldMapper.H
Foam::externalCoupledMixedFvPatchField
This boundary condition extends the mixed boundary condition with serialisation through.
Definition: externalCoupledMixedFvPatchField.H:69
Foam::externalCoupledMixedFvPatchField::writeData
virtual void writeData(Ostream &) const
Write data.
Definition: externalCoupledMixedFvPatchField.C:120
Foam::externalCoupledMixedFvPatchField::externalCoupledMixedFvPatchField
externalCoupledMixedFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: externalCoupledMixedFvPatchField.C:35
Foam::Field< Type >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::ISstream::getLine
ISstream & getLine(string &)
Raw, low-level getline into a string function.
Definition: ISstreamI.H:77
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
Foam::externalCoupledMixedFvPatchField::~externalCoupledMixedFvPatchField
virtual ~externalCoupledMixedFvPatchField()
Destructor.
Definition: externalCoupledMixedFvPatchField.C:102
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::IStringStream
Input from memory buffer stream.
Definition: IStringStream.H:49
Foam::mixedFvPatchField
This boundary condition provides a base class for 'mixed' type boundary conditions,...
Definition: mixedFvPatchField.H:126
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
externalCoupledMixedFvPatchField.H
Foam::line
A line primitive.
Definition: line.H:56
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:45
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51