turbulentDFSEMInletFvPatchVectorFieldTemplates.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) 2015 OpenFOAM Foundation
9  Copyright (C) 2016-2020 OpenCFD Ltd
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 #include "Time.H"
31 #include "rawIOField.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 Foam::turbulentDFSEMInletFvPatchVectorField::interpolateOrRead
38 (
39  const word& fieldName,
40  const dictionary& dict,
41  bool& interpolateField
42 ) const
43 {
44  if (dict.found(fieldName))
45  {
46  tmp<Field<Type>> tFld
47  (
48  new Field<Type>
49  (
50  fieldName,
51  dict,
52  this->patch().size()
53  )
54  );
55 
56  interpolateField = false;
57  return tFld;
58  }
59  else
60  {
61  interpolateField = true;
62  return interpolateBoundaryData<Type>(fieldName);
63  }
64 }
65 
66 
67 template<class Type>
69 Foam::turbulentDFSEMInletFvPatchVectorField::interpolateBoundaryData
70 (
71  const word& fieldName
72 ) const
73 {
74  const word& patchName = this->patch().name();
75 
76  const fileName valsFile
77  (
78  fileName
79  (
80  this->db().time().globalPath()
81  /this->db().time().constant()
82  /"boundaryData"
83  /patchName
84  /"0"
85  /fieldName
86  )
87  );
88 
89  IOobject io
90  (
91  valsFile, // absolute path
92  this->db().time(),
93  IOobject::MUST_READ,
94  IOobject::NO_WRITE,
95  false, // no need to register
96  true // is global object (currently not used)
97  );
98 
99  const rawIOField<Type> vals(io, false);
100 
101  Info<< "Turbulent DFSEM patch " << patchName
102  << ": interpolating field " << fieldName
103  << " from " << valsFile << endl;
104 
105  return patchMapper().interpolate(vals);
106 }
107 
108 
109 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
rawIOField.H
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::rawIOField
Like IOField but falls back to raw IFstream if no header found. Optionally reads average value....
Definition: rawIOField.H:52
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
pointToPointPlanarInterpolation.H
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:121
Time.H
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
constant
constant condensation/saturation model.