From 7e6361a92abde5a9fcdf8413309baa33f04fcb7d Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Wed, 7 Aug 2019 16:04:48 +0800 Subject: [PATCH] Forcing hotfix. Will need more investigation before scientific runs. Now just something to correct the obvious bug. --- acc/mhd_solver/stencil_process.sps | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/acc/mhd_solver/stencil_process.sps b/acc/mhd_solver/stencil_process.sps index c3ade38..2adb5ba 100644 --- a/acc/mhd_solver/stencil_process.sps +++ b/acc/mhd_solver/stencil_process.sps @@ -222,13 +222,16 @@ helical_forcing(Scalar magnitude, Vector k_force, Vector xx, Vector ff_re, Vecto // JP: This looks wrong: // 1) Should it be dsx * nx instead of dsx * ny? // 2) Should you also use globalGrid.n instead of the local n? + // MV: You are rigth. Made a quickfix. I did not see the error because multigpu is split + // in z direction not y direction. // 3) Also final point: can we do this with vectors/quaternions instead? // Tringonometric functions are much more expensive and inaccurate/ + // MV: Good idea. No an immediate priority. // Fun related article: // https://randomascii.wordpress.com/2014/10/09/intel-underestimates-error-bounds-by-1-3-quintillion/ - xx.x = xx.x*(2.0*M_PI/(dsx*(DCONST_INT(AC_ny_max) - DCONST_INT(AC_ny_min)))); - xx.y = xx.y*(2.0*M_PI/(dsy*(DCONST_INT(AC_ny_max) - DCONST_INT(AC_ny_min)))); - xx.z = xx.z*(2.0*M_PI/(dsz*(DCONST_INT(AC_ny_max) - DCONST_INT(AC_ny_min)))); + xx.x = xx.x*(2.0*M_PI/(dsx*globalGrid.n.x)); + xx.y = xx.y*(2.0*M_PI/(dsy*globalGrid.n.y)); + xx.z = xx.z*(2.0*M_PI/(dsz*globalGrid.n.z)); Scalar cos_phi = cos(phi); Scalar sin_phi = sin(phi);