From c1b99b2b377e0c9d213b3d3b6aeebac7530f3027 Mon Sep 17 00:00:00 2001 From: JackHsu Date: Thu, 8 Aug 2019 15:03:42 +0800 Subject: [PATCH] made step-wise buffer update. --- acc/mhd_solver/stencil_process.sps | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/acc/mhd_solver/stencil_process.sps b/acc/mhd_solver/stencil_process.sps index 446d253..65907c4 100644 --- a/acc/mhd_solver/stencil_process.sps +++ b/acc/mhd_solver/stencil_process.sps @@ -115,19 +115,7 @@ accretion_profile(int3 globalVertexIdx, in Scalar lnrho){ } return accretion_density; } -// Note for update_accretion_buffer: 1. reduce accretion density from the density field. -// 2. Add the accretion mass, which is calculated from accretion density times volume of each cell and sum them into accretion buffer. -Scalar -update_accretion_buffer(in Scalar lnrho, out Scalar out_accretion){ - lnrho = log(exp(lnrho) - accretion_profile(lnrho)); - // This subtracts the accretion_density from the density field. - out_accretion = Scalar (0.0); //Initilize the buffer? - out_accretion = out_accretion + (accretion_profile(lnrho) * dsx * dsy * dsz); - // Not sure if this is correct, but it's suppose to add the accretion "mass" into vertex buffer and sum them all up. - - return -} #endif //TODO: basic structure of this part is as follows // update_accretion_buffer() <--> accretion_profile() <--> truelove_density() @@ -426,4 +414,10 @@ solve(Scalar dt) { out_uu = out_uu + forcing(globalVertexIdx, dt); } #endif + + #if LSINK + out_lnrho = log(exp(out_lnrho) - accretion_profile(globalVertexIdx, lnrho)); + out_accretion = accretion + (accretion_profile(globalVertexIdx,lnrho) * dsx * dsy * dsz); + #endif } +