Doubts – Prepare Geometry – Cylinder3d
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Doubts – Prepare Geometry – Cylinder3d
- This topic has 6 replies, 3 voices, and was last updated 8 years, 5 months ago by thomas.
-
AuthorPosts
-
May 2, 2016 at 12:29 pm #1824Alejandro_ClaroMember
Hello everyone,rnrnI’m interested to simulate the fluid (water) flow in a rectangular channel. I chose the cylinder3d case as my “”template”” to simulate mu case. I understood the basic ideas of each of the main functions and classes used in the example. However, I confuse about how the geometry is created in the user-define function “”prepareGeometry”” [Line 342]. This is the code of the function with the lines that I do not understand:rnrn
Code:rn/// Stores data from stl file in geometry in form of material numbersrnvoid prepareGeometry( LBconverter<T> const& converter, IndicatorF3D<T>& indicator,rn STLreader<T>& stlReader, SuperGeometry3D<T>& superGeometry )rn{rn superGeometry.rename( 0,2,indicator );rn superGeometry.rename( 2,1,stlReader );rn superGeometry.clean();rnrn //… origin and extend are defined in this partrn rn /// Set material number for cylinderrn origin[0] = superGeometry.getStatistics().getMinPhysR( 2 )[0]+converter.getLatticeL();rn extend[0] = ( superGeometry.getStatistics().getMaxPhysR( 2 )[0]-superGeometry.getStatistics().getMinPhysR( 2 )[0] )/2.;rn IndicatorCuboid3D<T> cylinder( extend,origin );rn superGeometry.rename( 2,5,cylinder );rnrn /// Removes all not needed boundary voxels outside the surfacern superGeometry.clean();rn superGeometry.checkForErrors();rn}rnrnrnThe stlreader object is defined by :
Code:STLreader<T> stlReader( “”cylinder3d.stl””, converter.getLatticeL(), 0.001 );. rnThe indicator is defined by :
Code:IndicatorLayer3D<T> extendedDomain( stlReader, converter.getLatticeL() );rnrnI am confused about how the code define the material numbers, in the lines: rn
Code:rnsuperGeometry.rename( 0,2,indicator );rnsuperGeometry.rename( 2,1,stlReader );rnrnrn1. All the voxels in the superGeometry (object from the class SuperGeometry3D) have a initial material number equal to 0 (zero)? rnrn2. Which is the difference between indicator and stlReader objects? These two object correspond to two different domains? Which one corresponds to the fluid voxels/walls?rnrn3. After the function “”rename”” is used twice, the function “”superGeometry.clean()”” is used. Which voxels from this function are eliminated ?rnrn4. If STLReader object correspond to the fluid voxels, why the function “”addZeroVelocityBoundary()”” use it as it is for the wall voxels 😕 ?rn rnrn
Code:rn/// Set up the geometry of the simulationrnvoid prepareLattice( SuperLattice3D<T,DESCRIPTOR>& sLattice,rn LBconverter<T> const& converter,rn Dynamics<T, DESCRIPTOR>& bulkDynamics,rn sOnLatticeBoundaryCondition3D<T,DESCRIPTOR>& bc,rn sOffLatticeBoundaryCondition3D<T,DESCRIPTOR>& offBc,rn STLreader<T>& stlReader,rn SuperGeometry3D<T>& superGeometry )rn{rn // … rn rn /// Material=5 –>bouzidirn sLattice.defineDynamics( superGeometry, 5, &instances::getNoDynamics<T,DESCRIPTOR>() );rn offBc.addZeroVelocityBoundary( superGeometry, 5, stlReader );rn rn // …rn}rnrnrnBest regards,rnrnAlejandro
May 3, 2016 at 7:18 am #2322robin.trunkKeymasterHi Alejandro,rnrnto 1) yes the initial material number is 0rnrnto 2) the extendedDomain Indicator object is the same as the stlReader, but enlarged by converter.getLatticeL(). So material number 2 represents the fluid and walls after the first rename, after the second rename the fluid domain is set to 1 and a layer of 1 cell thickness remains representing the walls.rnrnto 3) clean removes mainly single exposed voxels, if you want to know it in detail you can find the function in the Doxygen documentation http://optilb.com/DoxyGen/html/d3/d2a/classolb_1_1BlockGeometryStructure3D.html#a0fb18a477673debb5bfc7568886b124drnrnto 4) the addZeroVelocityBoundary is applied to material number 5, that defines the walls of the cylinder. The stlReader object is handed to the function since more information about the geometry are required for the computation.rnrnBest regardsrnRobin
May 3, 2016 at 12:38 pm #2323Alejandro_ClaroMemberHi Robin.Trunk,rnrnThank you for the yours answers. As “”stlReader”” and “”extendedDomain”” instances are IndicatorF3D type, the addZeroVelocityBoundary function could use either. I know that prepareLattice function needs a STLreader object, but it could be changed by a IndicatorLayer3D object, right? rnrnThe addZeroVelocityBoundary function is defined as:rnrn
Code:rnvoid olb::sOffLatticeBoundaryCondition3D<T, Lattice>::addZeroVelocityBoundary(rn SuperGeometry3D< T > & superGeometry, rn int material, rn IndicatorF3D< T > & indicator, rn std::list< int > bulkMaterials = std::list<int>(1,1) rn) rnrnrnBest regards,rnrnAlejandrorn
May 3, 2016 at 1:36 pm #2324robin.trunkKeymasterHi,rnrnsince the function prepareLattice is defined in the program and not part of the library, you can adapt it to whatever you need in your program.rnrnBest regardsrnRobin
May 4, 2016 at 2:24 pm #2329Alejandro_ClaroMemberHi Robin,rnrnThank you for your response. rnrnBest regards,rnrnAlejandro
May 11, 2016 at 6:46 pm #2343Alejandro_ClaroMemberHello everyone,rnrnI have a new doubt about how the geometry is “”voxelized””. I ran the cylinder3d example and I am looking the coordinates of each material-number. I tested the example case with the default values. When the user-defined function “”prepareGeometry”” ends to give all the material numbers, it is printed the results of this processes with the function:
Code:superGeometry.print();rnWhat it is printed is:rn
Code:[prepareGeometry] Prepare Geometry …rn[SuperGeometry3D] cleaned 0 outer boundary voxel(s)rn[SuperGeometryStatistics3D] updatedrn[SuperGeometryStatistics3D] updatedrn[SuperGeometryStatistics3D] updatedrn[SuperGeometry3D] cleaned 0 outer boundary voxel(s)rn[SuperGeometry3D] the model is correct!rn[CuboidGeometry3D] —Cuboid Stucture Statistics—rn[CuboidGeometry3D] Number of Cuboids: 7rn[CuboidGeometry3D] Delta (min): 0.01rn[CuboidGeometry3D] (max): 0.01rn[CuboidGeometry3D] Ratio (min): 0.837209rn[CuboidGeometry3D] (max): 1.19444rn[CuboidGeometry3D] Nodes (min): 66564rn[CuboidGeometry3D] (max): 66564rn[CuboidGeometry3D] ——————————–rn[SuperGeometryStatistics3D] updatedrn[SuperGeometryStatistics3D] materialNumber=0; count=1849; minPhysR=(0.4625,0.1675,-0.0025); maxPhysR=(0.5325,0.2375,0.4175)rn[SuperGeometryStatistics3D] materialNumber=1; count=417011; minPhysR=(0.0025,0.0075,0.0075); maxPhysR=(2.4925,0.4075,0.4075)rn[SuperGeometryStatistics3D] materialNumber=2; count=42250; minPhysR=(-0.0075,-0.0025,-0.0025); maxPhysR=(2.5025,0.4175,0.4175)rn[SuperGeometryStatistics3D] materialNumber=3; count=1681; minPhysR=(-0.0075,0.0075,0.0075); maxPhysR=(-0.0075,0.4075,0.4075)rn[SuperGeometryStatistics3D] materialNumber=4; count=1681; minPhysR=(2.5025,0.0075,0.0075); maxPhysR=(2.5025,0.4075,0.4075)rn[SuperGeometryStatistics3D] materialNumber=5; count=1476; minPhysR=(0.4525,0.1575,0.0075); maxPhysR=(0.5425,0.2475,0.4075)rn[prepareGeometry] Prepare Geometry … OKrnrnThe example used a rectangular channel of 2500x410x410 mm (x-y-z coordinates) with origin at (0;0;0). Each material number is:
-
1: Fluidrn2: Lateral, bottom and top wallrn3: Inlet rn4: Outletrn5: Cylinder wall
rnIf we are interested just in the fluid flow, it can be seen that minimum and maximum coordinates (x-y-z) for material number 1 are:rn
Code:minPhysR=(0.0025,0.0075,0.0075); rnmaxPhysR=(2.4925,0.4075,0.4075)rnAs the code use the bounce-back approach for the wall (without the cylinder wall) the minimum and maximum coordinates should be:rn
Code:minPhysR=(0.005,0.005,0.005); rnmaxPhysR=(2.495,0.405,0.405)rnCould someone explain me why this is happening?rnrnBest regards,rnAlejandrorn
May 12, 2016 at 7:23 am #2344thomasMemberHi Alejandro,rnrnyou use a spacing of h=0.01. During voxelization the geometry is shifted by h/4 to overcome some issues with floating point numbers. Thats why you get such crooked numbers.rnrnIf you look at the y- and z limits for material 1, you get a width of 0.4075-0.0075 = 0.4. Adding h/2 for each half-way bounce back boundary leads to 0.41, which is what you want.rnrnRegardsrnThomasrnrnrn
-
AuthorPosts
- You must be logged in to reply to this topic.