Skip to content

Derive KinematicPressure after the outlet-pressure copy, not before - #326

Open
scotCW wants to merge 1 commit into
jaheyns:devfrom
scotCW:upstream-pr-kinematic-pressure
Open

Derive KinematicPressure after the outlet-pressure copy, not before#326
scotCW wants to merge 1 commit into
jaheyns:devfrom
scotCW:upstream-pr-kinematic-pressure

Conversation

@scotCW

@scotCW scotCW commented Aug 20, 2026

Copy link
Copy Markdown

Summary

CfdCaseWriterFoam.processInitialConditions() computed initialValues['KinematicPressure'] from initialValues['Pressure'] at the very top of the function — roughly 100 lines before the "Copy pressure" block later in the same function replaces Pressure with the value taken from the outlet boundary when UseOutletPValue is set.

The result: for simpleFoam, porousSimpleFoam, pimpleFoam and SRFSimpleFoam, UseOutletPValue has no effect on the written 0/p field. It's always initialised from the default 1e5 / rho, regardless of what the outlet boundary is actually configured to.

Fix

Move the KinematicPressure derivation to the end of the function, after the pressure-copy block has had a chance to update initialValues['Pressure']. No behavioural change for any case that doesn't use UseOutletPValue — the default path (using the raw Pressure init value) produces the same result either way, just now correctly reflecting the outlet-derived value when that option is enabled.

Testing

Verified end to end on a pitzDaily-equivalent simpleFoam case with UseOutletPValue = True: before the fix, 0/p was written as uniform 100000.0; after, uniform 0.0, matching the outlet's configured static pressure. Not run through the full FreeCAD -t TestCfdOF GUI-based suite — flagging for visibility since I wasn't able to exercise it in this environment.

initialValues['KinematicPressure'] was computed from initialValues['Pressure']
at the top of processInitialConditions(), roughly 100 lines before the 'Copy
pressure' block below replaces that value with the one taken from the outlet
boundary. UseOutletPValue therefore had no effect on the initial field for
simpleFoam, porousSimpleFoam, pimpleFoam and SRFSimpleFoam: 0/p was always
written as the default 1e5/rho, regardless of the configured outlet pressure.

Moving the derivation to the end of the function, after the pressure-copy
block, fixes this without changing behaviour for any case that doesn't use
UseOutletPValue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant