Added modularized term for accretion range, which is some wave function, and module that'll allow time-dependent accretion.

This commit is contained in:
JackHsu
2019-08-13 17:43:52 +08:00
parent 00f92f25fa
commit ff59431d65

View File

@@ -108,15 +108,25 @@ accretion_profile(int3 globalVertexIdx, in Scalar lnrho){
const Scalar profile_range = DCONST_REAL(AC_accretion_range); const Scalar profile_range = DCONST_REAL(AC_accretion_range);
const Scalar accretion_distance = length(grid_pos - sink_pos); const Scalar accretion_distance = length(grid_pos - sink_pos);
Scalar accretion_density; Scalar accretion_density;
if ((accretion_distance) <= profile_range){ // if ((accretion_distance) <= profile_range){
// calculate accretion according to chosen criterion for the grid cell. // // calculate accretion according to chosen criterion for the grid cell.
accretion_density = truelove_density(lnrho); // accretion_density = truelove_density(lnrho);
} else { // } else {
accretion_density = Scalar(0.0); // accretion_density = Scalar(0.0);
} // }
// return accretion_density;
// multiplying the truelove density by a wave function to avoid step-function like accretion profile.
const Scalar weight = exp(-(accretion_distance/profile_range));
const Scalar rate = truelove_density(lnrho);
accretion_density = weight * rate;
return accretion_density; return accretion_density;
} }
#endif #endif
//TODO: basic structure of this part is as follows //TODO: basic structure of this part is as follows
// update_accretion_buffer() <--> accretion_profile() <--> truelove_density() // update_accretion_buffer() <--> accretion_profile() <--> truelove_density()