added update_accretion_buffer.

This commit is contained in:
JackHsu
2019-08-08 15:53:41 +08:00
parent c1b99b2b37
commit 89128af44b
3 changed files with 24 additions and 22 deletions

View File

@@ -80,6 +80,7 @@
FUNC(AC_M_sink),\
FUNC(AC_M_sink_Msun),\
FUNC(AC_soft),\
FUNC(AC_accretion_range),\
/* Run params */\
FUNC(AC_cdt), \
FUNC(AC_cdtv), \

View File

@@ -82,14 +82,14 @@ sink_gravity(int3 globalVertexIdx){
#if LSINK
Scalar
truelove_density(in Scalar lnrho){
const Scalar rho = exp(lnrho);
const Scalar rho = exp(value(lnrho));
const Scalar Jeans_length_squared = (M_PI * cs2_sound) / (AC_G_const * rho);
const Scalar TJ_rho = ((M_PI) * ((dsx * dsx) / Jeans_length_squared) * cs2_sound) / (AC_G_const * dsx * dsx);
//TODO: dsx will cancel out, deal with it later for optimization.
Scalar accrection_rho = rho - TJ_rho;
if (accrection_rho < 0){
accrection_rho = Scalar(0);
Scalar accretion_rho = rho - TJ_rho;
if (accretion_rho < 0){
accretion_rho = Scalar(0);
}
return accretion_rho;
@@ -107,6 +107,7 @@ accretion_profile(int3 globalVertexIdx, in Scalar lnrho){
DCONST_REAL(AC_sink_pos_z)};
const Scalar profile_range = DCONST_REAL(AC_accretion_range);
const Scalar accretion_distance = length(grid_pos - sink_pos);
Scalar accretion_density;
if ((accretion_distance) <= profile_range){
// calculate accretion according to chosen criterion for the grid cell.
accretion_density = truelove_density(lnrho);
@@ -417,7 +418,7 @@ solve(Scalar dt) {
#if LSINK
out_lnrho = log(exp(out_lnrho) - accretion_profile(globalVertexIdx, lnrho));
out_accretion = accretion + (accretion_profile(globalVertexIdx,lnrho) * dsx * dsy * dsz);
out_accretion = value(accretion) + (accretion_profile(globalVertexIdx,lnrho) * dsx * dsy * dsz);
#endif
}

View File

@@ -58,7 +58,7 @@ AC_soft = 0.12
// Accretion Parameters
// profile_range is multiple of dsx
AC_profile_range = 2.0
AC_accretion_range = 2.0
// Physical properties of the domain
AC_unit_velocity = 1.0