From 3ff3570dbadfc7ada251de5530392af20af9a3ee Mon Sep 17 00:00:00 2001 From: Marc Henry de Frahan Date: Mon, 23 Sep 2024 09:08:46 -0600 Subject: [PATCH] Fix bug in sfs dynamic Smagorinsky Thanks to @bronise777 for finding and reporting this bug. --- Source/LES.H | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/LES.H b/Source/LES.H index 686c83621..cf7b8fb20 100644 --- a/Source/LES.H +++ b/Source/LES.H @@ -484,9 +484,14 @@ pc_dynamic_smagorinsky_sfs_term( // SFS stress const amrex::Real sigmadx = - coeff(iv, comp_Cs2) * alphaij(iv, 0) - coeff(iv, comp_CI) * alpha(iv) / 3.0; - const amrex::Real sigmady = coeff(iv, comp_Cs2) * alphaij(iv, 1); - const amrex::Real sigmadz = coeff(iv, comp_Cs2) * alphaij(iv, 2); + coeff(iv, comp_Cs2) * alphaij(iv, 0) - + coeff(iv, comp_CI) * alpha(iv) / 3.0 * static_cast(dir == 0); + const amrex::Real sigmady = + coeff(iv, comp_Cs2) * alphaij(iv, 1) - + coeff(iv, comp_CI) * alpha(iv) / 3.0 * static_cast(dir == 1); + const amrex::Real sigmadz = + coeff(iv, comp_Cs2) * alphaij(iv, 2) - + coeff(iv, comp_CI) * alpha(iv) / 3.0 * static_cast(dir == 2); flx(iv, UMX) = -sigmadx; flx(iv, UMY) = -sigmady; flx(iv, UMZ) = -sigmadz;