writeFreeSurface.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) 2019 Zeljko Tukovic, FSB Zagreb.
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 
28 #include "writeFreeSurface.H"
30 #include "IOmanip.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
38 
40  (
44  );
45 }
46 
47 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
48 
49 bool Foam::writeFreeSurface::writeData()
50 {
51  if (time_.outputTime())
52  {
53  const fvMesh& mesh =
55 
57  refCast<interfaceTrackingFvMesh>
58  (
59  const_cast<dynamicFvMesh&>
60  (
61  mesh.lookupObject<dynamicFvMesh>("fvSolution")
62  )
63  );
64 
66  }
67 
68  return true;
69 }
70 
71 
72 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
73 
74 Foam::writeFreeSurface::writeFreeSurface
75 (
76  const word& name,
77  const Time& runTime,
78  const dictionary& dict
79 )
80 :
82  name_(name),
83  time_(runTime),
84  regionName_(polyMesh::defaultRegion)
85 {
86  Info<< "Creating " << this->name() << " function object." << endl;
87 
88  dict.readIfPresent("region", regionName_);
89 }
90 
91 
92 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
93 
95 {
96  return writeData();
97 }
98 
99 
101 {
102  return writeData();
103 }
104 
105 
107 {
108  dict.readIfPresent("region", regionName_);
109 
110  return true;
111 }
112 
113 
114 // ************************************************************************* //
dictionary dict
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
static void writeData(Ostream &os, const Type &val)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:69
Macros for easy insertion into run-time selection tables.
const word & name() const noexcept
Return the name of this functionObject.
bool outputTime() const noexcept
Deprecated(2016-05) return true if this is a write time.
Definition: TimeState.H:137
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:52
A class for handling words, derived from Foam::string.
Definition: word.H:63
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:397
A function object to write the control points on the free surface.
virtual bool execute()
execute is called at each ++ or += of the time-loop
Istream and Ostream manipulators taking arguments.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:74
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:79
virtual bool start()
start is called at the start of the time-loop
void writeVTKControlPoints()
Write VTK freeSurface control points.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
virtual bool read(const dictionary &dict)
Read and set the function object if its data has changed.
Namespace for OpenFOAM.
The interfaceTrackingFvMesh.