Skip to content

STLreader error?

Due to recent bot attacks we have changed the sign-up process. If you want to participate in our forum, first register on this website and then send a message via our contact form.

Forums OpenLB General Topics STLreader error?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #10639
    arjun_raf
    Participant

    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]=0

    Any help would be appreciated.

    #10640
    mathias
    Keymaster

    Did 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?

    #10642
    arjun_raf
    Participant

    Hey @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.

    #10643
    mathias
    Keymaster

    Did you check that your stl-surface is watertight and enirely closing the fluid domain?

    #10644
    arjun_raf
    Participant

    @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 🙁

    #10645
    mathias
    Keymaster

    We 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..

    #10647
    arjun_raf
    Participant

    @mathias I think I figured it out. It was an issue with the STL file format. I was exporting my .prt file to STL in binary encoding(?) instead of ASCII. I switched to ASCII based stl and the program voxelised my part.
    Thanks for your inputs!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.