Professional Documents
Culture Documents
On movingBodyTopoFvMesh
On movingBodyTopoFvMesh
On movingBodyTopoFvMesh
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "movingBodyTopoFvMesh.H"
#include "foamTime.H"
#include "mapPolyMesh.H"
#include "layerAdditionRemoval.H"
#include "volMesh.H"
#include "transformField.H"
#include "addToRunTimeSelectionTable.H"
addToRunTimeSelectionTable
(
topoChangerFvMesh,
movingBodyTopoFvMesh,
IOobject
);
}
Foam::tmp<Foam::scalarField>
Foam::movingBodyTopoFvMesh::calcMotionMask() const
{
Info<< "Updating vertex markup" << endl;
if (frontFacesID.active())
{
const faceZone& frontFaces = faceZones()[frontFacesID.index()];
return tvertexMarkup;
}
void Foam::movingBodyTopoFvMesh::addZonesAndModifiers()
{
// Add zones and modifiers for motion action
if (topoChanger_.size() > 0)
{
Info<< "void movingBodyTopoFvMesh::addZonesAndModifiers() : "
<< "Zones and modifiers already present. Skipping."
<< endl;
return;
}
if (frontFacesID.active())
{
const faceZone& frontFaces = faceZones()[frontFacesID.index()];
if (!frontFaces.empty())
{
topoChanger_.set
(
nMods,
new layerAdditionRemoval
(
frontFacesName_ + "Layer",
nMods,
topoChanger_,
frontFacesName_,
readScalar
(
dict_.subDict("front").lookup("minThickness")
),
readScalar
(
dict_.subDict("front").lookup("maxThickness")
)
)
);
nMods++;
}
}
if (backFacesID.active())
{
const faceZone& backFaces = faceZones()[backFacesID.index()];
if (!backFaces.empty())
{
topoChanger_.set
(
nMods,
new layerAdditionRemoval
(
backFacesName_ + "Layer",
nMods,
topoChanger_,
backFacesName_,
readScalar
(
dict_.subDict("back").lookup("minThickness")
),
readScalar
(
dict_.subDict("back").lookup("maxThickness")
)
)
);
nMods++;
}
}
topoChanger_.setSize(nMods);
reduce(nMods, sumOp<label>());
Info << "Adding " << nMods << " mesh modifiers" << endl;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::movingBodyTopoFvMesh::~movingBodyTopoFvMesh()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::movingBodyTopoFvMesh::update()
{
// Store points to recreate mesh motion
pointField oldPointsNew = allPoints();
pointField newPoints = allPoints();
if (globalMeshChanged)
{
Pout<< "Topology change. Calculating motion point mask" << endl;
motionMask_ = calcMotionMask();
}
if (localMeshChanged)
{
// // Map old points onto the new mesh
// pointField mappedOldPointsNew(allPoints().size());
// mappedOldPointsNew.map(oldPointsNew, topoChangeMap->pointMap());
return localMeshChanged;
}
// ************************************************************************* //
cd constant/polyMesh/sets/
\rm leftCentre leftCentre_old leftWallSet leftWallSet_old leftZone_old rightCentre rightCentre_old rightWallSet rightWallSet_old rightZone_old
wallSet
setsToZones
cd constant/polyMesh/sets/
\rm -f leftCentre leftCentre_old leftWallSet leftWallSet_old leftZone_old rightCentre rightCentre_old rightWallSet rightWallSet_old rightZone_old
wallSet
\rm -f leftCentre.gz leftCentre_old.gz leftWallSet.gz leftWallSet_old.gz leftZone_old.gz rightCentre.gz rightCentre_old.gz rightWallSet.gz
rightWallSet_old.gz rightZone_old.gz wallSet.gz
cd ../../..
here we remove
1. leftCentre
2. leftCentre_old
3. leftWallSet
4. leftWallSet_old
5. leftZone_old
6. rightCentre
7. rightCentre_old
8. rightWallSet
9. rightWallSet_old
10. rightZone_old
11. wallSet
The command line gives the following results: (After the setsToZones)
(
leftZone
rightZoneMasterCells
moving
leftZoneMasterCells
rightZone
right
left
)
Using cellSet leftZoneMasterCells to determine the master side of the face zone leftZone
End