mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve diagnostic fields for checkFaMesh -write-vtk
ENH: support VTK output of procIDs for point data for some writers TUT: areaWrite for drippingChair
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -76,9 +76,9 @@ Description
|
||||
writer.beginCellData(4);
|
||||
writer.writeProcIDs();
|
||||
{
|
||||
// Use primitive patch order
|
||||
Field<scalar> fld
|
||||
(
|
||||
// Use primitive patch order
|
||||
faMeshTools::flattenEdgeField(aMesh.magLe(), true)
|
||||
);
|
||||
writer.write("magLe", fld);
|
||||
@ -93,11 +93,17 @@ Description
|
||||
}
|
||||
|
||||
{
|
||||
const Field<vector> edgeCentres
|
||||
(
|
||||
// Use primitive patch order
|
||||
faMeshTools::flattenEdgeField(aMesh.edgeCentres(), true)
|
||||
);
|
||||
|
||||
// finiteArea - edgeCentres
|
||||
// (no other convenient way to display vectors on the edges)
|
||||
vtk::lineWriter writer
|
||||
(
|
||||
aMesh.edgeCentres(),
|
||||
edgeCentres,
|
||||
edgeList::null(),
|
||||
// vtk::formatType::INLINE_ASCII,
|
||||
fileName
|
||||
@ -109,19 +115,20 @@ Description
|
||||
writer.writeGeometry();
|
||||
|
||||
// PointData
|
||||
writer.beginPointData(4);
|
||||
writer.beginPointData(3);
|
||||
writer.writeProcIDs(); // Unfortunately cannot threshold on points
|
||||
{
|
||||
// Use primitive patch order
|
||||
Field<vector> fld
|
||||
(
|
||||
// Use primitive patch order
|
||||
faMeshTools::flattenEdgeField(aMesh.Le(), true)
|
||||
);
|
||||
writer.write("Le", fld);
|
||||
}
|
||||
{
|
||||
// Use primitive patch order
|
||||
Field<vector> fld
|
||||
(
|
||||
// Use primitive patch order
|
||||
faMeshTools::flattenEdgeField(aMesh.edgeAreaNormals(), true)
|
||||
);
|
||||
writer.write("normal", fld);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -76,11 +76,11 @@ Foam::Ostream& Foam::vtk::fileWriter::reportBadState
|
||||
Foam::Ostream& Foam::vtk::fileWriter::reportBadState
|
||||
(
|
||||
Ostream& os,
|
||||
outputState expected,
|
||||
outputState expected1,
|
||||
outputState expected2
|
||||
) const
|
||||
{
|
||||
reportBadState(os, expected)
|
||||
reportBadState(os, expected1)
|
||||
<< " or (" << stateNames[expected2] << ')';
|
||||
return os;
|
||||
}
|
||||
@ -554,10 +554,18 @@ bool Foam::vtk::fileWriter::writeProcIDs(const label nValues)
|
||||
{
|
||||
++nCellData_;
|
||||
}
|
||||
else if (isState(outputState::POINT_DATA))
|
||||
{
|
||||
++nPointData_;
|
||||
}
|
||||
else
|
||||
{
|
||||
reportBadState(FatalErrorInFunction, outputState::CELL_DATA)
|
||||
<< " for procID field" << nl << endl
|
||||
reportBadState
|
||||
(
|
||||
FatalErrorInFunction,
|
||||
outputState::CELL_DATA,
|
||||
outputState::POINT_DATA
|
||||
) << " for procID field" << nl << endl
|
||||
<< exit(FatalError);
|
||||
|
||||
return false;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -201,7 +201,8 @@ protected:
|
||||
const UList<Type>& field
|
||||
);
|
||||
|
||||
//- Write nValues of processor ids as CellData (no-op in serial)
|
||||
//- Write nValues of processor ids as CellData or PointData
|
||||
//- (no-op in serial)
|
||||
bool writeProcIDs(const label nValues);
|
||||
|
||||
|
||||
@ -305,10 +306,16 @@ public:
|
||||
// \return True if the state changed
|
||||
virtual bool beginPointData(label nFields = 0) = 0;
|
||||
|
||||
//- Return the number of CellData written for the Piece thus far.
|
||||
//- True if output state corresponds to CELL_DATA
|
||||
inline bool isCellData() const noexcept;
|
||||
|
||||
//- True if output state corresponds to POINT_DATA
|
||||
inline bool isPointData() const noexcept;
|
||||
|
||||
//- The number of CellData written for the Piece thus far.
|
||||
inline label nCellData() const noexcept;
|
||||
|
||||
//- Return the number of PointData written for the Piece thus far.
|
||||
//- The number of PointData written for the Piece thus far.
|
||||
inline label nPointData() const noexcept;
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -107,4 +107,16 @@ inline Foam::label Foam::vtk::fileWriter::nPointData() const noexcept
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::vtk::fileWriter::isCellData() const noexcept
|
||||
{
|
||||
return (outputState::CELL_DATA == state_);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::vtk::fileWriter::isPointData() const noexcept
|
||||
{
|
||||
return (outputState::POINT_DATA == state_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -131,6 +131,10 @@ void Foam::vtk::lineWriter::piece
|
||||
|
||||
bool Foam::vtk::lineWriter::writeProcIDs()
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPoints_);
|
||||
}
|
||||
return vtk::fileWriter::writeProcIDs(nLocalLines_);
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -155,8 +155,8 @@ public:
|
||||
void piece(const pointField& points, const edgeList& edges);
|
||||
|
||||
|
||||
//- Write processor ids for each line as CellData
|
||||
//- (no-op in serial)
|
||||
//- Write processor ids for each line as CellData or for each point
|
||||
//- as PointData, depending on isPointData() state. No-op in serial.
|
||||
bool writeProcIDs();
|
||||
|
||||
//- Write a uniform field of Cell (Line) or Point values
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -131,6 +131,10 @@ void Foam::vtk::surfaceWriter::piece
|
||||
|
||||
bool Foam::vtk::surfaceWriter::writeProcIDs()
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPoints_);
|
||||
}
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPolys_);
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -155,8 +155,8 @@ public:
|
||||
void piece(const pointField& points, const faceList& faces);
|
||||
|
||||
|
||||
//- Write processor ids for each poly as CellData
|
||||
//- (no-op in serial)
|
||||
//- Write processor ids for each poly as CellData or for each point
|
||||
//- as PointData, depending on isPointData() state. No-op in serial.
|
||||
bool writeProcIDs();
|
||||
|
||||
//- Write a uniform field of Cell (Poly) or Point values
|
||||
|
||||
@ -201,8 +201,9 @@ public:
|
||||
void piece(const UPtrList<const pointField>& points);
|
||||
|
||||
|
||||
//- Write processor ids for each line as CellData
|
||||
//- (no-op in serial)
|
||||
//- Write processor ids for each line as CellData or for each point
|
||||
//- as PointData, depending on isPointData() state. No-op in serial.
|
||||
// Not implemented.
|
||||
bool writeProcIDs();
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -159,6 +159,10 @@ public:
|
||||
//- Write processor ids for each poly as CellData
|
||||
bool writeProcIDs()
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPoints_);
|
||||
}
|
||||
return vtk::polyWriter::writeProcIDs(nLocalPolys_);
|
||||
}
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -585,6 +585,10 @@ void Foam::vtk::patchMeshWriter::writePatchIDs()
|
||||
|
||||
bool Foam::vtk::patchMeshWriter::writeProcIDs()
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPoints_);
|
||||
}
|
||||
return vtk::fileWriter::writeProcIDs(nLocalPolys_);
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -209,8 +209,8 @@ public:
|
||||
// Must be called within the CELL_DATA state.
|
||||
void writePatchIDs();
|
||||
|
||||
//- Write processor ids as CellData. This is no-op in serial.
|
||||
// Must be called within the CELL_DATA state.
|
||||
//- Write processor ids for each line as CellData or for each point
|
||||
//- as PointData, depending on isPointData() state. No-op in serial.
|
||||
bool writeProcIDs();
|
||||
|
||||
//- Write processor neighbour ids as CellData. This is no-op in serial.
|
||||
|
||||
@ -3,19 +3,30 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset decompDict
|
||||
# decompDict=system/decomposeParDict-6
|
||||
# decompDict=system/decomposeParDict-7
|
||||
|
||||
runApplication blockMesh
|
||||
|
||||
runApplication makeFaMesh
|
||||
|
||||
runApplication decomposePar
|
||||
runApplication -decompose-dict="$decompDict" decomposePar
|
||||
|
||||
# For the processor partitioning
|
||||
runParallel -s finiteVolume foamToVTK -name VTK-parallel -time 0 \
|
||||
-no-finite-area -no-internal -no-lagrangian -no-fields -with-ids
|
||||
# For ids and processor partitioning
|
||||
runParallel -s volume -decompose-dict="$decompDict" \
|
||||
foamToVTK -name VTK-parallel -time 0 \
|
||||
-no-finite-area -no-internal -no-lagrangian -no-fields -with-ids \
|
||||
-patches filmWalls
|
||||
|
||||
runParallel $(getApplication)
|
||||
runParallel -decompose-dict="$decompDict" $(getApplication)
|
||||
|
||||
runParallel -s finiteArea foamToVTK -name VTK-parallel \
|
||||
-no-boundary -no-internal -no-lagrangian
|
||||
if false
|
||||
then
|
||||
# Not usually needed - uses areaWrite
|
||||
runParallel -s area -decompose-dict="$decompDict" \
|
||||
foamToVTK -name VTK-parallel \
|
||||
-no-boundary -no-internal -no-lagrangian -with-ids
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -7,13 +7,18 @@ runApplication blockMesh
|
||||
|
||||
runApplication makeFaMesh
|
||||
|
||||
# For the cell ids etc
|
||||
runApplication -s finiteVolume.serial foamToVTK -name VTK-serial -time 0 \
|
||||
-no-finite-area -no-internal -no-lagrangian -no-fields -with-ids
|
||||
# For ids and processor partitioning
|
||||
runApplication -s volume.serial foamToVTK -name VTK-serial -time 0 \
|
||||
-no-finite-area -no-internal -no-lagrangian -no-fields -with-ids \
|
||||
-patches filmWalls
|
||||
|
||||
runApplication $(getApplication)
|
||||
|
||||
runApplication -s finiteArea.serial foamToVTK -name VTK-serial \
|
||||
-no-boundary -no-internal -no-lagrangian
|
||||
if false
|
||||
then
|
||||
# Not usually needed - uses areaWrite
|
||||
runApplication -s area.serial foamToVTK -name VTK-serial \
|
||||
-no-boundary -no-internal -no-lagrangian
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
// -*- C++ -*-
|
||||
// Use the areaWrite function object
|
||||
|
||||
areaWrite
|
||||
{
|
||||
type areaWrite;
|
||||
libs (utilityFunctionObjects);
|
||||
log true;
|
||||
|
||||
writeControl writeTime;
|
||||
writeInterval 1;
|
||||
|
||||
// Fields to output (words or regex)
|
||||
fields (Uf_film hf_film pf_film);
|
||||
|
||||
surfaceFormat ensight;
|
||||
|
||||
formatOptions
|
||||
{
|
||||
default { format binary; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -52,5 +52,10 @@ regionFaMaxCo 1;
|
||||
|
||||
maxDeltaT 0.1;
|
||||
|
||||
functions
|
||||
{
|
||||
#include "areaWrite"
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 6;
|
||||
|
||||
method scotch;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 7;
|
||||
|
||||
method scotch;
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user