Synthetic turbulence#1548
Conversation
Claude Code ReviewHead SHA: dafeef6 Files changed:
Findings1. Wrong density used for force scaling in multi-fluid cases (correctness)File: rho_local = q_prim_vf(eqn_idx%cont%beg)%sf(j, k, l)
f_scale = rho_local*(synth_U_inf/synth_L(turb_idx, 1))*G_norm
The existing body-force path avoids this by using the precomputed 2. Non-perpendicular solenoidal direction in 3-D degenerate branch (physics correctness)File: ! k nearly parallel to z; cross with x-hat instead k_hat x x_hat = (0, -kz, k_y)/norm (normalised)
synthetic_ex(m_global) = 0._wp
synthetic_ey(m_global) = -kz/max(sqrt(kz*kz + (k_mag*sin(rn1))**2), 1e-10_wp)
synthetic_ez(m_global) = (k_mag*sin(rn1))/max(sqrt(kz*kz + (k_mag*sin(rn1))**2), 1e-10_wp)
so Fix: replace both occurrences of synthetic_ey(m_global) = -kz/max(sqrt(kz*kz + (r_xy*sin(rn1))**2), 1e-10_wp)
synthetic_ez(m_global) = (r_xy*sin(rn1))/max(sqrt(kz*kz + (r_xy*sin(rn1))**2), 1e-10_wp)This only affects 3-D runs where some wave vectors are nearly parallel to z (|kz| ≥ 0.9). |
There was a problem hiding this comment.
I think this module should be renamed if this is where you're going to add the synthetic turbulence code. The synthetic turbulence isn't really a body force since it's not applied everywhere in the domain. Though m_source_terms isn't a good name because there are other source terms elsewhere in the code. Maybe a standalone m_synthetic turbulence would be the best place to put this routine? There's nothing wrong with small modules. In many ways they're a good thing.
| end if | ||
| end if | ||
| if (bodyForces) call s_initialize_body_forces_module() | ||
| if (bodyForces .or. synthetic_turbulence) call s_initialize_body_forces_module() |
There was a problem hiding this comment.
This line is relevant to my previous comment about code location
|
|
||
| if (surface_tension) call s_finalize_surface_tension_module() | ||
| if (bodyForces) call s_finalize_body_forces_module() | ||
| if (bodyForces .or. synthetic_turbulence) call s_finalize_body_forces_module() |
There was a problem hiding this comment.
This line is relevant to my previous comment about code location
|
Merged current master into this branch to resolve the conflict from #1550 (named parameter values / params codegen). One conflict in Two pre-existing items will still fail CI, flagging so they're not a surprise:
Both are quick fixes on your side. Also FYI: enumerated case parameters now accept named values ( |
Description
This branch includes the ability to inject synthetic turbulence in a Gaussian forcing region as described in
Tangermann, E. & Klein, M. (2020). "Controlled Synthetic Freestream Turbulence Intensity Introduced by a Local Volume Force." Fluids 5(3), 130. https://doi.org/10.3390/fluids5030130
Type of change (delete unused ones)
Testing
I ran 2D and 3D synthetically injected turbulence over an airfoil IB.
I still need to do an analysis of the energy distribution to validate the model and show that it was implemented correctly. This is why it is still a draft PR.
Checklist
See the developer guide for full coding standards.
GPU changes (expand if you modified
src/simulation/)AI code reviews
Reviews are not retriggered automatically. To request a review, comment on the PR:
@claude full review— Claude full review (also triggers on PR open/reopen/ready)claude-full-review— Claude full review via label