Wierdly behaving 3D objects / Meshes
I am pretty much a noob at fluid dynamics, but need to do some quick calculations on the characteristics of some boats for digital prototyping.
After some poking around I started to get a hang of FluidX3D and decided instead of just changing values, reading the docs and understanding the setup.cpp i would try to create my version of one of the scenarios.
In this case i took the f1 car simulation and tried to get one of our Dummy Models in. Which didn't really ended up working:
Here is a picture of the original 3D Model in Autodesk Fusion:
I know it is probably not recommended having models with multiple non connected parts, but this is the version i have at the moment, also tried other variants (different models in different simulations to try to debug it myself) which I unfortunately don't have anymore.
But a resume of my tests could be, that many of the models i tested were having weird shapes like that, and some would change their shapes while the simulation is running even though i set them as Solid.
Really don't know what is wrong / what i should try anymore. Thanks for any Help / Hint in advance
Here you can find the .stl file and my setup.cpp: issue.zip
Loads OK for me - you probably need a larger simulation? Try 14000u instead of 4000u
I ran it like this from WSL:-
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe start "cmd.exe '/c mode con: lines=80 & bin\FluidX3D.exe -f ..\..\cat.stl -r 16000 --SUBGRID --rotz 90 --rotx 180 --roty 180 --try -0.9 -y 1 -z 0.5 -x 0.3 -c 0.15 --aoa 0.0 --slomo 200.0 --fps 60 --SRT --UPDATE_FIELDS --GRAPHICS --EQUILIBRIUM_BOUNDARIES --FP16S --D3Q15 & pause'"
using my branch from here: https://github.com/gitcnd/FluidX3D/tree/inline_things
What are the "some quick calculations on the characteristics" you're trying to work out?
For context - I'm the author of the free Fusion360 "Airfoil Tools" add-in - which might also be able to help.
Hi @MGRAFF2006,
I'm sorry that the first thing you see is something not working. Let's get to the bottom of it. Thanks for already providing the reproducer! I need some more information: What hardware are you running this on? Maybe it is an issue with the particular drivers.
Running this exact reproducer on my system (tested on 3 OpenCL devices: Arc A750, UHD 630 and i7-8700K), the setup looks fine and I can't observe the artifacting. The mesh looks also fine.
To place the model in the center, use this:
Mesh* cat = read_stl(get_exe_path()+"../stl/cat.stl");
cat->rotate(float3x3(float3(0, 0, 1), radians(-90.0f))); // rotate -90 degrees around z-axis
const float scale = 0.8f*fmin(fmin(lbm_N.x/cat->get_bounding_box_size().x, lbm_N.y/cat->get_bounding_box_size().y), lbm_N.z/cat->get_bounding_box_size().z); // scale parts
cat->scale(scale);
const float3 offset = lbm.center()-cat->get_bounding_box_center();
cat->translate(offset);
cat->set_center(cat->get_bounding_box_center()); // set center of meshes to their bounding box center
lbm.voxelize_mesh_on_device(cat);
Kind regards, Moritz
Hi @MGRAFF2006,
is this issue resolved for you?
Kind regards, Moritz
I have the same problem on an Intel Iris Xe iGPU. The examples worked, so I tried a custom STL file, which had similar issues. Then found this issue and can reproduce the exact same weird rendering. There are no problems when run on CPU. I suspect either a driver issue or the iGPU doesn't have enough memory.
@MGRAFF2006 @ikozyris which exact iGPU from which CPU, and what driver version is it? Does it still show the artifacts with the latest Intel iGPU driver?
This is the output of lspci on Linux 6.8.0-1009-oem Ubuntu 24.04 and i7-1370P:
0000:00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
Subsystem: Dell Raptor Lake-P [Iris Xe Graphics]
Kernel driver in use: i915
Kernel modules: i915, xe
And glxinfo:
name of display: :0
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Intel (0x8086)
Device: Mesa Intel(R) Graphics (RPL-P) (0xa7a0)
Version: 24.0.9
Accelerated: yes
Video memory: 31704MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.6
Max compat profile version: 4.6
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) Graphics (RPL-P)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.0.9-0ubuntu0.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.0.9-0ubuntu0.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
intel-opencl-icd is version 23.43.27642.40-1ubuntu3 In its package description it mentions support for up to Alder Lake (12th gen), while I'm on Raptor Lake (13). I installed the latest drivers from intel repositories. Now the package is 24.22.29735.27-914~22.04 and the isssue persists (the noble package is for jammy?).
I am having similar issues voxelizing the Airshaper Formula 1 stl file
https://app.airshaper.com/simulations/aero-update-4-new-7ae386
@ProjectPhysX Sorry for answaring this Late, I was using an AMD 5600G With uptodate Drivers, I suppose it so a GPU Memory Issue, and on really small Memory, it Spams Like there is some buffer overflow or runaway Memory, behause out of regular positions there are Kind of Bars that extend out of them.
I came to this Idee, because it Spams Like that with at least one Intel and one AMD issue Driver Fallrückzieher Spams pretty unlikely in my eyes
The 5600G also has only about 500MB dedicated GPU memory
On my device, loading STLs works on windows with GPU, but on linux only with CPU (other simulations on linux are fine with GPU). So I suppose an issue with the opencl-icd package.
I have very small GPU memory too (256MB), but since the GPU can use normal memory as well (32GB) it shouldn't be a problem.
@ikozyris, i also have Shared Memory enabled, that means it can use up to 7gb of ram on my System, but i think what could be Happening in this casi is that it can‘t keep up in terms of Speed. It is the Same with swap, you can have a rediculous amount of it, but at some Point it is Not going to be used more, because it is Not feasable for the is anymore.
@MGRAFF2006 Have you tested if it works on windows? If there isn't enough memory it shouldn't work there too, but it did work for me. About swap, it may be slow but it still works
@lk251 what you posted is a different issue. This happens when the mesh is not watertight, meaning there is holes or overlapping triangles. There is software to fix such meshes, like 3D Builder. What also can help is reducing triangle count. See https://github.com/ProjectPhysX/FluidX3D/issues/59 and https://github.com/ProjectPhysX/FluidX3D/issues/215.
@MGRAFF2006 the iGPU has no dedicated memory, it just uses shared RAM. The RAM speed is not the issue - if it's slow than it will just take longer, but must still be the same computation result. It looks more like a driver bug to me. But it's strange that it happens on both Intel Raptor Lake iGPU and Ryzen iGPU. Do you have the latest version of FluidX3D? There was a related bug fix in voxization back in April. And does the bug happen only with a particular stl mesh or with all other meshes?
@ProjectPhysX thank you! I will try to fix the mesh and remove the tyres so I can make them rotate as in the W14 example. This is a much more realistic model of the current regulations f1 car so the results will be interesting.
@ProjectPhysX I was able to obtain the Blender file for the Airshaper car, if you know anyone interested in collaborating, please get them in touch so we can fix the model (make it watertight). Thank you!
We got the Airshaper model to work, I'm preparing a much larger simulation now. Again if anyone is interested in getting this to work please let me know.
@MGRAFF2006 why did you close the issue? The problem persists on my computer. All STLs work fine on Windows with either CPU or GPU. On Linux everything works on the CPU, but on the GPU, specific STLs (like the one you shared) don't, with the same renders as yours. The only reason I can think why this issue could be closed is if it only a driver issue, so not a FluidX3D bug. I have not noticed any other weird results from other OpenCL programs though.
Oh, i am verry sorry. I didn't ment to do this. I installed a new git Client today, and it send me notification. I ment to Press Mark as read.
I am sorry about that
Hi all,
I can confirm that this is a compiler bug in Intel GPU driver, affecting all modern Intel iGPUs (11th gen and up) as well as Arc Alchemist and Battlemage. I have forwarded it internally and will debug it with my colleagues.
For now, as a workaround, you can comment out this single line:
//intersections_check++;
Still I am baffled why @MGRAFF2006 found the same problem on AMD 5600G, which uses a completely different driver.
Kind regards, Moritz
Hi all,
I have fixed the broken voxelization now, please update!
The issue was that some compilers would replace if(x<1.0f) with the equivalent if(!(x>=1.0f)), which holds only as long as x!=NaN. Since I had passed the -cl-finite-math-only compiler option, the compiler is allowed to assume that x!=NaN is always given. However here in the voxelization there is cases where mesh triangles could be aligned in a way that causes division by zero, producing a NaN that would propagate into the if conditions and after the compiler's optimizations cause the hang. I solved it by explicitely excluding the division by zero case.
Kind regards, Moritz
I can confirm it now works perfectly! Thanks for tracking down the bug and explaining its cause. These unsafe math optimization bugs are really tedious to find.
hey guys, I am running on a rx7800xt with latested driver and latest source code, but I still suffer the same question. The STL files will only show very little part and the rest of it is missing.
@ProjectPhysX could you help to check if there is any problem? I have posted the screenshot here.
|-----------------------------------------------------------------------------| |----------------.------------------------------------------------------------| | Device ID 0 | AMD Radeon RX 7800 XT | |----------------'------------------------------------------------------------| |----------------.------------------------------------------------------------| | Device ID | 0 | | Device Name | AMD Radeon RX 7800 XT | | Device Vendor | Advanced Micro Devices, Inc. | | Device Driver | 3640.0 (PAL,LC) (Windows) | | OpenCL Version | OpenCL C 2.0 | | Compute Units | 30 at 2254 MHz (7680 cores, 34.621 TFLOPs/s) | | Memory, Cache | 16368 MB VRAM, 16 KB global / 64 KB local | | Buffer Limits | 16368 MB global, 16760832 KB constant | |----------------'------------------------------------------------------------| | Info: OpenCL C code successfully compiled. | | Info: Allocating memory. This may take a few seconds. | | Info: Loading "D:/FluidX3D/bin/1.stl" with 1797924 triangles. | |-----------------.-----------------------------------------------------------| | Grid Resolution | 420 x 420 x 420 = 74088000 | | Grid Domains | 1 x 1 x 1 = 1 | | LBM Type | D3Q19 SRT (FP32/FP16S) | | Memory Usage | CPU 1201 MB, GPU 1x 3911 MB | | Max Alloc Size | 2684 MB | | Time Steps | infinite | | Kin. Viscosity | 0.00003150 | | Relaxation Time | 0.50009448 | | Reynolds Number | Re < 13333334 | |---------.-------'-----.-----------.-------------------.---------------------| | MLUPs | Bandwidth | Steps/s | Current Step | Elapsed Time | | 74 | 7 GB/s | 1 | 0 | 5s |
Hi @do1234521,
can you please share your stl file and main_setup() function so I can try to reproduce?
Does it only happen on your 7800 XT or also other hardware like CPU? Find instructions for OpenCL CPU Runtime installation here.
Kind regards, Moritz
Hi @do1234521,
can you please share your stl file and
main_setup()function so I can try to reproduce? Does it only happen on your 7800 XT or also other hardware like CPU? Find instructions for OpenCL CPU Runtime installation here.Kind regards, Moritz
I tried to run on cpu but it failed to initialize. Here is what it reports. The setup file is just the Boeing 747 model part and I changed nothing except for different stl files and resolutions, and in the defines.hpp I just uncomment the EQUILIBRIUM_BOUNDARIES, SUBGRID, INTERACTIVE_GRAPHICS and GRAPHICS definition. Nothing else was changed in the source code. Change different stl files will not change this fault.
SYCL CPU RT Warning: Unknown host CPU.
|----------------.------------------------------------------------------------|
| Device ID 0 | AMD Radeon RX 7800 XT |
| Device ID 1 | AMD Ryzen 7 9700X 8-Core Processor |
|----------------'------------------------------------------------------------|
|----------------.------------------------------------------------------------|
| Device ID | 1 |
| Device Name | AMD Ryzen 7 9700X 8-Core Processor |
| Device Vendor | Intel(R) Corporation |
| Device Driver | 2024.18.10.0.08_160000 (Windows) |
| OpenCL Version | OpenCL C 3.0 |
| Compute Units | 16 at 0 MHz (8 cores, 0.000 TFLOPs/s) |
| Memory, Cache | 31849 MB RAM, 1024 KB global / 256 KB local |
| Buffer Limits | 31849 MB global, 128 KB constant |
|----------------'------------------------------------------------------------|
**Internal compiler error** Cannot select: 0x2402ab66320: v8i16 = X86ISD::CVTPS2PH 0x2402b01bf70, TargetConstant:i32<0>
0x2402b01bf70: v4f32 = bitcast 0x2402b01bef8
0x2402b01bef8: v2f64 = X86ISD::UNPCKH 0x2402ab599d8, 0x2402ab599d8
0x2402ab599d8: v2f64 = bitcast 0x2402ba5eb40
0x2402ba5eb40: v4f32 = fmul nnan ninf nsz 0x240273d8c80, 0x240273b4448
0x240273d8c80: v4f32 = bitcast 0x240273d8d70
0x240273d8d70: v2f64 = X86ISD::UNPCKL 0x240287f3d50, 0x240273d8b90
0x240287f3d50: v2f64 = bitcast 0x24027257918
0x24027257918: v4f32 = X86ISD::UNPCKL 0x2402b019a90, 0x240272552f8
0x2402b019a90: v4f32 = scalar_to_vector 0x24027261c88
0x240272552f8: v4f32 = scalar_to_vector 0x24027264078
0x240273d8b90: v2f64 = bitcast 0x24027257990
0x24027257990: v4f32 = X86ISD::UNPCKL 0x24027255370, 0x240272553e8
0x24027255370: v4f32 = scalar_to_vector 0x2402726eca8
0x240272553e8: v4f32 = scalar_to_vector 0x24027266878
0x240273b4448: v4f32,ch = load<(load (s128) from constant-pool)> 0x24024c13be0, 0x2402ab74fa8, undef:i64
0x2402ab74fa8: i64 = X86ISD::Wrapper TargetConstantPool:i64<> 0
0x24029b3f440: i64 = TargetConstantPool<> 0
0x2402ab74be8: i64 = undef
0x2402ab599d8: v2f64 = bitcast 0x2402ba5eb40
0x2402ba5eb40: v4f32 = fmul nnan ninf nsz 0x240273d8c80, 0x240273b4448
0x240273d8c80: v4f32 = bitcast 0x240273d8d70
0x240273d8d70: v2f64 = X86ISD::UNPCKL 0x240287f3d50, 0x240273d8b90
0x240287f3d50: v2f64 = bitcast 0x24027257918
0x24027257918: v4f32 = X86ISD::UNPCKL 0x2402b019a90, 0x240272552f8
0x2402b019a90: v4f32 = scalar_to_vector 0x24027261c88
0x240272552f8: v4f32 = scalar_to_vector 0x24027264078
0x240273d8b90: v2f64 = bitcast 0x24027257990
0x24027257990: v4f32 = X86ISD::UNPCKL 0x24027255370, 0x240272553e8
0x24027255370: v4f32 = scalar_to_vector 0x2402726eca8
0x240272553e8: v4f32 = scalar_to_vector 0x24027266878
0x240273b4448: v4f32,ch = load<(load (s128) from constant-pool)> 0x24024c13be0, 0x2402ab74fa8, undef:i64
0x2402ab74fa8: i64 = X86ISD::Wrapper TargetConstantPool:i64<> 0
0x24029b3f440: i64 = TargetConstantPool<> 0
0x2402ab74be8: i64 = undef
0x240287f7bc0: i32 = TargetConstant<0>
In function: initialize
Please report the issue on Intel OpenCL forum
https://software.intel.com/en-us/forums/opencl for assistance.
Hi @do1234521,
do you see those voxelization artifacts with other .stl files too? Is it possible that your .stl file is is not watertight and/or has broken triangles or super small overlapping triangles? Can you maybe share your .stl with me (either post here or send me via email) so I can check?
Kind regards, Moritz
Hi @do1234521,
do you see those voxelization artifacts with other
.stlfiles too? Is it possible that your.stlfile is is not watertight and/or has broken triangles or super small overlapping triangles? Can you maybe share your.stlwith me (either post here or send me via email) so I can check?Kind regards, Moritz
I tried to use the same code and stl file on my laptop which is an Intel cpu and nvidia rtx2060 gpu. Everything works good on laptop but still abnormal on this AMD machine.
void main_setup() { // Boeing 747; required extensions in defines.hpp: FP16S, EQUILIBRIUM_BOUNDARIES, SUBGRID, INTERACTIVE_GRAPHICS or GRAPHICS
// ################################################################## define simulation box size, viscosity and volume force ###################################################################
const uint3 lbm_N = resolution(float3(0.05f, 0.05f, 0.05f), 2500u); // input: simulation box aspect ratio and VRAM occupation in MB, output: grid resolution
const float lbm_Re = 200000.0f;
const float lbm_u = 0.075f;
const ulong lbm_T = 10000ull;
LBM lbm(lbm_N, units.nu_from_Re(lbm_Re, (float)lbm_N.x, lbm_u));
// ###################################################################################### define geometry ######################################################################################
const float size = 1.0f * lbm.size().x;
const float3 center = float3(lbm.center().x, 0.5f * size, lbm.center().z);
const float3x3 rotation = float3x3(float3(1, 0, 0), radians(-15.0f));
lbm.voxelize_stl(get_exe_path() + "wing.stl", center, rotation, size); // https://www.thingiverse.com/thing:2772812/files
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);
if (lbm.flags[n] != TYPE_S) lbm.u.y[n] = lbm_u;
if (x == 0u || x == Nx - 1u || y == 0u || y == Ny - 1u || z == 0u || z == Nz - 1u) lbm.flags[n] = TYPE_E; // all non periodic
}); // ####################################################################### run simulation, export images and data ##########################################################################
lbm.graphics.visualization_modes = VIS_FLAG_SURFACE | VIS_Q_CRITERION;
#if defined(GRAPHICS) && !defined(INTERACTIVE_GRAPHICS)
lbm.graphics.set_camera_free(float3(1.0f * (float)Nx, -0.4f * (float)Ny, 2.0f * (float)Nz), -33.0f, 42.0f, 68.0f);
lbm.run(0u, lbm_T); // initialize simulation
while (lbm.get_t() < lbm_T) { // main simulation loop
if (lbm.graphics.next_frame(lbm_T, 10.0f)) lbm.graphics.write_frame(); // render enough frames 10 seconds of 60fps video
lbm.run(1u, lbm_T);
}
#else // GRAPHICS && !INTERACTIVE_GRAPHICS
lbm.run();
#endif // GRAPHICS && !INTERACTIVE_GRAPHICS
} /*
Hi @do1234521,
I can't reproduce this unfortunately. I'm seeing the delta wing correctly voxelized even on an AMD MI50 GPU with driver 3635.0 (Linux).
The mesh looks ok; I'd rule out issues with that.
Can you confirm that in the console printout you're reading FluidX3D Version 3.2?
Does the corrupted voxelization look the same for you every time, or do you see voxelized cells in different locations every time?
Kind regards, Moritz
Hi @do1234521,
I had fixed the remaining STL voxelization bug with the AMD driver ~3 weeks ago, and forgot to reply here. Please update. Link to the other fix and resolution: https://github.com/ProjectPhysX/FluidX3D/issues/290#issuecomment-3015090111
Kind regards, Moritz