External flow in openLB – doubts
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › External flow in openLB – doubts
- This topic has 7 replies, 2 voices, and was last updated 12 years ago by shreyas.
-
AuthorPosts
-
November 23, 2012 at 12:04 am #1725shreyasMember
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
November 23, 2012 at 12:31 am #2087shreyasMemberMore 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.
November 23, 2012 at 12:43 pm #2088mathiasKeymasterDear 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
November 23, 2012 at 5:42 pm #2089shreyasMemberDear 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
November 23, 2012 at 6:13 pm #2090mathiasKeymasterDear 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
November 23, 2012 at 6:30 pm #2091shreyasMemberBefore 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 }rnrnrnrnAnd 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
November 25, 2012 at 2:55 pm #2092mathiasKeymasterDear 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
November 26, 2012 at 3:39 pm #2093shreyasMemberDear 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
-
AuthorPosts
- You must be logged in to reply to this topic.