Fixed scaling for sink particle, and added softening factor.
This commit is contained in:
@@ -78,6 +78,7 @@
|
|||||||
FUNC(AC_sink_pos_y),\
|
FUNC(AC_sink_pos_y),\
|
||||||
FUNC(AC_sink_pos_z),\
|
FUNC(AC_sink_pos_z),\
|
||||||
FUNC(AC_M_sink),\
|
FUNC(AC_M_sink),\
|
||||||
|
FUNC(AC_soft),\
|
||||||
/* Run params */\
|
/* Run params */\
|
||||||
FUNC(AC_cdt), \
|
FUNC(AC_cdt), \
|
||||||
FUNC(AC_cdtv), \
|
FUNC(AC_cdtv), \
|
||||||
@@ -120,7 +121,7 @@
|
|||||||
FUNC(AC_ff_hel_imz),\
|
FUNC(AC_ff_hel_imz),\
|
||||||
/* Additional helper params */\
|
/* Additional helper params */\
|
||||||
/* (deduced from other params do not set these directly!) */\
|
/* (deduced from other params do not set these directly!) */\
|
||||||
FUNC(AC_G_CONST),\
|
FUNC(AC_G_const),\
|
||||||
FUNC(AC_GM_star),\
|
FUNC(AC_GM_star),\
|
||||||
FUNC(AC_sq2GM_star),\
|
FUNC(AC_sq2GM_star),\
|
||||||
FUNC(AC_cs2_sound), \
|
FUNC(AC_cs2_sound), \
|
||||||
|
@@ -21,7 +21,6 @@ uniform int nz_min;
|
|||||||
uniform int nx;
|
uniform int nx;
|
||||||
uniform int ny;
|
uniform int ny;
|
||||||
uniform int nz;
|
uniform int nz;
|
||||||
//Added declaration for constants used for sink particle.
|
|
||||||
|
|
||||||
Vector
|
Vector
|
||||||
value(in Vector uu)
|
value(in Vector uu)
|
||||||
@@ -69,8 +68,8 @@ sink_gravity(int3 globalVertexIdx){
|
|||||||
DCONST_REAL(AC_sink_pos_y),
|
DCONST_REAL(AC_sink_pos_y),
|
||||||
DCONST_REAL(AC_sink_pos_z)};
|
DCONST_REAL(AC_sink_pos_z)};
|
||||||
const Scalar distance = length(grid_pos - sink_pos);
|
const Scalar distance = length(grid_pos - sink_pos);
|
||||||
const Scalar soft = 0.12;
|
const Scalar soft = DCONST_REAL(AC_soft);
|
||||||
const Scalar gravity_magnitude = (Scalar(0.01) * sink_mass) / pow(((distance * distance) + soft*soft), 1.5);
|
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,
|
const Vector direction = (Vector){(sink_pos.x - grid_pos.x) / distance,
|
||||||
(sink_pos.y - grid_pos.y) / distance,
|
(sink_pos.y - grid_pos.y) / distance,
|
||||||
(sink_pos.z - grid_pos.z) / distance};
|
(sink_pos.z - grid_pos.z) / distance};
|
||||||
|
@@ -54,6 +54,12 @@ AC_sink_pos_x = 3.14
|
|||||||
AC_sink_pos_y = 0.0
|
AC_sink_pos_y = 0.0
|
||||||
AC_sink_pos_z = 0.0
|
AC_sink_pos_z = 0.0
|
||||||
AC_M_sink = 1.0
|
AC_M_sink = 1.0
|
||||||
|
AC_soft = 0.12
|
||||||
|
|
||||||
|
// Physical properties of the domain
|
||||||
|
AC_unit_velocity = 1.0
|
||||||
|
AC_unit_density = 1.0
|
||||||
|
AC_unit_length = 1.0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
|
@@ -137,19 +137,17 @@ update_config(AcMeshInfo* config)
|
|||||||
6.674e-8); // g/cm3/s GGS definition //TODO define in a separate module
|
6.674e-8); // g/cm3/s GGS definition //TODO define in a separate module
|
||||||
AcReal M_sun = AcReal(1.989e33); // g solar mass
|
AcReal M_sun = AcReal(1.989e33); // g solar mass
|
||||||
|
|
||||||
config->real_params[AC_M_star] = config->real_params[AC_M_star] * M_sun /
|
config->real_params[AC_M_sink] = config->real_params[AC_M_sink] * M_sun /
|
||||||
((config->real_params[AC_unit_length] *
|
((config->real_params[AC_unit_length] *
|
||||||
config->real_params[AC_unit_length] *
|
config->real_params[AC_unit_length] *
|
||||||
config->real_params[AC_unit_length]) *
|
config->real_params[AC_unit_length]) *
|
||||||
config->real_params[AC_unit_density]);
|
config->real_params[AC_unit_density]);
|
||||||
|
|
||||||
config->real_params[AC_G_CONST] = G_CONST_CGS / ((config->real_params[AC_unit_velocity] *
|
config->real_params[AC_G_const] = G_CONST_CGS / ((config->real_params[AC_unit_velocity] *
|
||||||
config->real_params[AC_unit_velocity]) /
|
config->real_params[AC_unit_velocity]) /
|
||||||
(config->real_params[AC_unit_density] *
|
(config->real_params[AC_unit_density] *
|
||||||
config->real_params[AC_unit_length]));
|
config->real_params[AC_unit_length]));
|
||||||
|
|
||||||
config->real_params[AC_GM_star] = config->real_params[AC_M_star] *
|
|
||||||
config->real_params[AC_G_CONST];
|
|
||||||
config->real_params[AC_sq2GM_star] = AcReal(sqrt(AcReal(2) * config->real_params[AC_GM_star]));
|
config->real_params[AC_sq2GM_star] = AcReal(sqrt(AcReal(2) * config->real_params[AC_GM_star]));
|
||||||
|
|
||||||
#if VERBOSE_PRINTING // Defined in astaroth.h
|
#if VERBOSE_PRINTING // Defined in astaroth.h
|
||||||
|
@@ -95,6 +95,9 @@ write_mesh_info(const AcMeshInfo* config)
|
|||||||
fprintf(infotxt, "real AC_sink_pos_y %e \n", (double)config->real_params[AC_sink_pos_y]);
|
fprintf(infotxt, "real AC_sink_pos_y %e \n", (double)config->real_params[AC_sink_pos_y]);
|
||||||
fprintf(infotxt, "real AC_sink_pos_z %e \n", (double)config->real_params[AC_sink_pos_z]);
|
fprintf(infotxt, "real AC_sink_pos_z %e \n", (double)config->real_params[AC_sink_pos_z]);
|
||||||
fprintf(infotxt, "real AC_M_sink %e \n", (double)config->real_params[AC_M_sink]);
|
fprintf(infotxt, "real AC_M_sink %e \n", (double)config->real_params[AC_M_sink]);
|
||||||
|
fprintf(infotxt, "real AC_soft %e \n", (double)config->real_params[AC_soft]);
|
||||||
|
|
||||||
|
fprintf(infotxt, "real AC_G_const %e \n", (double)config->real_params[AC_G_const]);
|
||||||
|
|
||||||
fclose(infotxt);
|
fclose(infotxt);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user