Skip to content

Changing Geometry

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1815
    ivan
    Member

    Hello, everybody,rnrnI’m quite new at OpenLB and I was gives the task of simulate a flow in a channel with a spheric obstacle. For this I thought about editing the bstep2d example, removing the step and adding the obstacle. Initially I just set the step dimensions as zero, so it was removed, and right now I am trying to figure out how I can add the obstacle itself. What I am supposed to change? Only the bstep2d.cpp code or any of the functions?rnrnAtt.

    #2285
    mathias
    Keymaster

    Hi,rnrnwe have an example cylinder2d that is very close to what you want. Please, have a look at it.rnrnBestrnMathias

    #2292
    ivan
    Member

    Yes, thank you! That’s exactly what I was looking for. Still, is there any way I can also move the step in the “”bstep2d”” example and not only changing its dimensions?

    #2293
    mathias
    Keymaster

    Hi,rnrnYes, you can change it easily. Look at this line in the beginning of the exmape code:rnrn// Parameters for the simulation setuprnconst T lx1 = 5.0; // length of steprnconst T ly1 = 0.75; // height of steprnconst T lx0 = 20.0; // length of channelrnconst T ly0 = 1.5; // height of channel rnrnBest Mathias

    #2296
    ivan
    Member

    Yes, I was able to change the dimensions of the step but I wanted to move it, to make is further from the channel inlet.

    #2297
    ivan
    Member

    But right now I’m dealing with the cylinder2d example, in which I have to add more obstacles. Any tips of how to start it?

    #2298
    robin.trunk
    Keymaster

    Hi ivan,rnrnincreasing the value for lx1 inrnconst T lx1 = 5.0; // length of steprnshould move the step further from the inlet, or did you mean something else?rnrnFor the cylinder2d example it is possible to add more obstacles by creating more IndicatorCylinder2D objects. At line 84 of the example the existing obstacle is defined. You can add more round obstacles by insertingrnVector<T,2> center1(0.2,0.2); rnIndicatorCircle2D<T> circle(center1, 0.1);,rnjust change the values for the center and the radius (here 0.1). It is also possible to define rectangular obstacles byrnVector<T,2> center2(0.1,0.1); rnVector<T,2> extend1(0.2,0.14);rnIndicatorCuboid2D<T> cube(extend1,center2);.rnThis gives gives a cube 0.2 by 0.14. To apply the constructed obstacle for the simulation addrnsuperGeometry.rename(1,5,cube);rnas for the original obstacle in line 101 of the example. In this case the material numbers 1 will be set to 5 at every node occupied by the obstacle cube. The material numbers are used to assign e.g. boundary conditions to certain areas of the geometry. In cylinder2d everything with material number 5 is treated as obstacle.rnrnbestrnrobin

    #2300
    ivan
    Member

    Oh, wow, that was really helpfull! Thank you very much for that, Robin!rnrnSo, basically I was able o insert some more obstacles ( for now Im only interested in the round ones, but I really appreciate your extra tips for the square ones as well ) but it seems like I’m missing something because I’m getting some ERROR messages regarding the boundary conditions. Let me get everything here:rnrnOn // Parameters for the simulation setup// I added:rnconst T secondcenterCylinderX = 0.2;rnconst T secondcenterCylinderY = 0.2+L/2;rnconst T secondradiusCylinder = 0.035;rnrnOn /// Stores geometry information in form of material numbers/// I added:rn Vector<T,2> secondcenter(secondcenterCylinderX,secondcenterCylinderY);rn IndicatorCircle2D<T> secondcircle(secondcenter, secondradiusCylinder);rnrnThen, on /// Set material number for cylinder/// I added:rnsuperGeometry.rename(1,5,secondcircle);rnrnAnd finally, on /// Material=5 –>bouzidi, which seems to be part of /// Setting of the boundary conditions, I added:rn Vector<T,2> secondcenter(secondcenterCylinderX,secondcenterCylinderY);rn IndicatorCircle2D<T> secondcircle(secondcenter, secondradiusCylinder);rnrn and after sLattice.defineDynamics(superGeometry, 5, &instances::getNoDynamics<T,DESCRIPTOR>()); I addedrn offBc.addZeroVelocityBoundary(superGeometry, 5, secondcircle);rnrnThen when running it I get a lot of those:rnrn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,19) ~ (1.65,0.295), in direction 3rn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,18) ~ (1.65,0.29), in direction 1rn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,19) ~ (1.65,0.295), in direction 2rn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,20) ~ (1.65,0.3), in direction 3rn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,19) ~ (1.65,0.295), in direction 1rn[BoundaryConditionInstantiator2D] ERROR: no boundary found at (17,20) ~ (1.65,0.3), in direction 2rnrnBut still, it runs. What could it be?rnrn[ And by the way, I made versions with 2, 5 and 30 obstacles, and I get more repetitions of those ERROR messages the more obstacles I have ]rnrnAtt.rn

    #2301
    robin.trunk
    Keymaster

    Hi Ivan,rnrnit seems that some error checks for the Bouzidi boundary can’t handle multiple obstacles with the same material number. However, the later performed computations and the solution should not be affected by this. If you want to get rid of the error messages, you could assign a different material number to each object. I think that would be the fastest workaround.rnAlternatively you could try to construct an IndicatorF2D object from the circles, since for this object other functions are called, that maybe work better in the case of multiple objects.rnrnBestrnRobinrnrn

    #2304
    ivan
    Member

    Thank you for that Robin, it really helped! 🙂

    #2916
    LaurentDelaon
    Participant

    Hi
    when you do this :

    Code:
    IndicatorCircle2D<T> circle(center1, 0.1);

    Is it possible (so far in the code ) to modify circle to ajust radius after it’s definition ?
    like :

    Code:
    circle(center1, 0.5)

    Is it possible to realise a change like this ?
    Regards.

    #2917
    mjk
    Member

    No, please see Dogygen or read directly our implementation and a basic c++ book for more information!

    #2918
    LaurentDelaon
    Participant

    hi thank’s for your response.
    I have look at documentation but I have think that I can miss a specific move function.
    I not expert in C++. I am just using the code to try to simulate air flow.
    My objectives are not to rewrite your code but to use it as it…

    Regards.

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