Skip to content

Lid driven cavity flow tutorial - #86

Open
thijsaalbers wants to merge 3 commits into
su2code:masterfrom
thijsaalbers:master
Open

Lid driven cavity flow tutorial#86
thijsaalbers wants to merge 3 commits into
su2code:masterfrom
thijsaalbers:master

Conversation

@thijsaalbers

@thijsaalbers thijsaalbers commented Aug 23, 2026

Copy link
Copy Markdown

Mesh and config file for the lid driven cavity flow tutorial. Please see the corresponding PR's su2code/su2code.github.io#218 and su2code/SU2#2812.

pcarruscag added a commit to su2code/SU2 that referenced this pull request Sep 14, 2026
- Gate the PB config-validation guard block on Kind_Regime ==
  INCOMPRESSIBLE, not just the raw KIND_INCOMP_SYSTEM value. That option
  is read regardless of solver family, so a compressible or SU2_DEF
  config carrying a leftover PRESSURE_BASED line would otherwise
  hard-error on an unrelated MGLEVEL/TIME_DOMAIN/adjoint check.

- Inline the substance of the TIME_DOMAIN guard's explanation instead of
  pointing at PB_SOLVER_PLAN.md, which is a local untracked planning
  file and not part of this branch's committed tree - anyone else
  checking out pr2812 would have hit a dangling reference.

- Fix CIncNSSolver::Preprocessing's primitive-gradient switch to also
  handle plain NUM_METHOD_GRAD= LEAST_SQUARES, matching the fix
  adc77f6 already applied to the inviscid path
  (CIncEulerSolver::Preprocessing / ComputeEdgeMassFluxesRhieChow). The
  viscous solver calls CommonPreprocessing directly rather than the
  Euler override, so it had its own copy of the same gap: with plain
  LEAST_SQUARES the pressure gradient silently stayed zero. Confirmed no
  registered incompressible Navier-Stokes regression case uses plain
  LEAST_SQUARES, so this doesn't move any existing test_vals.

- Add explanatory comments to CPBConvection_Base::ComputeJacobian's
  continuity and enthalpy rows, which still carry proj_vel-derived terms
  that contradict the "mass flux is frozen, so d(m_f)/du = 0" reasoning
  9592182 used to justify dropping the equivalent momentum-row term.
  Left the values as-is rather than changing them blind: the continuity
  row is provably harmless (PrepareImplicitIteration_impl deletes row 0
  for the pressure-based solver before the linear system is assembled),
  and the enthalpy row/column only matter when INC_ENERGY_EQUATION= YES,
  which no currently-registered pressure-based regression case exercises
  - so there's no test coverage to validate a re-derivation against.

- Disable (rather than delete) the tutorials.py lid_driven_cavity entry:
  su2code/Tutorials#86, which adds the referenced
  Inc_Lid_Driven_Cavity/incomp_pb_liddrivencavity.cfg and its mesh, has
  not landed (checked the local Tutorials clone - no matching branch or
  content). Leaving the entry active would fail CI outright rather than
  fail a regression check. Kept the recorded test_vals in a comment so
  whoever lands that Tutorials PR can re-enable this with one uncomment,
  not a re-derivation.

Not changed, on reflection:
- The RowDeleted second Jacobian-diagonal sweep in SetMomCoeff (flagged
  as an efficiency finding) does add real cost, but a correctness-safe
  fix would need CIncEulerVariable::strongBC extended to cover wall and
  outlet row-deletions too (currently only set for the far-field-inflow
  case), which is a real behavioral change I'm not making blind. Left
  as-is.
- The suspected stale-halo-density issue in ComputeHbyA across PISO
  corrections doesn't hold up: CIncEulerVariable::SetPressure/SetVelocity
  only touch the Pressure/Velocity primitive entries, never Density, so
  density stays frozen at its "top of outer iteration" value for every
  point (local or halo) throughout the correction loop - there's no
  actual divergence to fix.

Verified Common/src/CConfig.cpp, SU2_CFD/src/solvers/CIncNSSolver.cpp
and SU2_CFD/src/numerics/flow/convection/pressure_based.cpp compile
clean, the full SU2_CFD binary links, and incomp_pb_NACA0012.cfg
(GREEN_GAUSS, unaffected by the LEAST_SQUARES fix) still runs and
converges to Exit Success.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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