Fixed scaling for sink particle, and added softening factor.

This commit is contained in:
JackHsu
2019-08-01 16:33:58 +08:00
parent 718a275bcf
commit 29d6a9b00a
5 changed files with 15 additions and 8 deletions

View File

@@ -78,6 +78,7 @@
FUNC(AC_sink_pos_y),\
FUNC(AC_sink_pos_z),\
FUNC(AC_M_sink),\
FUNC(AC_soft),\
/* Run params */\
FUNC(AC_cdt), \
FUNC(AC_cdtv), \
@@ -120,7 +121,7 @@
FUNC(AC_ff_hel_imz),\
/* Additional helper params */\
/* (deduced from other params do not set these directly!) */\
FUNC(AC_G_CONST),\
FUNC(AC_G_const),\
FUNC(AC_GM_star),\
FUNC(AC_sq2GM_star),\
FUNC(AC_cs2_sound), \

View File

@@ -21,7 +21,6 @@ uniform int nz_min;
uniform int nx;
uniform int ny;
uniform int nz;
//Added declaration for constants used for sink particle.
Vector
value(in Vector uu)
@@ -69,8 +68,8 @@ sink_gravity(int3 globalVertexIdx){
DCONST_REAL(AC_sink_pos_y),
DCONST_REAL(AC_sink_pos_z)};
const Scalar distance = length(grid_pos - sink_pos);
const Scalar soft = 0.12;
const Scalar gravity_magnitude = (Scalar(0.01) * sink_mass) / pow(((distance * distance) + soft*soft), 1.5);
const Scalar soft = DCONST_REAL(AC_soft);
const Scalar gravity_magnitude = (AC_G_const * sink_mass) / pow(((distance * distance) + soft*soft), 1.5);
const Vector direction = (Vector){(sink_pos.x - grid_pos.x) / distance,
(sink_pos.y - grid_pos.y) / distance,
(sink_pos.z - grid_pos.z) / distance};