solvers::movingMesh: New solver module to move the mesh
Executes the mover, topoChanger and distributor specified in the dynamicMeshDict. Replaces the moveMesh and earlier moveDynamicMesh utilities.
This commit is contained in:
@ -4,6 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
# Parse arguments for library compilation
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
wmake $targetType movingMesh
|
||||
wmake $targetType fluidSolver
|
||||
wmake $targetType incompressibleFluid
|
||||
wmake $targetType isothermalFluid
|
||||
|
||||
3
applications/solvers/modules/movingMesh/Make/files
Normal file
3
applications/solvers/modules/movingMesh/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
movingMesh.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libmovingMesh
|
||||
5
applications/solvers/modules/movingMesh/Make/options
Normal file
5
applications/solvers/modules/movingMesh/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume
|
||||
111
applications/solvers/modules/movingMesh/movingMesh.C
Normal file
111
applications/solvers/modules/movingMesh/movingMesh.C
Normal file
@ -0,0 +1,111 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "movingMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
defineTypeNameAndDebug(movingMesh, 0);
|
||||
addToRunTimeSelectionTable(solver, movingMesh, fvMesh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::movingMesh::movingMesh(fvMesh& mesh)
|
||||
:
|
||||
solver(mesh),
|
||||
maxDeltaT_
|
||||
(
|
||||
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", vGreat)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::movingMesh::~movingMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::solvers::movingMesh::maxDeltaT() const
|
||||
{
|
||||
return maxDeltaT_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::preSolve()
|
||||
{
|
||||
// Update the mesh for topology change, mesh to mesh mapping
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
|
||||
bool Foam::solvers::movingMesh::moveMesh()
|
||||
{
|
||||
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
|
||||
{
|
||||
mesh.move();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::prePredictor()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::momentumPredictor()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::thermophysicalPredictor()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::pressureCorrector()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::postCorrector()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::solvers::movingMesh::postSolve()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
131
applications/solvers/modules/movingMesh/movingMesh.H
Normal file
131
applications/solvers/modules/movingMesh/movingMesh.H
Normal file
@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2023 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/>.
|
||||
|
||||
Class
|
||||
Foam::solvers::movingMesh
|
||||
|
||||
Description
|
||||
Solver module to move the mesh.
|
||||
|
||||
Executes the mover, topoChanger and distributor specified in the
|
||||
dynamicMeshDict.
|
||||
|
||||
SourceFiles
|
||||
movingMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef movingMesh_H
|
||||
#define movingMesh_H
|
||||
|
||||
#include "solver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class movingMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class movingMesh
|
||||
:
|
||||
public solver
|
||||
{
|
||||
// Control parameters
|
||||
|
||||
//- Maximum time-step
|
||||
scalar maxDeltaT_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("movingMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from region mesh
|
||||
movingMesh(fvMesh& mesh);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
movingMesh(const movingMesh&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~movingMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the current maximum time-step for stable solution
|
||||
virtual scalar maxDeltaT() const;
|
||||
|
||||
//- Called at the start of the time-step, before the PIMPLE loop
|
||||
virtual void preSolve();
|
||||
|
||||
//- Called at the start of the PIMPLE loop to move the mesh
|
||||
virtual bool moveMesh();
|
||||
|
||||
//- Called at the beginning of the PIMPLE loop
|
||||
virtual void prePredictor();
|
||||
|
||||
//- Construct and optionally solve the momentum equation
|
||||
virtual void momentumPredictor();
|
||||
|
||||
//- Construct and solve the energy equation,
|
||||
// convert to temperature
|
||||
// and update thermophysical and transport properties
|
||||
virtual void thermophysicalPredictor();
|
||||
|
||||
//- Construct and solve the pressure equation in the PISO loop
|
||||
virtual void pressureCorrector();
|
||||
|
||||
//- Correct the thermophysical transport modelling
|
||||
virtual void postCorrector();
|
||||
|
||||
//- Called after the PIMPLE loop at the end of the time-step
|
||||
virtual void postSolve();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const movingMesh&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace solvers
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,5 +0,0 @@
|
||||
moveMesh.C
|
||||
../checkMesh/checkGeometry.C
|
||||
../checkMesh/checkTools.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/moveMesh
|
||||
@ -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
|
||||
@ -1,115 +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
|
||||
moveMesh
|
||||
|
||||
Description
|
||||
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 "pimpleControl.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "PatchTools.H"
|
||||
#include "checkGeometry.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
Foam::word regionName;
|
||||
|
||||
if (args.optionReadIfPresent("region", regionName))
|
||||
{
|
||||
Foam::Info
|
||||
<< "Create mesh " << regionName << " for time = "
|
||||
<< runTime.name() << Foam::nl << Foam::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionName = Foam::fvMesh::defaultRegion;
|
||||
Foam::Info
|
||||
<< "Create mesh for time = "
|
||||
<< runTime.name() << Foam::nl << Foam::endl;
|
||||
}
|
||||
|
||||
Foam::fvMesh mesh
|
||||
(
|
||||
Foam::IOobject
|
||||
(
|
||||
regionName,
|
||||
runTime.name(),
|
||||
runTime,
|
||||
Foam::IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
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() || pimple.moveMeshOuterCorrectors())
|
||||
{
|
||||
// Move the mesh
|
||||
mesh.move();
|
||||
}
|
||||
}
|
||||
|
||||
mesh.checkMesh(true);
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -26,12 +26,21 @@
|
||||
# moveDynamicMesh
|
||||
#
|
||||
# Description
|
||||
# Script to inform the user that the moveDynamicMesh solver
|
||||
# has been renamed moveMesh.
|
||||
# Script to inform the user that moveDynamicMesh has been superseded
|
||||
# and replaced by the more general movingMesh solver module
|
||||
# executed by the foamRun application.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
echo "The moveDynamicMesh utility has been renamed moveMesh, \
|
||||
replacing the original moveMesh"
|
||||
cat <<EOF
|
||||
|
||||
moveDynamicMesh has been superseded and replaced by the more general
|
||||
movingMesh solver module executed by the foamRun application:
|
||||
|
||||
foamRun -solver movingMesh
|
||||
|
||||
EOF
|
||||
|
||||
exec env foamRun -solver movingMesh "$@"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
46
bin/moveMesh
Executable file
46
bin/moveMesh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2023 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/>.
|
||||
#
|
||||
# Script
|
||||
# moveMesh
|
||||
#
|
||||
# Description
|
||||
# Script to inform the user that moveMesh has been superseded
|
||||
# and replaced by the more general movingMesh solver module
|
||||
# executed by the foamRun application.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cat <<EOF
|
||||
|
||||
moveMesh has been superseded and replaced by the more general
|
||||
movingMesh solver module executed by the foamRun application:
|
||||
|
||||
foamRun -solver movingMesh
|
||||
|
||||
EOF
|
||||
|
||||
exec env foamRun -solver movingMesh "$@"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -14,7 +14,9 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application moveMesh;
|
||||
application foamRun;
|
||||
|
||||
solver movingMesh;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
Reference in New Issue
Block a user