Derive KinematicPressure after the outlet-pressure copy, not before - #326
Open
scotCW wants to merge 1 commit into
Open
Derive KinematicPressure after the outlet-pressure copy, not before#326scotCW wants to merge 1 commit into
scotCW wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CfdCaseWriterFoam.processInitialConditions()computedinitialValues['KinematicPressure']frominitialValues['Pressure']at the very top of the function — roughly 100 lines before the "Copy pressure" block later in the same function replacesPressurewith the value taken from the outlet boundary whenUseOutletPValueis set.The result: for
simpleFoam,porousSimpleFoam,pimpleFoamandSRFSimpleFoam,UseOutletPValuehas no effect on the written0/pfield. It's always initialised from the default1e5 / rho, regardless of what the outlet boundary is actually configured to.Fix
Move the
KinematicPressurederivation to the end of the function, after the pressure-copy block has had a chance to updateinitialValues['Pressure']. No behavioural change for any case that doesn't useUseOutletPValue— the default path (using the rawPressureinit 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-equivalentsimpleFoamcase withUseOutletPValue = True: before the fix,0/pwas written asuniform 100000.0; after,uniform 0.0, matching the outlet's configured static pressure. Not run through the fullFreeCAD -t TestCfdOFGUI-based suite — flagging for visibility since I wasn't able to exercise it in this environment.