Skip to content

Simulating channel flow using STL file is not working

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics Simulating channel flow using STL file is not working

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #1963


    I wish to simulate a flow through a 3D channel having a rectangular cross-section. I have generated a STL file of the channel and the inlets and outlets have rectangular Z-axis aligned cross-section. I followed the aorta3D example to set up a similar case but observed that there the inlets and outlets are circular and hence IndicatorCircle3D and IndicatorCylinder3D are instantiated to extract the boudnary nodes from the geometry.


    As my inlets and outlets are rectangular, I tried to use IndicatorCubiod3D but this does not work. Here is a piece of my code:

    Vector<T,3> center_inflow(0.0, -0.0125, 0.08);
    Vector<T,3> center_outflow0(0.0625, -0.0125, -0.22);
    Vector<T,3> center_outflow1(0.0,-0.0125, -0.22);
    Vector<T,3> center_outflow2(-0.0625, -0.0125, -0.22);

    Vector<T,3> origin_inflow(-0.025, 0, 0.08);
    Vector<T,3> origin_outflow0(0.05, 0, -0.22);
    Vector<T,3> origin_outflow1(-0.0125,-0.0125, -0.22);
    Vector<T,3> origin_outflow2(-0.075, -0.0125, -0.22);
    Vector<T,3> extend_inflow(0.05, -0.025, 2.*converter.getLatticeL());
    Vector<T,3> extend_outflow0(0.025, -0.025, 2.*converter.getLatticeL());
    Vector<T,3> extend_outflow1(0.025, -0.025, 2.*converter.getLatticeL());
    Vector<T,3> extend_outflow2(0.025, -0.025, 2.*converter.getLatticeL());
    // Set material number for inflow
    IndicatorCuboid3D<T> layerInflow( 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), center_inflow);
    //IndicatorCuboid3D<T> layerInflow( extend_inflow, origin_inflow );
    superGeometry.rename( 2,3,1,layerInflow );

    // Set material number for outflow0
    IndicatorCuboid3D<T> layerOutflow0( 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), center_outflow0);
    //IndicatorCuboid3D<T> layerOutflow0( extend_outflow0, origin_outflow0 );
    superGeometry.rename( 2,4,1,layerOutflow0 );

    // Set material number for outflow1
    IndicatorCuboid3D<T> layerOutflow1( 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), center_outflow1);
    //IndicatorCuboid3D<T> layerOutflow1( extend_outflow1, origin_outflow1 );
    superGeometry.rename( 2,5,1,layerOutflow1 );

    // Set material number for outflow2
    IndicatorCuboid3D<T> layerOutflow2( 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), 2.*converter.getLatticeL(), center_outflow2);
    //IndicatorCuboid3D<T> layerOutflow2( extend_outflow2, origin_outflow2 );
    superGeometry.rename( 2,6,1,layerOutflow2 );

    // Removes all not needed boundary voxels outside the surface
    // Removes all not needed boundary voxels inside the surface
    superGeometry.innerClean( 3 );

    clout << “Prepare Geometry … OK” << std::endl;

    Implementing this gives me errors which look like this:

    [BoundaryConditionInstantiator3D:0] ERROR: no boundary found at (4,3,125) ~ (-0.07375,-0.02425,-0.09775), in direction 9
    [STLreader:0] Returning false
    [STLreader:0] Returning false
    [BoundaryConditionInstantiator3D:0] ERROR: no boundary found at (9,3,117) ~ (-0.06875,-0.02425,-0.10575), in direction 9
    [STLreader:0] Returning false
    [STLreader:0] Returning false
    [BoundaryConditionInstantiator3D:0] ERROR: no boundary found at (14,3,109) ~ (-0.06375,-0.02425,-0.11375), in direction 9
    [STLreader:0] Returning false
    [STLreader:0] Returning false
    [BoundaryConditionInstantiator3D:0] ERROR: no boundary found at (19,3,101) ~ (-0.05875,-0.02425,-0.12175), in direction 9
    WARNING: Bogus distance at (71,6,9): 5.75
    WARNING: Bogus distance at (71,7,8): 5.75
    WARNING: Bogus distance at (70,8,8): 5.75

    and much more like these.

    Any inputs on this issue would be most helpful


    Hello ishaandesai,

    you have to respect a certian overlap, move your renaming indicators two physDeltaX in fluid direction than you should get rid of this error. Check the coordinates in your error message to see for which cells are no boundaries found and adapt your indicator in the according direction

    Best Marc


    Hello Marc,

    thanks for your reply, I checked for overlap of inlet, outlet nodes and boundary nodes and indeed I found some errors. Restoring those errors and changing the boundary condition from offLattice Bouzidi implemendation to Bounceback implementation has got my simulation running. The issue now is that my STL has curved sections so is it advisable to stick with Bounceback boundaries ? Or should I attempt to go with Bouzidi offLattice ?

    I am also having some issues with the inlet conditions but unfortunately I am not able to attach an image on my reply in this forum, if you can help me there that would be great. I can explain my problem much better then.

    Thanks and Regards


    Hello ishaandesai,
    in case of a curved geometry it is better to go with a non staircase boundary as Bouzidi, but for the first draft I prefer bounce back. You can send me a link to the Picture. The first step is that every voxel for your inflow has the correct material numer.
    Best Marc


    Hello Marc,
    Right now I am using bounceback wall boundary as the Bouzidi implementation is giving me a similar error as I stated earlier. I have implemented an inlet condition of constant velocity, but after some length of my duct, I see velocity fluctuations. This is what they look like:
    My case setup is as follows:
    Inlet velocity = 10 m/s
    Characteristic viscosity = 1e-6 m2/s (water at 23 degrees)
    Reynolds Number = 183000
    Lattice velocity = 0.05
    LatticeL = 0.001
    I wish to further refine my case by reducing LatticeU and LatticeL, but the computing power of my machine is restricting me from doing so. I cannot find a good explanation for the velocity fluctuation. I am guessing that such fluctuations (like sound waves) will affect my analysis of finding high pressure zones and recirculation areas in my duct geometry

    Thanks and Regards


    Hey Ishann,

    in the case of this high Reynoldsnumber, you are not able to do LES simulation without a performant cluster system. You can check your gridspacing in a y+ calculator for duct flows with a y+ between 2-3 and you will get an idea about the mesh size for your case.

    Best Marc


    Thank you for your response Marc, I understand the limitations of my machine with respect to the case I am trying to set.


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