Now compiles and runs.

PLEASE NOTE THAT FLAGS NEED TO BE SET SEPARATELY IN simulation.cc and renderer.cc FOR LSINK and LFORCING!
This commit is contained in:
Miikka Vaisala
2019-09-02 14:47:58 +08:00
parent 02ac6c956f
commit b4cd92da0c
5 changed files with 21 additions and 15 deletions

View File

@@ -1,9 +1,9 @@
#define LDENSITY (1)
#define LHYDRO (1)
#define LMAGNETIC (1)
#define LENTROPY (1)
#define LMAGNETIC (0)
#define LENTROPY (0)
#define LTEMPERATURE (0)
#define LFORCING (1)
#define LFORCING (0)
#define LUPWD (1)
#define LSINK (1)

View File

@@ -456,8 +456,8 @@ out ScalarField out_tt(VTXBUF_TEMPERATURE);
#endif
#if LSINK
in Scalar accretion = VTXBUF_ACCRETION;
out Scalar out_accretion = VTXBUF_ACCRETION;
in ScalarField accretion(VTXBUF_ACCRETION);
out ScalarField out_accretion(VTXBUF_ACCRETION);
#endif
Kernel void
@@ -471,13 +471,13 @@ solve()
#endif
#if LENTROPY
out_uu = rk3(out_uu, uu, momentum(uu, lnrho, ss, aa), dt);
out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, ss, aa, dt), dt);
out_ss = rk3(out_ss, ss, entropy(ss, uu, lnrho, aa), dt);
#elif LTEMPERATURE
out_uu = rk3(out_uu, uu, momentum(uu, lnrho, tt), dt);
out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, tt, dt), dt);
out_tt = rk3(out_tt, tt, heat_transfer(uu, lnrho, tt), dt);
#else
out_uu = rk3(out_uu, uu, momentum(uu, lnrho), dt);
out_uu = rk3(out_uu, uu, momentum(globalVertexIdx, uu, lnrho, dt), dt);
#endif
#if LFORCING

View File

@@ -34,10 +34,10 @@
// Standalone flags
#define LDENSITY (1)
#define LHYDRO (1)
#define LMAGNETIC (1)
#define LENTROPY (1)
#define LMAGNETIC (0)
#define LENTROPY (0)
#define LTEMPERATURE (0)
#define LFORCING (1)
#define LFORCING (0)
#define LUPWD (1)
#define AC_THERMAL_CONDUCTIVITY (AcReal(0.001)) // TODO: make an actual config parameter

View File

@@ -41,6 +41,10 @@
#include "src/core/math_utils.h"
#include "timer_hires.h"
//NEED TO BE DEFINED HERE. IS NOT NOTICED BY compile_acc call.
#define LFORCING (0)
#define LSINK (1)
// Window
SDL_Renderer* renderer = NULL;
static SDL_Window* window = NULL;

View File

@@ -40,6 +40,10 @@
#include <sys/stat.h>
#include <sys/types.h>
//NEED TO BE DEFINED HERE. IS NOT NOTICED BY compile_acc call.
#define LFORCING (0)
#define LSINK (1)
// Write all setting info into a separate ascii file. This is done to guarantee
// that we have the data specifi information in the thing, even though in
// principle these things are in the astaroth.conf.
@@ -254,9 +258,7 @@ run_simulation(void)
// acUpdate_sink_particle() will do the similar trick to the device.
/* Step the simulation */
#if LSINK
AcReal accreted_mass = 0.0;
#endif
AcReal accreted_mass = 0.0; AcReal sink_mass = 0.0;
for (int i = 1; i < max_steps; ++i) {
const AcReal umax = acReduceVec(RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
const AcReal dt = host_timestep(umax, mesh_info);
@@ -265,7 +267,7 @@ run_simulation(void)
const AcReal sum_mass = acReduceScal(RTYPE_SUM, VTXBUF_ACCRETION);
accreted_mass = accreted_mass + sum_mass;
AcReal sink_mass = 0.0;
sink_mass = 0.0;
sink_mass = mesh_info.real_params[AC_M_sink_init] + accreted_mass;
acLoadDeviceConstant(AC_M_sink, sink_mass);
vertex_buffer_set(VTXBUF_ACCRETION, 0.0, mesh);