Skip to content

Minor error with mappedFile PatchFunction1

Summary

When a field name is specified other than the default, the format of the write function is incorrect

Steps to reproduce

Run a case using the PatchFunction1 mappedFile with a non-default fieldTable entry. The result is then output in the format:

patch
{
    type ...;
    fieldTable "[non-default name]";
    value
    {
        type    mappedField;
        ...
    }
}

If this result is then used to run another case, the fieldTable entry gets missed and an error will be thrown that the field can't be found at constant/boundaryData/patch/...

The correct behavior is:

patch
{
    type ...;
    value
    {
        type    mappedField;
        fieldTable "[non-default name]";
        ...
    }
}

Possible fixes

Easy fix, minor change to writeData function. Just need to move the os.writeEntryIfDifferent("fieldTable") to be within the os.beginBlock(word(this->name() + "Coeffs")) section.

Edited by Ben Malin