Skip to content

OpenFOAM v2012 writes following links

Summary

When OpenFOAM v2012 writes to a file that is a link to another file (without appending), OpenFOAM does not delete the link and create a new file but instead it writes following the link. This was not the case in OpenFOAM v2006.

Steps to reproduce

  • Create a new case that has the mesh files as links to another mesh
  • Create a new cellzone with topoSet, the cellZones file will be written following the link.

What is the current bug behaviour?

OpenFOAM writes following the link

What is the expected correct behavior?

OpenFOAM should delete the link and create a new file instead

Environment information

  • OpenFOAM version : v2012
  • Operating system : centos
  • Hardware info :
  • Compiler : gcc 8.4.0

Possible fixes

Line 63 of fstreamPointers.C should be:

if (!append && Foam::type(targetName, false) == fileName::LINK)

instead of:

if (!append && Foam::type(targetName) == fileName::LINK)

https://develop.openfoam.com/Development/openfoam/-/blob/master/src/OpenFOAM/db/IOstreams/Fstreams/fstreamPointers.C#L63

It used to be like this in v2006: 6e2b7be9