From 185b33980f91938812ebdf6a551ea97143fd4917 Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Tue, 14 Jan 2020 13:58:11 +0800 Subject: [PATCH] Forcing function bug correction. --- acc/mhd_solver/stencil_kernel.ac | 2 +- config/astaroth.conf | 3 ++- src/standalone/model/host_forcing.cc | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/acc/mhd_solver/stencil_kernel.ac b/acc/mhd_solver/stencil_kernel.ac index 1fe57a9..f1c5cf4 100644 --- a/acc/mhd_solver/stencil_kernel.ac +++ b/acc/mhd_solver/stencil_kernel.ac @@ -607,7 +607,7 @@ forcing(int3 globalVertexIdx, Scalar dt) Vector force = helical_forcing(magnitude, k_force, xx, ff_re, ff_im, phase); // Scaling N = magnitude*cs*sqrt(k*cs/dt) * dt - const Scalar NN = cs * sqrt(AC_kaver * cs); + const Scalar NN = cs * magnitude * sqrt(AC_kaver * cs); // MV: Like in the Pencil Code. I don't understandf the logic here. force.x = sqrt(dt) * NN * force.x; force.y = sqrt(dt) * NN * force.y; diff --git a/config/astaroth.conf b/config/astaroth.conf index 8da72e0..abc1613 100644 --- a/config/astaroth.conf +++ b/config/astaroth.conf @@ -48,7 +48,8 @@ AC_relhel = 0.0 AC_forcing_magnitude = 1e-5 AC_kmin = 0.8 AC_kmax = 1.2 - +// Switches forcing off and accretion on +AC_switch_accretion = 0 // Entropy AC_cp_sound = 1.0 diff --git a/src/standalone/model/host_forcing.cc b/src/standalone/model/host_forcing.cc index e7fe0a3..7b4458e 100644 --- a/src/standalone/model/host_forcing.cc +++ b/src/standalone/model/host_forcing.cc @@ -171,11 +171,14 @@ helical_forcing_special_vector(AcReal3* ff_hel_re, AcReal3* ff_hel_im, const AcR // k_cross_k_cross_e.z/denominator}; // See PC forcing.f90 forcing_hel_both() - *ff_hel_re = (AcReal3){kabs * k_cross_e.x / denominator, kabs * k_cross_e.y, - kabs * k_cross_e.z}; + *ff_hel_im = (AcReal3){kabs * k_cross_e.x / denominator, + kabs * k_cross_e.y / denominator, + kabs * k_cross_e.z / denominator}; + + *ff_hel_re = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, + relhel * k_cross_k_cross_e.y / denominator, + relhel * k_cross_k_cross_e.z / denominator}; - *ff_hel_im = (AcReal3){relhel * k_cross_k_cross_e.x / denominator, relhel * k_cross_k_cross_e.y, - relhel * k_cross_k_cross_e.z}; } // Tool for loading forcing vector information into the device memory