diff --git a/acc/mhd_solver/stencil_process.sps b/acc/mhd_solver/stencil_process.sps index 714e742..58cfa96 100644 --- a/acc/mhd_solver/stencil_process.sps +++ b/acc/mhd_solver/stencil_process.sps @@ -253,11 +253,11 @@ forcing(int3 globalVertexIdx) //Placeholders until determined properly - Scalar magnitude = 0.05; - Vector k_force = (Vector){2.0, 0.0, 0.0}; - Vector ff_re = (Vector){0.0, 0.5, 0.0}; - Vector ff_im = (Vector){0.0, 0.8666, 0.0}; - Scalar phase = Scalar(0.79); + //Scalar magnitude = 0.05; + //Vector k_force = (Vector){2.0, 0.0, 0.0}; + //Vector ff_re = (Vector){0.0, 0.5, 0.0}; + //Vector ff_im = (Vector){0.0, 0.8666, 0.0}; + //Scalar phase = Scalar(0.79); //Determine that forcing funtion type at this point. diff --git a/src/core/astaroth.cu b/src/core/astaroth.cu index 956a24f..369082f 100644 --- a/src/core/astaroth.cu +++ b/src/core/astaroth.cu @@ -493,3 +493,30 @@ acSynchronize(void) return AC_SUCCESS; } + +//Tool for loadin forcing vector information into the device memory +AcResult +acForcingVec(const AcReal magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re, + const AcReal3 ff_hel_im, const AcReal phase) +{ + + loadDeviceConstant(device[i], AC_forcing_magnitude, AC_forcing_magnitude); + loadDeviceConstant(device[i], AC_forcing_phase, AC_forcing_phase ); + + loadDeviceConstant(device[i], AC_k_forcex, k_force.x); + loadDeviceConstant(device[i], AC_k_forcey, k_force.y); + loadDeviceConstant(device[i], AC_k_forcez, k_force.z); + + + loadDeviceConstant(device[i], AC_ff_hel_rex, ff_hel_re.x); + loadDeviceConstant(device[i], AC_ff_hel_rey, ff_hel_re.y); + loadDeviceConstant(device[i], AC_ff_hel_rez, ff_hel_re.z); + + loadDeviceConstant(device[i], AC_ff_hel_imx, ff_hel_im.x); + loadDeviceConstant(device[i], AC_ff_hel_imy, ff_hel_im.y); + loadDeviceConstant(device[i], AC_ff_hel_imz, ff_hel_im.z); + + return AC_SUCCESS; +} + + diff --git a/src/standalone/simulation.cc b/src/standalone/simulation.cc index 57cd0fe..d4cf7b9 100644 --- a/src/standalone/simulation.cc +++ b/src/standalone/simulation.cc @@ -236,10 +236,24 @@ run_simulation(void) AcReal bin_save_t = mesh_info.real_params[AC_bin_save_t]; AcReal bin_crit_t = bin_save_t; + + /* Step the simulation */ 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); + +#if LFORCING + //Generate a forcing vectors before canculating an integration step. + //Placeholders until determined properly + AcReal magnitude = 0.05; + AcReal phase = Scalar(0.79); + AcReal3 k_force = (AcReal3){2.0, 0.0, 0.0}; + AcReal3 ff_hel_re = (AcReal3){0.0, 0.5, 0.0}; + AcReal3 ff_hel_im = (AcReal3){0.0, 0.8666, 0.0}; + acForcingVec(magnitude, k_force, ff_hel_re,ff_hel_im, phase); +#endif + acIntegrate(dt); t_step += dt;