STLreader error?
› Forums › OpenLB › General Topics › STLreader error?
- This topic has 6 replies, 2 voices, and was last updated 5 months, 1 week ago by arjun_raf.
-
AuthorPosts
-
August 12, 2025 at 3:47 pm #10639arjun_rafParticipant
Hi all,
I am pretty new to OpenLB and it has only been few weeks since I started working on it. Coming to my problem, I created an STL model of the simulation volume and loaded it using STLreader. And inside the prepareGeometry I did very basic material number assignment and tried printing out the superGeometry statistics. The output feels “wrong” since the number of Nodes are extremely low and number of Cuboids is displayed as 0. Below is my minimal code.#include <olb.h> using namespace olb; using namespace olb::descriptors; using T = FLOATING_POINT_TYPE; using DESCRIPTOR = descriptors::D3Q19<>; void prepareGeometry( UnitConverter<T,DESCRIPTOR> const& converter, IndicatorF3D<T>& indicator, STLreader<T>& simvol, SuperGeometry<T,3>& superGeometry ){ superGeometry.rename( 0,2,indicator ); superGeometry.rename( 2,1,simvol ); superGeometry.clean(); superGeometry.checkForErrors(); superGeometry.print(); } int main(int argc, char* argv[]){ initialize(argc, argv); OstreamManager clout(std::cout, "main"); const UnitConverter<T,DESCRIPTOR> converter( ....... ); converter.print(); STLreader<T> simvol( "sim_volume.stl", converter.getPhysDeltaX(), 0.001); IndicatorLayer3D<T> extendedDomain( simvol, converter.getPhysDeltaX() ); const int numCuboids = 1; //for serial execution CuboidDecomposition3D<T> cuboidDecomposition( extendedDomain, converter.getPhysDeltaX(), numCuboids ); HeuristicLoadBalancer<T> loadBalancer( cuboidDecomposition ); SuperGeometry<T,3> superGeometry( cuboidDecomposition, loadBalancer ); prepareGeometry( converter, extendedDomain, simvol, superGeometry ); return 0; }The output that I am getting is:
[SuperGeometry3D] cleaned 0 outer boundary voxel(s)
[SuperGeometry3D] the model is correct!
[CuboidDecomposition] —Cuboid Structure Statistics—
[CuboidDecomposition] Number of Cuboids: 0
[CuboidDecomposition] Delta : 0.01
[CuboidDecomposition] Ratio (min): 1
[CuboidDecomposition] (max): 1
[CuboidDecomposition] Nodes (min): 8
[CuboidDecomposition] (max): 8
[CuboidDecomposition] Weight (min): 8
[CuboidDecomposition] (max): 8
[CuboidDecomposition] ——————————–
[SuperGeometryStatistics3D] countTotal[1e6]=0Any help would be appreciated.
August 12, 2025 at 3:51 pm #10640mathiasKeymasterDid you check that the scaling is right? Does the dx lenth (given in meter) fits to the by 0.001 scaled values of the stlReader?
August 12, 2025 at 10:58 pm #10642arjun_rafParticipantHey @mathias,
My stl model is in metres, 41.56 m to be precise. dx was then given as ~1e-3. I noticed that I made a mistake in the above code for the stlSize scaling factor which I changed to 1. Even then, the output remains the same. I can show the modified parts of the code below:const T physLength = 41.56; // reference length of simulation geometry in [m] const T N = 40000; // number of voxels per charPhysL const T dx = physLength / N; // lattice spacing in [m] const T CFL = 0.05; const T Re = 20; ... ... UnitConverter<T,DESCRIPTOR> converter( (T) dx, // physDeltaX: spacing between two lattice cells in [m] (T) CFL*dx/0.2, // physDeltaT: time step in [s] (T) physLength, // charPhysLength: reference length of simulation geometry in [m] (T) 0.2, // charPhysVelocity: highest expected velocity during simulation in [m/s] (T) 0.2*0.05/Re, // physViscosity: physical kinematic viscosity in [m^2/s] (T) 1000.0 // physDensity: physical density in [kg/m^3] ); converter.print(); STLreader<T> simvol( "sim_volume.stl", converter.getPhysDeltaX(), 1);The rest remains the same.
August 13, 2025 at 9:34 am #10643mathiasKeymasterDid you check that your stl-surface is watertight and enirely closing the fluid domain?
August 13, 2025 at 12:35 pm #10644arjun_rafParticipant@mathias Yes. In fact, the stl is based on a .prt file that I use to run simulations on StarCCM+. Just to check if the issue is with my model, I created a very simple “flow around a cylinder” model (500 mm X 220 mm) and ran it again. Below is the changed parts of the code:
const T physLength = 0.5; // reference length of simulation geometry in [m] const T N = 100; // number of voxels per charPhysL const T dx = physLength / N; // lattice spacing in [m] const T CFL = 0.05; const T Re = 20; .... .... UnitConverter<T,DESCRIPTOR> converter( (T) dx, // physDeltaX: spacing between two lattice cells in [m] (T) CFL*dx/0.2, // physDeltaT: time step in [s] (T) physLength, // charPhysLength: reference length of simulation geometry in [m] (T) 0.2, // charPhysVelocity: highest expected velocity during simulation in [m/s] (T) 0.2*0.05/Re, // physViscosity: physical kinematic viscosity in [m^2/s] (T) 1000.0 // physDensity: physical density in [kg/m^3] ); converter.print(); STLreader<T> simvol( "flowaroundcylinder.stl", converter.getPhysDeltaX(), 0.001);I am still getting the same output as above. I’m not sure what I’m doing wrong 🙁
August 13, 2025 at 9:50 pm #10645mathiasKeymasterWe have a couple of working stl at our many example.. have a look there.. we also use very complex stls with GB sizes and they work. You need to avoid double layers and holes..
August 14, 2025 at 12:19 pm #10647 -
AuthorPosts
- You must be logged in to reply to this topic.
