From 31da3ac2c677da0567c79aee40545b676c206021 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 1 Jul 2022 15:51:30 +0100 Subject: [PATCH] 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. --- .../manipulation/moveDynamicMesh/Make/files | 5 - .../manipulation/moveDynamicMesh/Make/options | 10 -- .../moveDynamicMesh/moveDynamicMesh.C | 136 ------------------ .../mesh/manipulation/moveMesh/Make/files | 2 + .../mesh/manipulation/moveMesh/Make/options | 11 +- .../mesh/manipulation/moveMesh/moveMesh.C | 85 +++++++++-- etc/config.sh/bash_completion | 27 +--- .../RAS/propeller/system/controlDict | 2 +- .../SnakeRiverCanyon/system/controlDict | 2 +- 9 files changed, 83 insertions(+), 197 deletions(-) delete mode 100644 applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files delete mode 100644 applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options delete mode 100644 applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files deleted file mode 100644 index 8572a56641..0000000000 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/files +++ /dev/null @@ -1,5 +0,0 @@ -moveDynamicMesh.C -../checkMesh/checkGeometry.C -../checkMesh/checkTools.C - -EXE = $(FOAM_APPBIN)/moveDynamicMesh diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options deleted file mode 100644 index 6803aa1800..0000000000 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options +++ /dev/null @@ -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 diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C deleted file mode 100644 index dae727ee30..0000000000 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ /dev/null @@ -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 . - -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("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; -} - - -// ************************************************************************* // diff --git a/applications/utilities/mesh/manipulation/moveMesh/Make/files b/applications/utilities/mesh/manipulation/moveMesh/Make/files index 1a1029e4a1..44c56fea13 100644 --- a/applications/utilities/mesh/manipulation/moveMesh/Make/files +++ b/applications/utilities/mesh/manipulation/moveMesh/Make/files @@ -1,3 +1,5 @@ moveMesh.C +../checkMesh/checkGeometry.C +../checkMesh/checkTools.C EXE = $(FOAM_APPBIN)/moveMesh diff --git a/applications/utilities/mesh/manipulation/moveMesh/Make/options b/applications/utilities/mesh/manipulation/moveMesh/Make/options index 9b8c3dea8c..6803aa1800 100644 --- a/applications/utilities/mesh/manipulation/moveMesh/Make/options +++ b/applications/utilities/mesh/manipulation/moveMesh/Make/options @@ -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 diff --git a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C index ee0e11430a..161c339ea3 100644 --- a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C +++ b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C @@ -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 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("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(); diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion index 7d24aa11e7..845ac2cc9d 100644 --- a/etc/config.sh/bash_completion +++ b/etc/config.sh/bash_completion @@ -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_ () diff --git a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict index 6fab5d040d..7eb082bbdd 100644 --- a/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict +++ b/tutorials/incompressible/pimpleFoam/RAS/propeller/system/controlDict @@ -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; diff --git a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/controlDict b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/controlDict index 7ef9e2c94a..fa857b7268 100644 --- a/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/controlDict +++ b/tutorials/mesh/moveDynamicMesh/SnakeRiverCanyon/system/controlDict @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application moveDynamicMesh; +application moveMesh; startFrom startTime;