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;
|
bool meshMoving = false;
|
||||||
if (Times.size() > 2)
|
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
|
if (Times[timeI].name() != mesh.pointsInstance())
|
||||||
(
|
{
|
||||||
"points",
|
IOobject io
|
||||||
Times[n1].name(),
|
(
|
||||||
polyMesh::meshSubDir,
|
"points",
|
||||||
mesh,
|
Times[timeI].name(),
|
||||||
IOobject::NO_READ
|
polyMesh::meshSubDir,
|
||||||
).headerOk();
|
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
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -1014,6 +1014,7 @@ void Foam::ensightMesh::write
|
|||||||
const fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const word& prepend,
|
const word& prepend,
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
|
const bool meshMoving,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
@ -1027,7 +1028,7 @@ void Foam::ensightMesh::write
|
|||||||
{
|
{
|
||||||
timeFile += "000.";
|
timeFile += "000.";
|
||||||
}
|
}
|
||||||
else if (mesh_.moving())
|
else if (meshMoving)
|
||||||
{
|
{
|
||||||
timeFile += itoa(timeIndex) + '.';
|
timeFile += itoa(timeIndex) + '.';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -380,6 +380,7 @@ public:
|
|||||||
const fileName& postProcPath,
|
const fileName& postProcPath,
|
||||||
const word& prepend,
|
const word& prepend,
|
||||||
const label timeIndex,
|
const label timeIndex,
|
||||||
|
const bool meshMoving,
|
||||||
Ostream& ensightCaseFile
|
Ostream& ensightCaseFile
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -228,6 +228,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
# include "checkMeshMoving.H"
|
# include "checkMeshMoving.H"
|
||||||
|
|
||||||
|
if (meshMoving)
|
||||||
|
{
|
||||||
|
Info<< "Detected a moving mesh (multiple polyMesh/points files)."
|
||||||
|
<< " Writing meshes for every timestep." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
wordHashSet allCloudNames;
|
wordHashSet allCloudNames;
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
@ -346,13 +353,14 @@ int main(int argc, char *argv[])
|
|||||||
eMesh.correct();
|
eMesh.correct();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
|
if (timeIndex == 0 || meshMoving)
|
||||||
{
|
{
|
||||||
eMesh.write
|
eMesh.write
|
||||||
(
|
(
|
||||||
ensightDir,
|
ensightDir,
|
||||||
prepend,
|
prepend,
|
||||||
timeIndex,
|
timeIndex,
|
||||||
|
meshMoving,
|
||||||
ensightCaseFile
|
ensightCaseFile
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user