mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: foamToEnsight: detect moving/changing meshes
This commit is contained in:
@ -1,21 +1,27 @@
|
||||
// check for "points" in all of the result directories
|
||||
// check for "points" in any of the result directories
|
||||
|
||||
bool meshMoving = true;
|
||||
if (Times.size() > 2)
|
||||
bool meshMoving = false;
|
||||
if (Times.size() > 1)
|
||||
{
|
||||
for (label n1=2; n1<Times.size() && meshMoving; ++n1)
|
||||
// We already loaded a mesh (usually from constant). See if any other
|
||||
// points files
|
||||
forAll(Times, timeI)
|
||||
{
|
||||
meshMoving = IOobject
|
||||
(
|
||||
"points",
|
||||
Times[n1].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
).headerOk();
|
||||
if (Times[timeI].name() != mesh.pointsInstance())
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"points",
|
||||
Times[timeI].name(),
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
if (io.headerOk())
|
||||
{
|
||||
meshMoving = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
meshMoving = false;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1014,6 +1014,7 @@ void Foam::ensightMesh::write
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const label timeIndex,
|
||||
const bool meshMoving,
|
||||
Ostream& ensightCaseFile
|
||||
) const
|
||||
{
|
||||
@ -1027,7 +1028,7 @@ void Foam::ensightMesh::write
|
||||
{
|
||||
timeFile += "000.";
|
||||
}
|
||||
else if (mesh_.moving())
|
||||
else if (meshMoving)
|
||||
{
|
||||
timeFile += itoa(timeIndex) + '.';
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -380,6 +380,7 @@ public:
|
||||
const fileName& postProcPath,
|
||||
const word& prepend,
|
||||
const label timeIndex,
|
||||
const bool meshMoving,
|
||||
Ostream& ensightCaseFile
|
||||
) const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -228,6 +228,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
# include "checkMeshMoving.H"
|
||||
|
||||
if (meshMoving)
|
||||
{
|
||||
Info<< "Detected a moving mesh (multiple polyMesh/points files)."
|
||||
<< " Writing meshes for every timestep." << endl;
|
||||
}
|
||||
|
||||
|
||||
wordHashSet allCloudNames;
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -346,13 +353,14 @@ int main(int argc, char *argv[])
|
||||
eMesh.correct();
|
||||
}
|
||||
|
||||
if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
|
||||
if (timeIndex == 0 || meshMoving)
|
||||
{
|
||||
eMesh.write
|
||||
(
|
||||
ensightDir,
|
||||
prepend,
|
||||
timeIndex,
|
||||
meshMoving,
|
||||
ensightCaseFile
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user