added update_accretion_buffer.
This commit is contained in:
@@ -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), \
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user