Edit me

DARhoJSTFoam is a density-based, compressible RANS solver in DAFoam. It supports both steady and unsteady simulations, but the adjoint is available only for steady cases. It is a reimplementation of ADflow in OpenFOAM for unstructured meshes. Its solution strategies, such as the ANK and NK solvers, are taken directly from ADflow.

Compared with existing OpenFOAM compressible solvers, such as rhoSimpleFoam (pressure-based) and HiSA (density-based), DARhoJSTFoam has the following salient features:

  • Compared with HiSA, DARhoJSTFoam converges the primal much tighter with its Newton-type solvers, which gives more accurate adjoint derivatives.

  • Compared with rhoSimpleFoam, DARhoJSTFoam handles higher-speed flows, with a more robust shock-capturing scheme.

  • The ANK solver converges separated flows, such as the flow over a cylinder, more robustly, which helps field inversion and data assimilation.

Discretization

  • The convective fluxes of the conservative variables (rho, rhoU, rhoE) are discretized with the Jameson-Schmidt-Turkel (JST) central scheme with scalar artificial dissipation.

  • The shock sensor is either “pressure” or “entropy”. Use “entropy” with jst_k2 = 0.25 and jst_k4 = 0.0156 to match ADflow’s viscous JST settings.

  • Low-Mach preconditioning of the dissipation (“lowMach”: True) is available for flows below Mach 0.3.

  • The supported turbulence models are Spalart-Allmaras (SA) and k-omega SST. Rotating zones (MRF) are also supported.

Primal solver: ANK and NK

Both stages solve the flow and turbulence equations fully coupled with pseudo-transient Newton updates:

(V/dTau + dR/dW) dW = R(W),   W_new = W - alpha * dW

The linear system is solved by PETSc GMRES with a matrix-free Jacobian and an ASM/ILU preconditioner built from an approximate Jacobian.

  • ANK (approximate Newton-Krylov) starts from a cold flow at a low CFL number and ramps the CFL as the residual drops. It uses an approximate residual (frozen shock sensor, lumped dissipation) for the Jacobian, and a line search to keep density, energy, and turbulence variables physical. Once the relative residual drops below “secondOrdSwitchTol”, ANK switches to the exact residual, i.e., the full Jacobian, which speeds up the late convergence. When the turbulence variables limit the step at the start, “turbDecoupledIters” lets ANK update the turbulence separately for the first iterations.

  • NK (Newton-Krylov) takes over once ANK reaches “relTol”. It uses the exact residual, so it converges quadratically to a tight tolerance (e.g., 1e-8 or lower).

Adjoint

The adjoint uses DAFoam’s reverse-mode AD and the same residuals as the primal. The approximate Jacobian from ANK/NK is reused as the adjoint preconditioner, so no graph coloring is needed.

Unsteady

For unsteady flows (“unsteady”: {“active”: True}), DARhoJSTFoam uses dual time stepping with a second-order backward (BDF2) scheme. ANK and NK converge each physical time step in pseudo time. The unsteady adjoint is not supported yet.

Key options

All DARhoJSTFoam options are set in the “rhoJST” key of daOptions, so an existing DAFoam case can switch to DARhoJSTFoam with minimal changes: set “solverName” and add the “rhoJST” key. A typical setup is:

"solverName": "DARhoJSTFoam",
"rhoJST": {
    "shockSensor": "entropy",
    "jst_coeffs": {"jst_k2": 0.25, "jst_k4": 0.0165},
    "ANK": {"maxIters": 300, "relTol": 1e-4},
    "NK": {"active": True, "relTol": 1e-8},
},

Refer to the “rhoJST” comments in pyDAFoam.py for all options and tuning tips.

References

  • Mader, C. A., Kenway, G. K. W., Yildirim, A., and Martins, J. R. R. A., “ADflow: An open-source computational fluid dynamics solver for aerodynamic and multidisciplinary optimization,” Journal of Aerospace Information Systems, 17(9), 2020.

  • Yildirim, A., Kenway, G. K. W., Mader, C. A., and Martins, J. R. R. A., “A Jacobian-free approximate Newton-Krylov startup strategy for RANS simulations,” Journal of Computational Physics, 397, 2019.