Trying to figure out how to upload values to GPU.
This commit is contained in:
@@ -253,11 +253,11 @@ forcing(int3 globalVertexIdx)
|
|||||||
|
|
||||||
|
|
||||||
//Placeholders until determined properly
|
//Placeholders until determined properly
|
||||||
Scalar magnitude = 0.05;
|
//Scalar magnitude = 0.05;
|
||||||
Vector k_force = (Vector){2.0, 0.0, 0.0};
|
//Vector k_force = (Vector){2.0, 0.0, 0.0};
|
||||||
Vector ff_re = (Vector){0.0, 0.5, 0.0};
|
//Vector ff_re = (Vector){0.0, 0.5, 0.0};
|
||||||
Vector ff_im = (Vector){0.0, 0.8666, 0.0};
|
//Vector ff_im = (Vector){0.0, 0.8666, 0.0};
|
||||||
Scalar phase = Scalar(0.79);
|
//Scalar phase = Scalar(0.79);
|
||||||
|
|
||||||
|
|
||||||
//Determine that forcing funtion type at this point.
|
//Determine that forcing funtion type at this point.
|
||||||
|
@@ -493,3 +493,30 @@ acSynchronize(void)
|
|||||||
|
|
||||||
return AC_SUCCESS;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -236,10 +236,24 @@ run_simulation(void)
|
|||||||
AcReal bin_save_t = mesh_info.real_params[AC_bin_save_t];
|
AcReal bin_save_t = mesh_info.real_params[AC_bin_save_t];
|
||||||
AcReal bin_crit_t = bin_save_t;
|
AcReal bin_crit_t = bin_save_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Step the simulation */
|
/* Step the simulation */
|
||||||
for (int i = 1; i < max_steps; ++i) {
|
for (int i = 1; i < max_steps; ++i) {
|
||||||
const AcReal umax = acReduceVec(RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
|
const AcReal umax = acReduceVec(RTYPE_MAX, VTXBUF_UUX, VTXBUF_UUY, VTXBUF_UUZ);
|
||||||
const AcReal dt = host_timestep(umax, mesh_info);
|
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);
|
acIntegrate(dt);
|
||||||
|
|
||||||
t_step += dt;
|
t_step += dt;
|
||||||
|
Reference in New Issue
Block a user