moveDynamicMesh.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Application
25  moveDynamicMesh
26 
27 Description
28  Mesh motion and topological mesh changes utility.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "argList.H"
33 #include "Time.H"
34 #include "dynamicFvMesh.H"
35 #include "pimpleControl.H"
36 #include "vtkSurfaceWriter.H"
37 #include "cyclicAMIPolyPatch.H"
38 #include "PatchTools.H"
39 #include "checkGeometry.H"
40 
41 using namespace Foam;
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 int main(int argc, char *argv[])
46 {
47  #include "addRegionOption.H"
49  (
50  "checkAMI",
51  "check AMI weights"
52  );
53 
54  #include "setRootCase.H"
55  #include "createTime.H"
57 
58  const bool checkAMI = args.optionFound("checkAMI");
59 
60  if (checkAMI)
61  {
62  Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
63  }
64 
66 
68  (
69  pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
70  );
71 
72  while (runTime.loop())
73  {
74  Info<< "Time = " << runTime.timeName() << endl;
75 
76  while (pimple.loop())
77  {
78  if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
79  {
80  mesh.update();
81  }
82  }
83 
84  mesh.checkMesh(true);
85 
86  if (checkAMI)
87  {
89  }
90 
91  runTime.write();
92 
93  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
94  << " ClockTime = " << runTime.elapsedClockTime() << " s"
95  << nl << endl;
96  }
97 
98  Info<< "End\n" << endl;
99 
100  return 0;
101 }
102 
103 
104 // ************************************************************************* //
pimpleNoLoopControl & pimple
virtual bool loop()
Return true if run should continue and if so increment time.
Definition: Time.C:836
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:256
bool optionFound(const word &opt) const
Return true if the named option is found.
Definition: argListI.H:108
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:626
dynamicFvMesh & mesh
virtual const dictionary & dict() const
Return the solution dictionary.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
static const char nl
Definition: Ostream.H:265
moveMeshOuterCorrectors
time_t elapsedClockTime() const
Returns wall-clock time from clock instantiation.
Definition: clock.C:122
double elapsedCpuTime() const
Return CPU time (in seconds) from the start.
Definition: cpuTime.C:67
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
Pimple control class. Provides time-loop control methods which exit the simulation once convergence c...
Definition: pimpleControl.H:74
void writeAMIWeightsSums(const polyMesh &)
Write out the weights-sums on all the AMI patches.
bool loop(Time &time)
Time loop loop.
Definition: pisoControl.C:107
messageStream Info
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Definition: argList.C:117
virtual bool write(const bool write=true) const
Write using setting from DB.
Foam::argList args(argc, argv)
Namespace for OpenFOAM.