moveMesh: The deprecated moveMesh utility replaced by moveDynamicMesh

and moveDynamicMesh renamed to moveMesh

Description
    Mesh motion and topological mesh change utility.

    Executes the mover, topoChanger and distributor specified in the
    dynamicMeshDict in a time-loop.
This commit is contained in:
Henry Weller
2022-07-01 15:51:30 +01:00
parent f7b08cd9ec
commit 31da3ac2c6
9 changed files with 83 additions and 197 deletions

View File

@ -1,5 +0,0 @@
moveDynamicMesh.C
../checkMesh/checkGeometry.C
../checkMesh/checkTools.C
EXE = $(FOAM_APPBIN)/moveDynamicMesh

View File

@ -1,10 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I../checkMesh
EXE_LIBS = \
-lmeshTools \
-lsampling

View File

@ -1,136 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
moveDynamicMesh
Description
Mesh motion and topological mesh changes utility.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "pimpleControl.H"
#include "vtkSurfaceWriter.H"
#include "cyclicAMIPolyPatch.H"
#include "PatchTools.H"
#include "checkGeometry.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
argList::addBoolOption
(
"checkAMI",
"check AMI weights"
);
#include "setRootCase.H"
#include "createTime.H"
Foam::word regionName;
if (args.optionReadIfPresent("region", regionName))
{
Foam::Info
<< "Create mesh " << regionName << " for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
}
else
{
regionName = Foam::fvMesh::defaultRegion;
Foam::Info
<< "Create mesh for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
}
Foam::fvMesh mesh
(
Foam::IOobject
(
regionName,
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
);
const bool checkAMI = args.optionFound("checkAMI");
if (checkAMI)
{
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
}
pimpleControl pimple(mesh);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);
while (runTime.run())
{
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << endl;
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Move the mesh
mesh.move();
}
}
mesh.checkMesh(true);
if (checkAMI)
{
writeAMIWeightsSums(mesh);
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,3 +1,5 @@
moveMesh.C
../checkMesh/checkGeometry.C
../checkMesh/checkTools.C
EXE = $(FOAM_APPBIN)/moveMesh

View File

@ -1,9 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I../checkMesh
EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools
-lmeshTools \
-lsampling

View File

@ -25,14 +25,21 @@ Application
moveMesh
Description
Solver for moving meshes.
Mesh motion and topological mesh change utility.
Executes the mover, topoChanger and distributor specified in the
dynamicMeshDict in a time-loop.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "fvMesh.H"
#include "motionSolver.H"
#include "pimpleControl.H"
#include "vtkSurfaceWriter.H"
#include "cyclicAMIPolyPatch.H"
#include "PatchTools.H"
#include "checkGeometry.H"
using namespace Foam;
@ -40,29 +47,81 @@ using namespace Foam;
int main(int argc, char *argv[])
{
#include "addRegionOption.H"
argList::addBoolOption
(
"checkAMI",
"check AMI weights"
);
#include "setRootCase.H"
#include "createTime.H"
#include "createMeshNoChangers.H"
IOdictionary dynamicMeshDict
Foam::word regionName;
if (args.optionReadIfPresent("region", regionName))
{
Foam::Info
<< "Create mesh " << regionName << " for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
}
else
{
regionName = Foam::fvMesh::defaultRegion;
Foam::Info
<< "Create mesh for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
}
Foam::fvMesh mesh
(
IOobject
Foam::IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ
regionName,
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
);
autoPtr<motionSolver> motionPtr =
motionSolver::New("motionSolver", mesh, dynamicMeshDict);
const bool checkAMI = args.optionFound("checkAMI");
while (runTime.loop())
if (checkAMI)
{
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
}
pimpleControl pimple(mesh);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);
while (runTime.run())
{
// Update the mesh for topology change, mesh to mesh mapping
mesh.update();
runTime++;
Info<< "Time = " << runTime.userTimeName() << endl;
mesh.setPoints(motionPtr->newPoints());
while (pimple.loop())
{
if (pimple.firstPimpleIter() || moveMeshOuterCorrectors)
{
// Move the mesh
mesh.move();
}
}
mesh.checkMesh(true);
if (checkAMI)
{
writeAMIWeightsSums(mesh);
}
runTime.write();

View File

@ -2222,7 +2222,7 @@ _modifyMesh_ ()
}
complete -o filenames -o nospace -F _modifyMesh_ modifyMesh
_moveDynamicMesh_ ()
_moveMesh_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
@ -2245,31 +2245,6 @@ _moveDynamicMesh_ ()
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _moveDynamicMesh_ moveDynamicMesh
_moveMesh_ ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
local line=${COMP_LINE}
local used=$(echo "$line" | grep -oE "\-[a-zA-Z]+ ")
opts="-case -doc -fileHandler -help -hostRoots -libs -noFunctionObjects -parallel -roots -srcDoc"
for o in $used ; do opts="${opts/$o/}" ; done
extra=""
[ "$COMP_CWORD" = 1 ] || \
case "$prev" in
-case)
opts="" ; extra="-d" ;;
-fileHandler)
opts="uncollated collated masterUncollated" ; extra="" ;;
-hostRoots|-libs|-roots)
opts="" ; extra="" ;;
*) ;;
esac
COMPREPLY=( $(compgen -W "${opts}" $extra -- ${cur}) )
}
complete -o filenames -o nospace -F _moveMesh_ moveMesh
_mshToFoam_ ()

View File

@ -28,7 +28,7 @@ deltaT 1e-5;
writeControl adjustableRunTime;
writeInterval 0.001;
////- For testing with moveDynamicMesh
////- For testing with moveMesh
//deltaT 0.01;
//writeControl timeStep;
//writeInterval 1;

View File

@ -14,7 +14,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application moveDynamicMesh;
application moveMesh;
startFrom startTime;