Write now sink infor to time series. Also a bug cerrection for sink switch.
This commit is contained in:
@@ -48,6 +48,8 @@ gradients(in VectorField uu)
|
|||||||
#if LSINK
|
#if LSINK
|
||||||
Vector
|
Vector
|
||||||
sink_gravity(int3 globalVertexIdx){
|
sink_gravity(int3 globalVertexIdx){
|
||||||
|
int accretion_switch = DCONST_INT(AC_switch_accretion);
|
||||||
|
if (accretion_switch == 1){
|
||||||
Vector force_gravity;
|
Vector force_gravity;
|
||||||
const Vector grid_pos = (Vector){(globalVertexIdx.x - nx_min) * dsx,
|
const Vector grid_pos = (Vector){(globalVertexIdx.x - nx_min) * dsx,
|
||||||
(globalVertexIdx.y - ny_min) * dsy,
|
(globalVertexIdx.y - ny_min) * dsy,
|
||||||
@@ -64,6 +66,9 @@ sink_gravity(int3 globalVertexIdx){
|
|||||||
(sink_pos.z - grid_pos.z) / distance};
|
(sink_pos.z - grid_pos.z) / distance};
|
||||||
force_gravity = gravity_magnitude * direction;
|
force_gravity = gravity_magnitude * direction;
|
||||||
return force_gravity;
|
return force_gravity;
|
||||||
|
} else {
|
||||||
|
return (Vector){0.0, 0.0, 0.0};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ def plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3):
|
|||||||
plt.xlabel(xaxis)
|
plt.xlabel(xaxis)
|
||||||
plt.legend()
|
plt.legend()
|
||||||
|
|
||||||
def plot_ts(ts, show_all=False, lnrho=False, uutot=False, uux=False, uuy=False, uuz=False, ss=False, acc=False):
|
def plot_ts(ts, show_all=False, lnrho=False, uutot=False, uux=False, uuy=False, uuz=False, ss=False, acc=False, sink=False):
|
||||||
|
|
||||||
if show_all:
|
if show_all:
|
||||||
lnrho=True
|
lnrho=True
|
||||||
@@ -42,6 +42,7 @@ def plot_ts(ts, show_all=False, lnrho=False, uutot=False, uux=False, uuy=False,
|
|||||||
uuz=True
|
uuz=True
|
||||||
ss=True
|
ss=True
|
||||||
acc=True
|
acc=True
|
||||||
|
sink=True
|
||||||
|
|
||||||
if lnrho:
|
if lnrho:
|
||||||
plt.figure()
|
plt.figure()
|
||||||
@@ -99,4 +100,18 @@ def plot_ts(ts, show_all=False, lnrho=False, uutot=False, uux=False, uuy=False,
|
|||||||
yaxis3 = 'acc_max'
|
yaxis3 = 'acc_max'
|
||||||
plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3)
|
plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3)
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
xaxis = 't_step'
|
||||||
|
yaxis1 = 'sink_mass'
|
||||||
|
yaxis2 = 'sink_mass'
|
||||||
|
yaxis3 = 'sink_mass'
|
||||||
|
plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3)
|
||||||
|
|
||||||
|
plt.figure()
|
||||||
|
xaxis = 't_step'
|
||||||
|
yaxis1 = 'accreted_mass'
|
||||||
|
yaxis2 = 'accreted_mass'
|
||||||
|
yaxis3 = 'accreted_mass'
|
||||||
|
plot_min_man_rms(ts, xaxis, yaxis1, yaxis2, yaxis3)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ print("sys.argv", sys.argv)
|
|||||||
#meshdir = "/tiara/home/mvaisala/astaroth-code/astaroth_2.0/build/"
|
#meshdir = "/tiara/home/mvaisala/astaroth-code/astaroth_2.0/build/"
|
||||||
#meshdir = "/tiara/ara/data/mvaisala/tmp/astaroth-code/astaroth_2.0/build/"
|
#meshdir = "/tiara/ara/data/mvaisala/tmp/astaroth-code/astaroth_2.0/build/"
|
||||||
#meshdir = "/tiara/ara/data/mvaisala/asth_testbed_double/"
|
#meshdir = "/tiara/ara/data/mvaisala/asth_testbed_double/"
|
||||||
meshdir = "/scratch/data/mvaisala/forcingtest/"
|
meshdir = "/home/mvaisala/astaroth/build/"
|
||||||
|
|
||||||
if "xtopbound" in sys.argv:
|
if "xtopbound" in sys.argv:
|
||||||
for i in range(0, 171):
|
for i in range(0, 171):
|
||||||
@@ -199,6 +199,6 @@ if 'sl' in sys.argv:
|
|||||||
|
|
||||||
if 'ts' in sys.argv:
|
if 'ts' in sys.argv:
|
||||||
ts = ad.read.TimeSeries(fdir=meshdir)
|
ts = ad.read.TimeSeries(fdir=meshdir)
|
||||||
vis.lineplot.plot_ts(ts, lnrho=1, uutot=1, uux=1, ss=1)
|
vis.lineplot.plot_ts(ts, show_all=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ save_mesh(const AcMesh& save_mesh, const int step, const AcReal t_step)
|
|||||||
// This function prints out the diagnostic values to std.out and also saves and
|
// This function prints out the diagnostic values to std.out and also saves and
|
||||||
// appends an ascii file to contain all the result.
|
// appends an ascii file to contain all the result.
|
||||||
static inline void
|
static inline void
|
||||||
print_diagnostics(const int step, const AcReal dt, const AcReal t_step, FILE* diag_file)
|
print_diagnostics(const int step, const AcReal dt, const AcReal t_step, FILE* diag_file,
|
||||||
|
const AcReal sink_mass, const AcReal accreted_mass)
|
||||||
{
|
{
|
||||||
|
|
||||||
AcReal buf_rms, buf_max, buf_min;
|
AcReal buf_rms, buf_max, buf_min;
|
||||||
@@ -175,6 +176,10 @@ print_diagnostics(const int step, const AcReal dt, const AcReal t_step, FILE* di
|
|||||||
fprintf(diag_file, "%e %e %e ", double(buf_min), double(buf_rms), double(buf_max));
|
fprintf(diag_file, "%e %e %e ", double(buf_min), double(buf_rms), double(buf_max));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((sink_mass >= 0.0) || (accreted_mass >= 0.0)) {
|
||||||
|
fprintf(diag_file, "%e %e ", sink_mass, accreted_mass);
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(diag_file, "\n");
|
fprintf(diag_file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,11 +218,17 @@ run_simulation(void)
|
|||||||
fprintf(diag_file, "%s_min %s_rms %s_max ", vtxbuf_names[i], vtxbuf_names[i],
|
fprintf(diag_file, "%s_min %s_rms %s_max ", vtxbuf_names[i], vtxbuf_names[i],
|
||||||
vtxbuf_names[i]);
|
vtxbuf_names[i]);
|
||||||
}
|
}
|
||||||
|
#if LSINK
|
||||||
|
fprintf(diag_file, "sink_mass accreted_mass ");
|
||||||
|
#endif
|
||||||
fprintf(diag_file, "\n");
|
fprintf(diag_file, "\n");
|
||||||
|
|
||||||
write_mesh_info(&mesh_info);
|
write_mesh_info(&mesh_info);
|
||||||
print_diagnostics(0, AcReal(.0), t_step, diag_file);
|
#if LSINK
|
||||||
|
print_diagnostics(0, AcReal(.0), t_step, diag_file, mesh_info.real_params[AC_M_sink_init], 0.0);
|
||||||
|
#else
|
||||||
|
print_diagnostics(0, AcReal(.0), t_step, diag_file, -1.0, -1.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
acBoundcondStep();
|
acBoundcondStep();
|
||||||
acStore(mesh);
|
acStore(mesh);
|
||||||
@@ -265,6 +276,8 @@ run_simulation(void)
|
|||||||
on_off_switch = 1;
|
on_off_switch = 1;
|
||||||
}
|
}
|
||||||
acLoadDeviceConstant(AC_switch_accretion, on_off_switch);
|
acLoadDeviceConstant(AC_switch_accretion, on_off_switch);
|
||||||
|
#else
|
||||||
|
accreted_mass = -1.0; sink_mass = -1.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LFORCING
|
#if LFORCING
|
||||||
@@ -306,7 +319,7 @@ run_simulation(void)
|
|||||||
timeseries.ts.
|
timeseries.ts.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print_diagnostics(i, dt, t_step, diag_file);
|
print_diagnostics(i, dt, t_step, diag_file, sink_mass, accreted_mass);
|
||||||
printf("sink mass is: %.15e \n", sink_mass);
|
printf("sink mass is: %.15e \n", sink_mass);
|
||||||
printf("accreted mass is: %.15e \n", accreted_mass);
|
printf("accreted mass is: %.15e \n", accreted_mass);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user