mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improved sample surfaces and surface writers (#1206)
- The writers have changed from being a generic state-less set of routines to more properly conforming to the normal notion of a writer. These changes allow us to combine output fields (eg, in a single VTK/vtp file for each timestep). Parallel data reduction and any associated bookkeeping is now part of the surface writers. This improves their re-usability and avoids unnecessary and premature data reduction at the sampling stage. It is now possible to have different output formats on a per-surface basis. - A new feature of the surface sampling is the ability to "store" the sampled surfaces and fields onto a registry for reuse by other function objects. Additionally, the "store" can be triggered at the execution phase as well
This commit is contained in:
committed by
Andrew Heather
parent
16bc63864e
commit
181c974b11
@ -953,20 +953,23 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
||||
{
|
||||
const word formatName(dict.get<word>("surfaceFormat"));
|
||||
|
||||
if (formatName != "none")
|
||||
{
|
||||
surfaceWriterPtr_.reset
|
||||
surfaceWriterPtr_.reset
|
||||
(
|
||||
surfaceWriter::New
|
||||
(
|
||||
surfaceWriter::New
|
||||
(
|
||||
formatName,
|
||||
dict.subOrEmptyDict("formatOptions")
|
||||
.subOrEmptyDict(formatName)
|
||||
)
|
||||
);
|
||||
formatName,
|
||||
dict.subOrEmptyDict("formatOptions").subOrEmptyDict(formatName)
|
||||
)
|
||||
);
|
||||
|
||||
if (surfaceWriterPtr_->enabled())
|
||||
{
|
||||
Info<< " surfaceFormat = " << formatName << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceWriterPtr_->clear();
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl << endl;
|
||||
|
||||
@ -384,22 +384,26 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||
Field<Type> values(getFieldValues<Type>(fieldName, true));
|
||||
|
||||
// Write raw values on surface if specified
|
||||
if (surfaceWriterPtr_.valid())
|
||||
if (surfaceWriterPtr_.valid() && surfaceWriterPtr_->enabled())
|
||||
{
|
||||
Field<Type> allValues(values);
|
||||
combineFields(allValues);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
surfaceWriterPtr_->write
|
||||
surfaceWriterPtr_->open
|
||||
(
|
||||
outputDir(),
|
||||
regionTypeNames_[regionType_] + ("_" + regionName_),
|
||||
surfToWrite,
|
||||
fieldName,
|
||||
allValues,
|
||||
false
|
||||
(
|
||||
outputDir()
|
||||
/ regionTypeNames_[regionType_] + ("_" + regionName_)
|
||||
),
|
||||
false // serial - already merged
|
||||
);
|
||||
|
||||
surfaceWriterPtr_->write(fieldName, allValues);
|
||||
|
||||
surfaceWriterPtr_->clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user