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-------------------------------------------------------------------------------
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
28#include "writeFreeSurface.H"
30#include "IOmanip.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
38
40 (
44 );
45}
46
47// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
48
49bool 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
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// ************************************************************************* //
Istream and Ostream manipulators taking arguments.
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
virtual bool read()
Re-read model coefficients if they have changed.
bool outputTime() const noexcept
Deprecated(2016-05) return true if this is a write time.
Definition: TimeState.H:116
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Abstract base class for geometry and/or topology changing fvMesh.
Definition: dynamicFvMesh.H:81
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:91
The interfaceTrackingFvMesh.
const Type & lookupObject(const word &name, const bool recursive=false) const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:321
A class for handling words, derived from Foam::string.
Definition: word.H:68
A function object to write the control points on the free surface.
virtual bool start()
start is called at the start of the time-loop
virtual bool execute()
execute is called at each ++ or += of the time-loop
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
engineTime & runTime
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
static void writeData(Ostream &os, const Type &val)
dictionary dict