Open main menu

CDOT Wiki β

Changes

BetaT

48 bytes added, 17:52, 29 March 2017
Original Problems when converting a program to use the GPU
for (int k = 0; k <= nx - 1; k++)
if (k*dx >= 0.5 && k*dx <= 1)
{
u[k * nt + 0] = 2;
}
else
{
u[k * nt + 0] = 1;
}
for (int it = 1; it <= nx - 1; it++)
{
for (int k = 0; k <= nx - 1; k++)
{
un[k * nx + it - 1] = u[k * nx + it - 1];
}
for (int m = 1; m <= nx - 1; m++)
{
u[0 * nx + it] = un[1 * nx + it - 1];
u[m * nx + it] = un[m * nx + it - 1] - c*dt / dx*(un[m * nx + it - 1] - un[(m - 1) * nx + it - 1]);
}'''
}'''
212
edits