Loading...
Searching...
No Matches
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-2022 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{
50 (
51 "A solver utility for moving meshes"
52 );
53
55 (
56 "deltaT",
57 "time",
58 "Override deltaT (eg, for accelerated motion)"
59 );
60
62 (
63 "endTime",
64 "time",
65 "Override endTime (eg, for shorter tests)"
66 );
67
68 #include "setRootCase.H"
69 #include "createTime.H"
70 #include "createNamedMesh.H"
71
72 scalar timeVal = 0;
73 if (args.readIfPresent("deltaT", timeVal))
74 {
75 runTime.setDeltaT(timeVal);
76 }
77
78 if (args.readIfPresent("endTime", timeVal))
79 {
81 runTime.setEndTime(timeVal);
82 }
83
85
86 while (runTime.loop())
87 {
88 Info<< "Time = " << runTime.timeName() << endl;
89
90 mesh.movePoints(motionPtr->newPoints());
91
92 runTime.write();
93
94 runTime.printExecutionTime(Info);
95 }
96
97 Info<< "End\n" << endl;
98
99 return 0;
100}
101
102
103// ************************************************************************* //
@ saEndTime
Stop when Time reaches prescribed endTime.
Definition Time.H:98
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition argList.C:400
static void addNote(const string &note)
Add extra notes for the usage information.
Definition argList.C:477
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
dynamicFvMesh & mesh
engineTime & runTime
Required Classes.
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:519
Foam::argList args(argc, argv)