Closed rodionstepanov closed 9 months ago
Hi @rodionstepanov,
I cannot reproduce the issue. I see two image files with the correct visualization modes for the same time step:
vimage-#########.png
qimage-#########.png
Note: add a /
to the end of "export/v/"
to store the images in separate folders.
Maybe you've set the initial conditions such that fluid velocity=0 everywhere and the images appear the same? Can you share your full setup function?
Kind regards, Moritz
Thank you @ProjectPhysX ! Indeed if add /
to the end then I got different images (as I expected). However I'm puzzled why it is so important. I believed that it is just my choice to give a file name. What should I do if I want to have all images in the same directory export
but with different prefix v
and q
for different visualization_modes like vimage-000000400.png
and qimage-000000400.png
?
In my testing it also works correctly without the /
, in which case the two images are stored in the same folder with different prefixes. Can you please test again? You can also set a different filename other than "image" with
write_frame(get_exe_path()+"export/", "custom_file_name");
to store the image as custom_file_name-#########.png
.
In my testing it also works correctly without the
/
,
"custom_file_name" does not help. Images are the same.
Then please check my main_setup()
void main_setup() { // 3D Taylor-Green vortices; required extensions in defines.hpp: INTERACTIVE_GRAPHICS
// ################################################################## define simulation box size, viscosity and volume force ###################################################################
LBM lbm(128u, 128u, 128u, 1u, 1u, 1u, 0.01f);
// ###################################################################################### define geometry ######################################################################################
const uint Nx=lbm.get_Nx(), Ny=lbm.get_Ny(), Nz=lbm.get_Nz(); parallel_for(lbm.get_N(), [&](ulong n) { uint x=0u, y=0u, z=0u; lbm.coordinates(n, x, y, z);
const float A = 0.25f;
const uint periodicity = 1u;
const float a=(float)Nx/(float)periodicity, b=(float)Ny/(float)periodicity, c=(float)Nz/(float)periodicity;
const float fx = (float)x+0.5f-0.5f*(float)Nx;
const float fy = (float)y+0.5f-0.5f*(float)Ny;
const float fz = (float)z+0.5f-0.5f*(float)Nz;
lbm.u.x[n] = A*cosf(2.0f*pif*fx/a)*sinf(2.0f*pif*fy/b)*sinf(2.0f*pif*fz/c);
lbm.u.y[n] = -A*sinf(2.0f*pif*fx/a)*cosf(2.0f*pif*fy/b)*sinf(2.0f*pif*fz/c);
lbm.u.z[n] = A*sinf(2.0f*pif*fx/a)*sinf(2.0f*pif*fy/b)*cosf(2.0f*pif*fz/c);
lbm.rho[n] = 1.0f-sq(A)*3.0f/4.0f*(cosf(4.0f*pif*fx/a)+cosf(4.0f*pif*fy/b));
}); // ####################################################################### run simulation, export images and data ##########################################################################
lbm.run(0u); // initialize simulation
lbm.graphics.set_camera_free(float3((float)Nx, (float)Ny, (float)Nz), -78.0f, 6.0f, 22.0f);
lbm.graphics.set_camera_centered(-249.0f, 22.9f, 22.0f, 0.656533f);
lbm.graphics.visualization_modes = VIS_FLAG_LATTICE | VIS_FIELD;
lbm.graphics.write_frame(get_exe_path() + "export/v");
lbm.graphics.visualization_modes = VIS_FLAG_LATTICE | VIS_Q_CRITERION;
lbm.graphics.write_frame(get_exe_path() + "export/q");
//lbm.graphics.visualization_modes = VIS_STREAMLINES;
lbm.run();
//lbm.run(1000u); lbm.u.read_from_device(); println(lbm.u.x[lbm.index(Nx/2u, Ny/2u, Nz/2u)]); wait(); // test for binary identity
}
Hi @rodionstepanov,
thanks for sharing your setup! I was initially looking for the wrong thing: with only GRAPHICS
mode it works fine, but for INTERACTIVE_GRAPHICS
it indeed does not work. The bug was in an optimization I did to skip rendering the next frame if the camera did not move and no new time step was computed. I missed to include checking for changes in visualization_modes
. I have fixed this now!
Thank you for reporting these bugs!
Kind regards, Moritz
Hi! Images are the same for this
How can get different plot for the same time step?