moveMesh.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) 2011-2015 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Application
28 moveMesh
29
30Group
31 grpMeshManipulationUtilities
32
33Description
34 A solver utility for moving meshes.
35
36\*---------------------------------------------------------------------------*/
37
38#include "argList.H"
39#include "Time.H"
40#include "fvMesh.H"
41#include "motionSolver.H"
42
43using namespace Foam;
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47int main(int argc, char *argv[])
48{
49 argList::addNote
50 (
51 "A solver utility for moving meshes"
52 );
53
54 argList::addOption
55 (
56 "deltaT",
57 "time",
58 "Override deltaT for accelerated motion"
59 );
60
61 #include "setRootCase.H"
62 #include "createTime.H"
63 #include "createNamedMesh.H"
64
65 scalar deltaT = 0;
66 if (args.readIfPresent("deltaT", deltaT))
67 {
68 runTime.setDeltaT(deltaT);
69 }
70
71 autoPtr<motionSolver> motionPtr = motionSolver::New(mesh);
72
73 while (runTime.loop())
74 {
75 Info<< "Time = " << runTime.timeName() << endl;
76
77 mesh.movePoints(motionPtr->newPoints());
78
79 runTime.write();
80
81 runTime.printExecutionTime(Info);
82 }
83
84 Info<< "End\n" << endl;
85
86 return 0;
87}
88
89
90// ************************************************************************* //
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Definition: argListI.H:323
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
dynamicFvMesh & mesh
engineTime & runTime
Required Variables.
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
Foam::argList args(argc, argv)