ENH: direct ensight output of float/double

- since ensight format is always float and also always written
  component-wise, perform the double -> float narrowing when
  extracting the components.  This reduces the amount of data
  transferred between processors.

ENH: avoid vtk/ensight parallel communication of empty messages

- since ensight writes by element type (eg, tet, hex, polyhedral) the
  individual written field sections will tend to be relatively sparse.
  Skip zero-size messages, which should help reduce some of the
  synchronization bottlenecks.

ENH: use 'data chunking' when writing ensight files in parallel

- since ensight fields are written on a per-element basis, the
  corresponding segment can become rather sparsely distributed. With
  'data chunking', we attempt to get as many send/recv messages in
  before flushing the buffer for writing. This should make the
  sequential send/recv less affected by the IO time.

ENH: allow use of an external buffer when writing ensight components

STYLE: remove last vestiges of autoPtr<ensightFile> for output routines
This commit is contained in:
Mark Olesen
2022-11-11 15:59:06 +01:00
parent 5338e56c73
commit 0fabbcb404
33 changed files with 1698 additions and 517 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -26,6 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "ensightWrite.H"
#include "ensightOutput.H"
#include "Time.H"
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
@ -47,6 +48,9 @@ namespace functionObjects
}
}
// Implementation
#include "ensightWriteImpl.C"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label Foam::functionObjects::ensightWrite::writeAllVolFields
@ -57,11 +61,26 @@ Foam::label Foam::functionObjects::ensightWrite::writeAllVolFields
{
label count = 0;
count += writeVolFields<scalar>(proxy, acceptField);
count += writeVolFields<vector>(proxy, acceptField);
count += writeVolFields<sphericalTensor>(proxy, acceptField);
count += writeVolFields<symmTensor>(proxy, acceptField);
count += writeVolFields<tensor>(proxy, acceptField);
ensightOutput::floatBufferType scratch;
{
#undef doLocalCode
#define doLocalCode(PrimitiveType) \
count += writeVolFieldsImpl<PrimitiveType> \
( \
scratch, \
proxy, \
acceptField \
);
doLocalCode(scalar);
doLocalCode(vector);
doLocalCode(sphericalTensor);
doLocalCode(symmTensor);
doLocalCode(tensor);
#undef doLocalCode
}
return count;
}
@ -215,6 +234,8 @@ bool Foam::functionObjects::ensightWrite::write()
ensMesh_().write(os);
}
// TBD: handle allow/deny filters
wordHashSet acceptField(mesh_.names<void>(selectFields_));
// Prune restart fields

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -127,16 +127,18 @@ See also
SourceFiles
ensightWrite.C
ensightWriteTemplates.C
ensightWriteImpl.C
ensightWriteUpdate.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_ensightWrite_H
#define functionObjects_ensightWrite_H
#ifndef Foam_functionObjects_ensightWrite_H
#define Foam_functionObjects_ensightWrite_H
#include "fvMeshFunctionObject.H"
#include "ensightCase.H"
#include "ensightMesh.H"
#include "ensightOutputFwd.H"
#include "interpolation.H"
#include "volFields.H"
@ -223,6 +225,15 @@ class ensightWrite
// Write
//- Write selected volume fields.
template<class Type>
label writeVolFieldsImpl
(
ensightOutput::floatBufferType& scratch,
const fvMeshSubset& proxy,
const wordHashSet& acceptField
);
//- Write all volume fields
label writeAllVolFields
(
@ -230,15 +241,6 @@ class ensightWrite
const wordHashSet& acceptField
);
//- Write selected volume fields.
template<class Type>
label writeVolFields
(
const fvMeshSubset& proxy,
const wordHashSet& acceptField
);
//- No copy construct
ensightWrite(const ensightWrite&) = delete;
@ -296,12 +298,6 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "ensightWriteTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,8 +30,9 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Foam::label Foam::functionObjects::ensightWrite::writeVolFields
Foam::label Foam::functionObjects::ensightWrite::writeVolFieldsImpl
(
ensightOutput::floatBufferType& scratch,
const fvMeshSubset& proxy,
const wordHashSet& acceptField
)
@ -58,6 +59,7 @@ Foam::label Foam::functionObjects::ensightWrite::writeVolFields
ensightOutput::writeVolField<Type>
(
scratch,
os.ref(),
field,
ensMesh(),