Can move forcing vector information now from the host to device.
next step in to generate random waves in the CPU with a chosen degree of helicity etc.
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 = DCONST_REAL(AC_forcing_magnitude);
|
||||||
//Vector k_force = (Vector){2.0, 0.0, 0.0};
|
Scalar phase = DCONST_REAL(AC_forcing_phase);
|
||||||
//Vector ff_re = (Vector){0.0, 0.5, 0.0};
|
Vector k_force = (Vector){ DCONST_REAL(AC_k_forcex), DCONST_REAL(AC_k_forcey), DCONST_REAL(AC_k_forcez)};
|
||||||
//Vector ff_im = (Vector){0.0, 0.8666, 0.0};
|
Vector ff_re = (Vector){DCONST_REAL(AC_ff_hel_rex), DCONST_REAL(AC_ff_hel_rey), DCONST_REAL(AC_ff_hel_rez)};
|
||||||
//Scalar phase = Scalar(0.79);
|
Vector ff_im = (Vector){DCONST_REAL(AC_ff_hel_imx), DCONST_REAL(AC_ff_hel_imy), DCONST_REAL(AC_ff_hel_imz)};
|
||||||
|
|
||||||
|
|
||||||
//Determine that forcing funtion type at this point.
|
//Determine that forcing funtion type at this point.
|
||||||
|
@@ -158,6 +158,19 @@ extern "C" {
|
|||||||
FUNC(AC_angl_uu), \
|
FUNC(AC_angl_uu), \
|
||||||
FUNC(AC_lnrho_edge),\
|
FUNC(AC_lnrho_edge),\
|
||||||
FUNC(AC_lnrho_out),\
|
FUNC(AC_lnrho_out),\
|
||||||
|
/* Forcing parameters. User configured. */\
|
||||||
|
FUNC(AC_forcing_magnitude),\
|
||||||
|
/* Forcing parameters. Set by the generator. */\
|
||||||
|
FUNC(AC_forcing_phase),\
|
||||||
|
FUNC(AC_k_forcex),\
|
||||||
|
FUNC(AC_k_forcey),\
|
||||||
|
FUNC(AC_k_forcez),\
|
||||||
|
FUNC(AC_ff_hel_rex),\
|
||||||
|
FUNC(AC_ff_hel_rey),\
|
||||||
|
FUNC(AC_ff_hel_rez),\
|
||||||
|
FUNC(AC_ff_hel_imx),\
|
||||||
|
FUNC(AC_ff_hel_imy),\
|
||||||
|
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),\
|
||||||
@@ -373,6 +386,11 @@ AcResult acQuit(void);
|
|||||||
unless otherwise stated. */
|
unless otherwise stated. */
|
||||||
AcResult acSynchronize(void);
|
AcResult acSynchronize(void);
|
||||||
|
|
||||||
|
/** Tool for loading forcing vector information into the device memory
|
||||||
|
*/
|
||||||
|
AcResult acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
||||||
|
const AcReal3 ff_hel_im, const AcReal forcing_phase);
|
||||||
|
|
||||||
/* End extern "C" */
|
/* End extern "C" */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -494,27 +494,28 @@ acSynchronize(void)
|
|||||||
return AC_SUCCESS;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tool for loadin forcing vector information into the device memory
|
//Tool for loading forcing vector information into the device memory
|
||||||
AcResult
|
AcResult
|
||||||
acForcingVec(const AcReal magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
acForcingVec(const AcReal forcing_magnitude, const AcReal3 k_force, const AcReal3 ff_hel_re,
|
||||||
const AcReal3 ff_hel_im, const AcReal phase)
|
const AcReal3 ff_hel_im, const AcReal forcing_phase)
|
||||||
{
|
{
|
||||||
|
|
||||||
loadDeviceConstant(device[i], AC_forcing_magnitude, AC_forcing_magnitude);
|
for (int i = 0; i < num_devices; ++i) {
|
||||||
loadDeviceConstant(device[i], AC_forcing_phase, AC_forcing_phase );
|
loadDeviceConstant(devices[i], AC_forcing_magnitude, forcing_magnitude);
|
||||||
|
loadDeviceConstant(devices[i], AC_forcing_phase, forcing_phase );
|
||||||
|
|
||||||
loadDeviceConstant(device[i], AC_k_forcex, k_force.x);
|
loadDeviceConstant(devices[i], AC_k_forcex, k_force.x);
|
||||||
loadDeviceConstant(device[i], AC_k_forcey, k_force.y);
|
loadDeviceConstant(devices[i], AC_k_forcey, k_force.y);
|
||||||
loadDeviceConstant(device[i], AC_k_forcez, k_force.z);
|
loadDeviceConstant(devices[i], AC_k_forcez, k_force.z);
|
||||||
|
|
||||||
|
loadDeviceConstant(devices[i], AC_ff_hel_rex, ff_hel_re.x);
|
||||||
|
loadDeviceConstant(devices[i], AC_ff_hel_rey, ff_hel_re.y);
|
||||||
|
loadDeviceConstant(devices[i], AC_ff_hel_rez, ff_hel_re.z);
|
||||||
|
|
||||||
loadDeviceConstant(device[i], AC_ff_hel_rex, ff_hel_re.x);
|
loadDeviceConstant(devices[i], AC_ff_hel_imx, ff_hel_im.x);
|
||||||
loadDeviceConstant(device[i], AC_ff_hel_rey, ff_hel_re.y);
|
loadDeviceConstant(devices[i], AC_ff_hel_imy, ff_hel_im.y);
|
||||||
loadDeviceConstant(device[i], AC_ff_hel_rez, ff_hel_re.z);
|
loadDeviceConstant(devices[i], AC_ff_hel_imz, ff_hel_im.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;
|
return AC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@@ -247,7 +247,7 @@ run_simulation(void)
|
|||||||
//Generate a forcing vectors before canculating an integration step.
|
//Generate a forcing vectors before canculating an integration step.
|
||||||
//Placeholders until determined properly
|
//Placeholders until determined properly
|
||||||
AcReal magnitude = 0.05;
|
AcReal magnitude = 0.05;
|
||||||
AcReal phase = Scalar(0.79);
|
AcReal phase = 0.79;
|
||||||
AcReal3 k_force = (AcReal3){2.0, 0.0, 0.0};
|
AcReal3 k_force = (AcReal3){2.0, 0.0, 0.0};
|
||||||
AcReal3 ff_hel_re = (AcReal3){0.0, 0.5, 0.0};
|
AcReal3 ff_hel_re = (AcReal3){0.0, 0.5, 0.0};
|
||||||
AcReal3 ff_hel_im = (AcReal3){0.0, 0.8666, 0.0};
|
AcReal3 ff_hel_im = (AcReal3){0.0, 0.8666, 0.0};
|
||||||
|
Reference in New Issue
Block a user