Skip to content

External flow in openLB – doubts

OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics External flow in openLB – doubts

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1725
    shreyas
    Member

    BackgroundrnBased on the cylinder3d example, I want to be able to simulate flow around a random object (say a car). The stl file defines it well. But the car is not a ‘well defined’ object and as a result the representation of the car in openLB is just the car, and nothing else. rnQuestionrn1) Without providing the stl files for bounceback from side walls and inflow and outflow, is it possible to let the voxels extend to a greater volume than the bounding box only?rnrn2) How do I get ‘number of cuboids’ without using get_nC()?rnrnThanksrn

    #2087
    shreyas
    Member

    More specifically, I have the geometry of the car/aircraft in .stl format and I can generate this file in a minute. But in the cylinder3D example, the ends are fused with the boundaries. So, when I use the stl reader, it decides that the flow domain is ONLY AS BIG AS the bounding box around the stl file.

    #2088
    mathias
    Keymaster

    Dear Shreyas,rnrn1) You can define and an offset (cf. read function is stlReader.h) of constant size. In the next release we will have an extension for arbitrary offsets. It is not a big thing to program it in “stlRealer.h”.rn2) I am not sure that I have understood your question correctly. Actually the no. of cuboids is defined by the user.rnrnRegardsrnMathias

    #2089
    shreyas
    Member

    Dear Mathias,rnrnI can see that you have only one variable, ‘offset’ that adds onto all nx, ny and nz. Are you suggesting that I change ‘offset’ to maybe offset_x,offset_y,offset_z, or offset[3]? rnrnBut why can’t I just use..rnrnblockGeometry.setNx ( some new nX )rnblockGeometry.setNy ( some new nY )rnblockGeometry.setNz ( some new nZ ) rnrn..after reading geometry with stlReader.read() ? Its essentially doing the same thing right – changing nx, ny & nz? rn

    #2090
    mathias
    Keymaster

    Dear Shreyas,rnrn It is not working with “”blockGeometry.setNx ( some new nX)””. You can do it like this: rnrntemplate<typename T>rnvoid STLreader<T>::read(BlockGeometry3D &matrix, unsigned direction,rn unsigned voxelNumber, unsigned pad,rn double fraction, unsigned samples,rn unsigned offsetXN, unsigned offsetXP,rn unsigned offsetYN, unsigned offsetYP,rn unsigned offsetZN, unsigned offsetZP) const {rnrnrnwhere you distinguish between positive P and negative N direction. rnrnMathias

    #2091
    shreyas
    Member

    Before using setNx(), I thought of trying setOffset() as it is…but I get a runtime error(segmentation fault)! I have not used blockGeometry.reInit() – I think setOffset() itself does that. Am I correct? The only lines I added were the following.rnrn

    Code:
    rnrn nx1=blockGeometry.getNx();rn ny1=blockGeometry.getNy();rn nz1=blockGeometry.getNz();rncout<<””n Before offset, nx=””<<nx1<<””, ny=””<<ny1<<””and nz=””<<nz1<<endl;rnoffset1 = int((nx1 + ny1 + nz1)/6);rncout<<””Changing offset of “”<<blockGeometry.getOffset()<<”” to “”<<offset1<<endl;rnblockGeometry.setOffset(offset1);rnrnif (singleton::mpi().isMainProcessor()) {rn clout << “”Nx=”” << blockGeometry.getNx() << “”; Ny=”” << blockGeometry.getNy() << “”; Nz=”” <<blockGeometry.getNz() << endl;rn }rnrn /// THIS PART RESULTS IN A SEGMENTATION FAULT !!rn for (int iY = 1; iY < blockGeometry.getNy() – 1; iY++) {rn for (int iZ = 1; iZ < blockGeometry.getNz() – 1; iZ++) {rn blockGeometry.setMaterial(0, iY, iZ, 3);rn }rn }rnrn

    rnrnAnd this is the outputrnrnBefore offset, nx=252, ny=106and nz=245rnChanging offset of 0 to 100rn[main] Nx=252; Ny=106; Nz=245rnSegmentation fault (core dumped)rnrnIf I don’t get setOffset to work, I will change to Xp, Xn etc just like you suggested. But what am I doing wrong with setOffset() now?? 😐 rnrn

    #2092
    mathias
    Keymaster

    Dear Shreyas,rnrn The function “”setOffset”” of “”BlockGeometry”” does not change the matrix itself. You need to create a new “”BlockGeometry”” and copy the data by hand. Yet, it is much easier to use the read function of the “”STLReader”” with an appropriate offset. rnrnMathias

    #2093
    shreyas
    Member

    Dear Mathias,rnrnBy “”appropriate offset””, I am quite sure that you mean using the variable ‘pad’. But can you explain the variables ‘fraction’ and ‘samples’ in the read function please:rnrnread(BlockGeometry3D &matrix, unsigned direction,unsigned voxelNumber, unsigned pad, double fraction, unsigned samples)rnrnI have kept the values as 0.75 and 3u respectively. It seems to slow down terribly. Also, since I don’t have any surrounding walls, should I set an outflow/periodic condition to the channel walls?(previously all the geometry specified by the stl file, including the walls, were bounceback).rnrnThanks,rnShreyas rn

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