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 
65  itm.writeVTKControlPoints();
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 // ************************************************************************* //
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:318
Foam::writeFreeSurface::execute
virtual bool execute()
execute is called at each ++ or += of the time-loop
Definition: writeFreeSurface.C:100
Foam::interfaceTrackingFvMesh
The interfaceTrackingFvMesh.
Definition: interfaceTrackingFvMesh.H:58
Foam::dynamicFvMesh
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:78
Foam::writeFreeSurface::start
virtual bool start()
start is called at the start of the time-loop
Definition: writeFreeSurface.C:94
Foam::TimeState::outputTime
bool outputTime() const noexcept
Deprecated(2016-05) return true if this is a write time.
Definition: TimeState.H:116
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::functionObject
Abstract base-class for Time/database function objects.
Definition: functionObject.H:332
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
IOmanip.H
Istream and Ostream manipulators taking arguments.
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::writeData
static void writeData(Ostream &os, const Type &val)
Definition: rawSurfaceWriterImpl.C:45
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
interfaceTrackingFvMesh.H
Foam::writeFreeSurface
A function object to write the control points on the free surface.
Definition: writeFreeSurface.H:53
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
writeFreeSurface.H
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::writeFreeSurface::read
virtual bool read(const dictionary &dict)
Read and set the function object if its data has changed.
Definition: writeFreeSurface.C:106
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::dictionary::readIfPresent
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Definition: dictionaryTemplates.C:405