Skip to content

stl units and format

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #9633
    talco
    Participant

    Hello,
    I have been trying to change the stl geometry in the cylinder3d code with a new stl file, and I’m getting the “STL File not valid” error.
    The new stl file is stored in the application folder.
    It would be great if you could explain the necessary steps needed to change it correctly

    I’m starting with a cad model and using Solidworks-or-FreeCAD to change it into an stl file1)  should the stl be saved in ascii or binary  format
    2)  I know from the User Guide that “ the scaling factor stlSize should be set to the units of the STL part. If it is exported in meters, the scaling factor is 1, if in millimeters then it is 0.001 “My case I have a solid (filled) stl mesh geometry that is 20mm longwhen saving the file in solidworks I choose Units to be millimeters. Does this mean that my stlSize parameter needs to be 0.001 ?Also if the stlSize parameter is set to 0.001, Does the voxelSize need to be in the range of 0.0005 and smaller ?
    I have noticed that the model in the cylinder3d stl file is also solid and is 2.5m long, is that its dimension in the cylinder3d simulation ? because the voxel size is set to 0.001 and no stlSize is defined, as seen in the following line:
    STLreader<T> stlReader( “cylinder3d.stl”, converter.getConversionFactorLength(), 0.001 );
    where:
    STLreader<T> stlreader(“filename.stl”, voxelSize, stlSize, method, verbose);
    Thanks in advance
    Tal.
    On Mon, Dec 30, 2024 at 2:43 PM AC <ackoc23@gmail.com> wrote:
    Hello,
    I have been trying to change the stl geomtry in the cylinder3d with a new stl, and I’m getting the “STL File not valid” error.
    It would be great if you could explaine the neccery steps needed to change it correctly

    I’m starting with a cad model and using Solidworks-or-FreeCAD to change it into an stl file
    but it’s not clear what units the part needs be.
    The new stl file is stored current application folder
    in my case I have a a 20mm long cylinder
    I have noticed that the the model in the cylinder3d stl file is 2.5m long, is that it’s dimention in the cylinder3d simulation ? because the voxel size is set to 0.001 and no stlSize is defined, as seen in the following line:
    STLreader<T> stlReader( “cylinder3d.stl”, converter.getConversionFactorLength(), 0.001 );
    where:
    STLreader<T> stlreader(“filename.stl”, voxelSize, stlSize, method, verbose);

    On Mon, Dec 30, 2024 at 8:04 AM AC <ackoc23@gmail.com> wrote:
     MatzerInnerVol.STEP  MatzerInnerVol_m.STL  MatzerInnerVol_mm.STL
    On Sun, Dec 29, 2024 at 3:20 PM AC <ackoc23@gmail.com> wrote:

    #9634
    talco
    Participant

    Im sorry for the mess above, a small problem with copy paste 🙂
    In any case, I have now generated the stl file with FreeCAD instead of solid works, and I’m no longer getting the “STL File not valid” error.

    Bad sadly i’m getting a new error:
    [prepareGeometry] Prepare Geometry …
    [SuperGeometry3D] cleaned 0 outer boundary voxel(s)
    cylinder3d: ../../../src/functors/analytical/indicator/indicatorF3D.hh:643: olb::IndicatorCuboid3D<T>::IndicatorCuboid3D(olb::Vector<T, 3>, olb::Vector<T, 3>) [with S = double]: Assertion `_xLength>0 && _yLength>0 && _zLength>0′ failed.
    Aborted (core dumped)

    #9635
    talco
    Participant

    Im sorry for the mess above, a small problem with copy paste 🙂
    In any case, I have now generated the stl file with FreeCAD instead of solid works, and I’m no longer getting the “STL File not valid” error.

    Bad sadly i’m getting a new error:
    [prepareGeometry] Prepare Geometry …
    [SuperGeometry3D] cleaned 0 outer boundary voxel(s)
    cylinder3d: ../../../src/functors/analytical/indicator/indicatorF3D.hh:643: olb::IndicatorCuboid3D<T>::IndicatorCuboid3D(olb::Vector<T, 3>, olb::Vector<T, 3>) [with S = double]: Assertion `_xLength>0 && _yLength>0 && _zLength>0′ failed.
    Aborted (core dumped)

    #9636
    Adrian
    Keymaster

    Likely the units are not matching up between simulation and STL (causing a negative extend to be passed to the cuboid indicator)

    #9637
    talco
    Participant

    Thank you Adrian for the fast reply
    this is a link for an image of the stl file, it’s a simple file

    stl file image

    this is how I set up the stlReader for the millimeters case:
    STLreader<T> stlReader( "Matmm.stl", converter.getConversionFactorLength(), 0.0001, 0.001 );
    I have also tryed changing the stlSize to 1, like so
    STLreader<T> stlReader( "Matmm.stl", converter.getConversionFactorLength(), 0.0001, 1 );

    In both cases I’m getting the same error

    if needed I can send the stl file

    #9638
    talco
    Participant

    Below is a section of my prepareGeometry where I’m getting my error
    I have printed the xtend and origin that are used for IndicatorCuboid3D

    ============Terminal messages=====================
    [prepareGeometry] Prepare Geometry …
    [SuperGeometry3D] cleaned 0 outer boundary voxel(s)
    [prepareGeometry] origin =
    [prepareGeometry] [-0.01 0.005 0.005]
    [prepareGeometry] Pextend =
    [prepareGeometry] [0.02 -0.01 -0.01]
    cylinder3d: ../../../src/functors/analytical/indicator/indicatorF3D.hh:643: olb::IndicatorCuboid3D<T>::IndicatorCuboid3D(olb::Vector<T, 3>, olb::Vector<T, 3>) [with S = double]: Assertion `_xLength>0 && _yLength>0 && _zLength>0′ failed.
    Aborted (core dumped)
    ==============================================

    ============part of the code=====================

    void prepareGeometry( UnitConverter<T,DESCRIPTOR> const& converter, IndicatorF3D<T>& indicator,
    STLreader<T>& stlReader, SuperGeometry<T,3>& superGeometry )
    {
    
    OstreamManager clout( std::cout,"prepareGeometry" );
    clout << "Prepare Geometry ..." << std::endl;
    
    superGeometry.rename( 0,2,indicator );
    superGeometry.rename( 2,1,stlReader );
    superGeometry.clean();
    
    Vector<T,3> origin = superGeometry.getStatistics().getMinPhysR( 2 );
    origin[1] += converter.getConversionFactorLength()/2.;
    origin[2] += converter.getConversionFactorLength()/2.;
    
    Vector<T,3> extend = superGeometry.getStatistics().getMaxPhysR( 2 );
    extend[1] = extend[1]-origin[1]-converter.getConversionFactorLength()/2.;
    extend[2] = extend[2]-origin[2]-converter.getConversionFactorLength()/2.;
    
    // Set material number for inflow
    origin[0] = superGeometry.getStatistics().getMinPhysR( 2 )[0]-converter.getConversionFactorLength();
    extend[0] = 2*converter.getConversionFactorLength();
    
    clout << "origin = " << std::endl;
    clout << origin << std::endl;
    clout << "Pextend = " << std::endl;
    clout << extend << std::endl;
    
    IndicatorCuboid3D<T> inflow( extend,origin );
    superGeometry.rename( 2,3,inflow );
    #9639
    talco
    Participant

    I found a mistake in my stlReader line, and since FreeCAD will assume on export that the units used in the model are in millimeters, i changed it to the following:

    STLreader<T> stlReader( "MatVolIn.stl", converter.getConversionFactorLength(), 0.001 );

    But I still get the same error:
    ============Terminal messages=====================
    [prepareGeometry] Prepare Geometry …
    [SuperGeometry3D] cleaned 0 outer boundary voxel(s)
    [prepareGeometry] origin =
    [prepareGeometry] [-0.01 0.005 0.005]
    [prepareGeometry] Pextend =
    [prepareGeometry] [0.02 -0.01 -0.01]
    cylinder3d: ../../../src/functors/analytical/indicator/indicatorF3D.hh:643: olb::IndicatorCuboid3D<T>::IndicatorCuboid3D(olb::Vector<T, 3>, olb::Vector<T, 3>) [with S = double]: Assertion `_xLength>0 && _yLength>0 && _zLength>0′ failed.
    Aborted (core dumped)
    ==============================================

    But if i change the stlSize from 0.001 to larger than 0.01 i get the following error:
    ============Terminal messages=====================
    [[prepareGeometry] Prepare Geometry … OK
    [prepareLattice] Prepare Lattice …
    Discrete Normal is not valid for interpolated pressure boundary!
    ==============================================

    #9640
    talco
    Participant

    Problem Solved, 🙂

    #9645

    How did you solved the problem?

    Thank you

    #9646
    talco
    Participant

    @atanuchaudhury1994@gmail.com
    Are you getting the same error ?
    In my case I used the aorta3d stl model to lear how to properly define the stl
    And also used FreeCAD to find the excat dimentions and export the stl file

    If you have a specific problem let me know,
    I have learned a few new tricks in the last 24h 🙂

    #9649

    Actually I was working on the “Cylinder3D”, where I created the model by Freecad. The model was a little bit large in size. I extended the Y-axis from 410 mm to 2000 mm. The Grid size becomes around 500 million. Sometimes it gets aborted or Killed. When I try to run it in GPU, I am getting this problem. :

    BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (166, 60, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (168, 61, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (169, 60, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (170, 62, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (172, 63, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (232, 93, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (235, 94, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (235, 96, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (237, 99, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (238, 99, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [BlockGeometryStatistics3D] WARNING: no discreteNormal is found
    [setslipBoundary] Warning: Could not setSlipBoundary (242, 99, 83), discreteNormal=(0,0,0,0), set to bounceBack
    [prepareLattice] Prepare Lattice … OK
    [main] starting simulation…
    [setBoundaryValues] step=0; maxVel=0.005
    [Timer] step=0; percent=0; passedTime=7.154; remTime=915705; MLUPs=0
    [LatticeStatistics] step=0; t=0; uMax=0.005; avEnergy=2.49386e-08; avRho=1.00001
    [getResults] pressure1=0; pressure2=0; pressureDrop=0; drag=0; lift=0
    cylinder3d: ../../../src/utilities

    I dont understand what is the issue. Is my system not able to handle the simulation or any other problem?
    Please help.

    #9650
    Adrian
    Keymaster

    The issue here is that the material geometry is malformed s.t. the slip boundary can not obtain a discrete normal. This will likely be visible if you take a look at it in e.g. Paraview.

    500 million cells can be too large a problem for a single GPU (but higher end workstation GPUs will be able to fit it). We also talked about this before, atanuchaudhury.

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