Update value on codedFixedValue
Summary
I have found what appears to be a bug with the codedFixedValue
boundary condition.
It appears that the BC does not update the field values when it is initialized.
Steps to reproduce
As an example you can take the pitzDaily on $FOAM_TUTORIALS/basic/scalarTransportFoam/pitzDaily/
.
Run the case as is.
Afterwards, change the U boundary condition to:
type codedFixedValue;
value uniform (0 0 0);
name U_tst;
code
#{
vectorField field (patch().Cf());
forAll(field, faceI)
{
field[faceI] = vector (10, 0, 0) ;
}
operator==(field);
#};
}
The results will not be the same because of the flux calculation. This happens because of the value given in the entry value uniform (0 0 0);
Environment information
- OpenFOAM version : v2106
- Operating system : WSL
- Hardware info :
- Compiler : GCC 9.4
Possible fixes
Since this is a fixed value condition, it should evaluate the field values once it is initialized. However, I do not know where is the best to place a fix. (U.correctBoundaryConditions() seems to do the trick, but it is not a good solution for this case as the BC itself should run the updateCoeffs()
function when it is created.)