v2406 shows incosistent behavior of READ_IF_PRESENT
A bit of context: I have a solver for nuclear reactor analysis named GeN-Foam (https://gitlab.com/foam-for-nuclear/GeN-Foam/-/tree/master?ref_type=heads). We have been updating it for years, at every new OpenFOAM version. The solver has a regression test that failed when updating to v2406. I have looked into the error, and it seems that, in two of the regression cases, the solver is reading a pointField that does not exist.
To be more specific: I need the solver to create and store a meshPoints file that includes the initial points of the mesh. Assume I have a case that does not include this meshPoints file (of pointIOField type) at the initial time step (folder "0").
If, in the solver, I initialize the meshPoints pointField as below, the meshPoints is initialized to 0() instead of being initialized to mesh.points()
pointIOField meshPoints
(
IOobject
(
"meshPoints",
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh.points()
);
I have checked that mesh.points() gives the correct results. I have also checked that, if I declare meshPoints as here below, I get an error, as expected (the solver cannot find the field meshPoints).
pointIOField meshPoints
(
IOobject
(
"meshPoints",
mesh.time().timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh.points()
);