From bd55c42fe55098becd7d353ba211e8c32bfdf659 Mon Sep 17 00:00:00 2001 From: Miikka Vaisala Date: Tue, 3 Sep 2019 16:38:16 +0800 Subject: [PATCH] Hann-windowing for the sink --- acc/mhd_solver/stencil_process.sps | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/acc/mhd_solver/stencil_process.sps b/acc/mhd_solver/stencil_process.sps index b888cbc..a0787c7 100644 --- a/acc/mhd_solver/stencil_process.sps +++ b/acc/mhd_solver/stencil_process.sps @@ -83,9 +83,11 @@ sink_accretion(int3 globalVertexIdx, in ScalarField lnrho, Scalar dt){ Scalar weight; if (accretion_switch == 1){ - // Step function weighting if ((accretion_distance) <= profile_range){ - weight = Scalar(1.0); + //weight = Scalar(1.0); + //Hann window function + Scalar window_ratio = accretion_distance/profile_range; + weight = Scalar(0.5)*(Scalar(1.0) - cos(Scalar(2.0)*M_PI*window_ratio)); } else { weight = Scalar(0.0); } @@ -121,14 +123,19 @@ sink_accretion_velocity(int3 globalVertexIdx, in VectorField uu, Scalar dt) { if (accretion_switch == 1){ Scalar weight; - // Step function weighting - // MV: This is too aggeressive creating velocity artefacts. + // Step function weighting + // Arch of a cosine function? + // Cubic spline x^3 - x in range [-0.5 , 0.5] if ((accretion_distance) <= profile_range){ - weight = Scalar(1.0); + //weight = Scalar(1.0); + //Hann window function + Scalar window_ratio = accretion_distance/profile_range; + weight = Scalar(0.5)*(Scalar(1.0) - cos(Scalar(2.0)*M_PI*window_ratio)); } else { - weight = Scalar(0.0); + weight = Scalar(0.0); } + Vector rate; // MV: Could we use divergence here ephasize velocitie which are compressive and // MV: not absorbins stuff that would not be accreted anyway?