dragonfly_sim.core.RANS_model
Compressible RANS (and laminar Navier-Stokes) at p = 0, built on the Euler model by composition.
CompressibleRANSModel owns a CompressibleEulerModel (self.flow) whose state carries the turbulence model’s transported scalars after the mean flow (rho*nu_tilde for Spalart-Allmaras), and plugs the viscous physics into it. Everything else – spaces, boundary conditions, the Newton solver and positivity limiter, pseudo-transient continuation, time stepping, adjoint and shape-derivative assembly – is the Euler model’s own code. Attributes and methods the RANS model does not define itself are forwarded to self.flow (reads and writes), so DG_windtunnel_model and DG_postprocessor use it exactly like the Euler model.
Discretization (cell-centred finite volume, as DG0)
Inviscid: NS_utils.extended_hll_flux (HLL on the mean flow, the same fan upwinding the scalars), with MUSCL-reconstructed interior-facet traces. Without MUSCL the first-order HLL flux puts acoustic-speed dissipation on the tangential momentum at wall-parallel facets, a numerical viscosity that exceeds the turbulent one through the boundary layer (SA NACA0012 at M 0.7: friction drag ~10x too high).
Viscous: through each facet, F_v(U_f, grad U_f) . n with the reconstructed facet gradient of core/reconstruction.py; no penalty term. Turbulence sources use the Green-Gauss gradient G. G is condensed out of Newton exactly, and is a derived field for adjoints and shape derivatives, as are the cell centres and the wall distance.
Nondimensionalization: rho_inf = p_inf = 1, chord 1, U_inf = M sqrt(gamma), mu_inf = rho_inf U_inf / Re (Re held fixed under set_mach).
Boundary conditions (kind: extra-variable values)
- farfield the characteristic state; scalars from the free stream where it
flows in, from the interior where it flows out
- wall adiabatic no-slip (define_wall_bc): u = 0, interior density and
internal energy, the turbulence model’s wall values; zero heat flux
slip (symmetry) the Euler slip state, interior scalars, no viscous flux
Solver defaults
Pseudo-transient continuation from the free stream (use_ptc, CFL0 5), one Newton step per pseudo step; FGMRES on the exact condensed Jacobian, preconditioned with ASM(1)/ILU(2) of the compact gradient-frozen part (jacobian_mode “compact_pc”, utils/gradient_condensation.py). Set direct_linear_solver for MUMPS on the exact Jacobian instead.
Classes
Module Contents
- class dragonfly_sim.core.RANS_model.CompressibleRANSModel(mesh, Re, turbulence_model=None, gamma=1.4, Pr=0.72, Pr_t=0.9, viscosity_law='sutherland', T_inf_dim=300.0, sutherland_S_dim=110.4, muscl=True, limiter=None, limiter_eps=0.01, jacobian_mode='compact_pc')
- __getattr__(name)
- __setattr__(name, value)
- _boundary_scalars(kind, U, inflow)
- _extra_scales()
- _freestream_extras()
- _interior_terms()
- _limiter_scales()
- _viscous_boundary_terms(U_b, meshtag, kind)
- _viscous_time_scale(U)
- _wall_stress_arguments(U)
(state, gradient) the wall shear is evaluated with: the wall state and the reconstructed facet gradient, exactly what the residual’s wall flux uses.
- _wall_traction(U, n)
- define_elements_functionspaces()
- define_farfield_conditions(bc_dict)
- define_noslip_wall_bc(meshtag)
Adiabatic no-slip wall. The inviscid flux is the exact flux of the wall state, (0, p n, 0, 0): no mass, energy or scalar flux through the wall, the interior pressure on it. Conduction is dropped from the viscous flux, which is the q.n = 0 condition.
- define_wall_bc(meshtag)
- eddy_viscosity(U)
- eddy_viscosity_ratio()
mu_t / mu of the current state, as a UFL expression.
- freestream()
The free-stream dict TurbulenceModel methods take.
- laminar_viscosity(U)
- noslip_wall_state(U)
- set_mach(M)
- set_up_solver()
- skin_friction_vector(U, n, q_inf)
tau_w / q_inf: the wall shear (tangential traction) coefficient vector. Call update_derived_fields() before assembling it.
- viscous_flux(U, G, heat_flux=True)
- Pr
- Pr_t
- Re
- _OWN
- jacobian_mode = 'compact_pc'
- limiter = None
- limiter_eps = 0.01
- mu_inf_const = None
- muscl = True
- reconstruction = None
- sutherland_S_ratio
- turbulence_model
- viscosity_law = 'sutherland'
- wall_distance = None
- wall_tags = []