ENH: surfaceFieldValue - set surface output info for run-time post-processing

If the 'writeFields' option is set in surfaceFieldValue, e.g.

    surface1
    {
        type        surfaceFieldValue;
        libs        (fieldFunctionObjects);
        operation   none;
        fields      (p);
        regionType  patch;
        name        walls;

        // Create a surface in VTK format
        writeFields yes;
        surfaceFormat vtk;
    }

... the surface can now be used in runTimePostProcessing, e.g.:

    surfaces
    {
        surfaceFieldValueOutput
        {
            type            functionObjectSurface;
            representation  surface;
            liveObject      no;
            field           p;
            colourBy        field;
            range           (0 120000);
            functionObject  surface1;
        }
    }

Note: setting 'liveObject' to 'no' to suppress warnings due to the surface
not being retrieved from the object registry (default = 'yes') - this surface
can [currently] only be read from disk.
This commit is contained in:
Andrew Heather
2021-01-28 16:23:11 +00:00
parent 170d73f4ec
commit 13152510b3

View File

@ -397,8 +397,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
surfaceWriterPtr_->nFields() = 1; // Needed for VTK legacy
fileName outputName =
surfaceWriterPtr_->write(fieldName, allValues);
// Case-local file name with "<case>" to make relocatable
dictionary propsDict;
propsDict.add("file", time_.relativePath(outputName, true));
this->setProperty(fieldName, propsDict);
surfaceWriterPtr_->clear();
}
}