Anda di halaman 1dari 20

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 1

10 Reading Computer-Aided Design (CAD) Data into PFC 3D


10.1 Introduction PFC 3D is valued for its ability to model complex physics. However, most engineering applications also feature complex shapes in the form of complex containers, screws, bafes, hoppers, etc. While PFC 3D offers many options for dening walls, creating complex walls with PFC 3D may become tedious at times. In this section we describe how a complex geometry dened by Computer-Aided Design (CAD) may be imported into PFC 3D as wall elements. We then illustrate this functionality with several example applications. All of the corresponding les are located in the ExampleApplications\ImportCAD folder and sub-folders. Some familiarity with PFC 3D and FISH is necessary to take full advantage of this document. Some basic understanding of CAD tools, such as Rhino, AutoCAD or Pro/E, is also helpful. 10.2 Brief Overview of Computer-Aided Design (CAD) CAD is the process of creating curves, surfaces and volumes in space. CAD is sometimes called geometry modeling, surface modeling or solid modeling. There are two approaches to creating a CAD model: free-form and solid-based. In practice, most CAD designs follow a combination of these two approaches. In a free-form approach, points are created and linked together with curves. Curves are extruded along other curves to create surfaces. Surfaces may also be dened by closed curves. A collection of surfaces may be sewn together to form a shell or poly-surface, which can be either open or closed. Shells may be extruded along curves, or rotated around axes to create closed shells. Closed shells can also be obtained by sewing several shells together. Closed shells are sometimes called solids. In a solid-based approach, ready-made closed shells called primitives (such as parallelpipeds, cylinders, spheres, cone sections, etc.) are used as a starting point. Union and intersection operations (also referred to as Boolean operations) are then used to subtract, combine or intersect primitives in order to create more complex solids. A CAD model is a mathematical description of the objects it contains. For instance, a disk is described as a plane passing through a given point, having a given normal, and trimmed by a circle described by a given radius and centered on a given point. Triangulation consists of computing points on a surface and connecting them together to create a collection of triangles tiling the surface. Such a tiling is also referred to as a surface mesh. Triangulation, or facetization in general, amounts to discretizing the equation of a surface and replacing it with a table of x-, y- and z-values; some loss of information results from this.

PFC 3D Version 4.0

10 - 2

Example Applications

CAD models exist in a variety of formats, depending on whether or not they are facetized (Table 10.1).

Table 10.1 Facetized and non-facetized CAD le formats CAD Files most common formats Non-facetized (solid/surface models) IGES, STEP, PARASOLID, ACIS Facetized (surface meshes) DXF, STL, VRML, 3DS

The STL (STereo-Lithography) le format is used in rapid prototyping and Computer-Aided Manufacturing. Because of its relative simplicity, it has become a de facto standard for representing triangular surfaces. In the following, we will focus on importing CAD data in STL (formatted ASCII les), using a specic FISH function. Of course, this approach can be extended to any other format output as ASCII les readable using FISH. The le hopper.stl, located in the ImportCAD folder, is provided as an example of such an STL ASCII le. It can be edited with your favorite text editor. The entire contents of the STL le are bracketed between the keywords solid STL Ascii and endsolid STL Ascii. Within this bracket, each triangle is bracketed by a facet normal/endfacet pair containing the normal vector to each triangle and the coordinates of the triangles vertices. This le corresponds to the triangulated geometry shown in Figure 10.3; the initial CAD geometry, prior to triangulation, is shown in Figure 10.2. Both gures were produced using Rhino. 10.3 Preparing a Model for Import into PFC 3D The user may import CAD models that have been triangulated and saved as a formatted STL le into PFC 3D. A formatted STL le can be read using the readStlFile FISH function described below. This function can easily be modied to parse and read other types of facetized geometry les. Prior to importing any external geometry into PFC 3D, it is strongly recommended that the following aspects of the model be examined: Are there any missing parts? Make sure that the geometry is complete. How is the model triangulated? Can it be simplied? How many triangles does it contain? The same geometrical accuracy might be obtained using fewer triangles. Also, to reduce computational time, a simpler or coarser triangulation may be considered. Are the normal vectors properly oriented? Particles only interact with faces whose normal vectors are oriented toward them. Make sure that normal vectors are properly oriented at any location along the possible trajectories of particles during the simulation.

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 3

The last two items are illustrated in the following. The best way to examine a model is to use a CAD tool and visually inspect the content of the model, check for missing or duplicate parts, weed out irrelevant details or parts that are not likely to come into contact with particles, and check the orientation of the normals prior to saving the model as a formatted STL le. Please note that particles only see walls if the wall normal is pointing at them; if not, they will pass right through them. 10.3.1 Model Simplication An imported model may be large and complex. Using it directly may require prohibitively large computational resources because of the large number of triangles involved. It is recommended that the model be simplied to remove details irrelevant to the PFC 3D simulation. For instance, Figure 10.1(left) shows a model of a stirred tank reactor in which the tank wall has a certain thickness. In simulating the mixing of particles, the outer wall is irrelevant since it never interacts with particles. Figure 10.1(right) shows the same model where only the inner wall of the tank has been kept.

Figure 10.1 Original model with thick walls (left) and simplied model (right)

PFC 3D Version 4.0

10 - 4

Example Applications

10.3.2 Model Triangulation A solid model represents a mathematical description of the entities it contains. Surfaces must be triangulated before they can be read as wall elements into PFC 3D. Most CAD systems allow the user to choose how nely a surface is to be triangulated. The most common measure of how nely a surface is triangulated is chord error or offset. Figure 10.2 shows the CAD denition of a hopper prior to triangulation.

Figure 10.2 CAD model of hopper Figure 10.3 is the result of triangulating the CAD denition with a chord error of 0.1. The resulting surface mesh contains 64 triangles.

Figure 10.3 Triangulation with a chord error of 0.1 results in 64 triangles

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 5

Figure 10.4 represents the same object triangulated with a chord error of 0.001. The total number of triangles is now 4680. Clearly, a slight degradation in geometrical accuracy can cause a substantial (almost 100-fold) decrease in the number of wall elements, and results in a signicant speed-up of the simulation.

Figure 10.4 Triangulation with a chord error of 0.001 results in 4680 triangles Also, the same geometrical accuracy may sometimes be obtained with fewer triangles, as illustrated in Figure 10.5: the triangulation on the right-hand side contains fewer triangles than the triangulation on the left-hand side, although no geometrical information is lost in this simplication.

Figure 10.5 The triangulation on the right contains fewer triangles than the one on the left, but without any loss of geometrical accuracy

PFC 3D Version 4.0

10 - 6

Example Applications

10.3.3 Checking Normal Orientation In PFC 3D, the orientation of the walls determines the side the particles will interact with. A particle will pass through a wall if the wall normal does not point toward it. Figure 10.6(left) shows the original normal vectors of each triangle in the model (each normal is represented at the center of gravity of each triangle). As a consequence of the original orientation of the various lines used in the construction of the surface, certain surfaces may be oriented differently. Prior to saving the triangulated surface, all triangles must be oriented in a coherent fashion so that normals point toward the particles. Figure 10.6(right) shows the results of such a modication.

Figure 10.6 Normal orientations before and after correction. Triangle normals are incorrectly oriented (left). All normals point toward the particles (right).

10.4 Importing a CAD Geometry into PFC 3D As mentioned above, here we focus on the importation of CAD data in the STL format, and illustrate this functionality with several example applications. Each example application uses specic STL les and FISH data les located in a corresponding sub-folder of the ImportCAD folder. However, the STL import functionality, as well as other shared FISH functions, are implemented in the le CAD support.s, located in the folder ImportCAD. This le is shown in Example 10.1: Example 10.1 CAD import support FISH function
;fname: CAD_support.fis ; ; Itasca Consulting Group, Inc. ; ====================================================================== ; Support functions for CAD Examples for PFC3D ;

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 7

; ------------------------------------------;---------------- STL Support functions ------------;---------; setArray ;---------def setArray array arr(60000) xtri(19000,3) ytri(19000,3) ztri(19000,3) end ;---------; Reads an ASCII STL file composed of triangles ;---------def readStlFile wl_ = max_wid command set echo off end_command oo = open(fn_stl,0,1) nret = read(arr,60000) oo = out( Lines input = +string(nret)) oo = close ntri = 0 loop n (1,nret) if InTriangle = 1 if parse(arr(n),1) = vertex nver = nver + 1 xtri(ntri,nver) = parse(arr(n),2) ytri(ntri,nver) = parse(arr(n),3) ztri(ntri,nver) = parse(arr(n),4) endif if parse(arr(n),1) = endloop InTriangle = 0 endif else if parse(arr(n),1) = outer InTriangle = 1 ntri = ntri + 1 nver = 0 endif endif endLoop oo = out( Triangles = +string(ntri)) loop n (1,ntri) x1 = xtri(n,1)

PFC 3D Version 4.0

10 - 8

Example Applications

y1 = ytri(n,1) z1 = ztri(n,1) x_ = x1 y_ = y1 z_ = z1 getMaxMin x2 = xtri(n,2) y2 = ytri(n,2) z2 = ztri(n,2) x_ = x2 y_ = y2 z_ = z2 getMaxMin x3 = xtri(n,3) y3 = ytri(n,3) z3 = ztri(n,3) x_ = x3 y_ = y3 z_ = z3 getMaxMin command wall face x1 y1 z1 x2 y2 z2 x3 y3 z3 endCommand endLoop command set echo on end_command ; Below, we associate the color wcolor_ to all the walls of the newly ; read object wu_ = max_wid _iniWallColor wcolor_ = wcolor_ + 1 end ;----------; getMaxMin ;----------def getMaxMin if x_ > x_max x_max = x_ end_if if y_ > y_max y_max = y_ end_if if z_ > z_max

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 9

z_max = z_ end_if if x_ < x_min end_if if y_ < y_min end_if if z_ < z_min end_if end x_min = x_ y_min = y_ z_min = z_

;----------; _iniWallColor ;----------def _iniWallColor wu_ = wu_ wl_ = wl_ wcolor_ = wcolor_ wp_ = wall_head loop while wp_ # null if w_id(wp_) <= wu_ if w_id(wp_) > wl_ w_color(wp_) = wcolor_ endif endif wp_ = w_next(wp_) endloop end ;---------------- Simulation Support functions ------------def simini command set random ; set local damping to zero in order to allow unimpeded free flight damp default local 0.0 ; activate viscous damping damp default viscous normal 0.7 notens on shear 0.7 ; When PFC3D knows that there will be no more than 20,000 balls, it ; can optimize its search algorithm accordingly set max_balls 20000 ; PFC3D wont stop with an error message if it cannot pack all the ; balls we are asking it to generate

PFC 3D Version 4.0

10 - 10

Example Applications

set gen_error off end_command filename = test time_sav = 0. dt_sav = 1.0e-1 end

def simloop msg = The simulation will now start and\ncreate a number of SAV files. msg = msg + \nThese files can then be used by\nPFC3D or Iv to generate animations. o = msgbox(msg,Start of simulation,1) loop _i (0,500) if _i < 10 _zeros = 000 else if _i < 100 _zeros = 00 else _zeros = 0 endif endif _file = string(filename) + string(_zeros) + string(_i) command ; setting ratio to a small value forces PFC3D to continue stepping in ; time until time_sav is reached solve time time_sav ratio 1.0e-8 colorBallsBasedOnVelocity save _file endcommand time_sav = time_sav + dt_sav endloop end def _iniWallVel command wall prop x 0. y 0. z 0. set echo off end_command wp_ = wall_head loop while wp_ # null if w_color ( wp_ ) = 0 wid = w_id ( wp_ ) w_xvel ( wp_ ) = wxvel_

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 11

w_yvel ( wp_ ) w_zvel ( wp_ ) w_rxvel ( wp_ ) w_ryvel ( wp_ ) w_rzvel ( wp_ ) endif wp_ = w_next ( wp_ endloop command set echo on end_command end

= = = = = )

wyvel_ wzvel_ wrxvel_ wryvel_ wrzvel_

;---------------- Plotting Support functions ------------def colorBallsBasedOnVelocity if flg_colorBallsBasedOnVel # 0 then vmin = 0. vmax = 2 bp_ = ball_head loop while bp_ # null bvmag = b_xvel(bp_) * b_xvel(bp_) bvmag = bvmag + b_yvel(bp_) * b_yvel(bp_) bvmag = bvmag + b_zvel(bp_) * b_zvel(bp_) bvmag = sqrt (bvmag) b_color(bp_) = int(((bvmag - vmin)/vmax)* 16.) bp_ = b_next(bp_) endloop endif end ;----------; plotWalls ;----------def plotWalls wcolor_last = wcolor_ - 1 loop counter_ ( 0, wcolor_last - 1 ) command pl add wall range col counter_ end_command endloop command pl add wall range col wcolor_last transp 80 end_command end

PFC 3D Version 4.0

10 - 12

Example Applications

define plot_view command plot create the_system end_command plotWalls command pl add ball orange lgreen pl set perspective off pl set background white pl set caption off pl show end_command end ; ====================================================================== ; EoF : CAD_support.fis

The FISH function readStlFile parses and reads formatted STL les. Each call to this function, in turn, calls iniWallColor, which assigns a different color to the part that is read so that, later on, color can either be used as a range criterion to assign distinct attributes or kinematics to each wall, or to represent various parts with different levels of transparency or color. In Section 10.4.1, we will illustrate and detail the use of the functions implemented in CAD support.s for the case of a stirred tank reactor application. Since the structures of the les used for the additional examples are the same, these examples will not be discussed in detail. Note that, for purposes of illustration, the number of balls generated in these examples is kept low. These data les should be modied according to the requirements of each problem. 10.4.1 A Stirred Tank Reactor A stirred tank reactor (Figure 10.1) is an industrial-size beaker used in the chemical industry to produce compounds through continuous mixing of several chemical reactants. The simplied reactor used in this example is made of two parts: a tank, which is xed (stator), and a rotating part (rotor) composed of four bafes. The stirred-tank reactor model is rst simplied and triangulated in Rhino, which is the CAD tool used in this project. The normal orientations are checked, and the xed and rotating components of the reactor are saved as two separate STL les: STRSTATOR.STL and STRROTOR.STL. The simulation is driven by the data le STR.DAT (Example 10.2). The simulation is initialized by calling simini, implemented in CAD support.s. General conditions for the simulation are set therein. All of the situations presented here are dynamic. Therefore, local damping is turned off, and viscous damping at contacts is used to dissipate energy. An estimate of the maximum number of balls is specied to help optimize the PFC 3D search

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 13

algorithm, and gen error is turned off to ensure that the calculation does not stop due to any error during ball generation. STRSTATOR.STL is read rst, followed by STRROTOR.STL. As each component is read into PFC 3D, a unique color is assigned to it so that it can be identied through a color range function later on. The kinematics of the rotor are prescribed through a call to iniWallVel. Balls are created with a call to makeAssembly (which is specic for each example, and therefore implemented directly in STR.dat), and ball and wall properties are set. Finally, ball and wall properties are set, and a rotation speed equal to 1/2 turn per second is imposed around the vertical axis. The actual computation is done by calling simloop. Calculations are done in chunks of dt sav seconds, followed by the output of a save le. The resulting save les will be post-processed with Iv. The parameter ratio 1.0e-8 is used in the SOLVE command to make sure that SOLVE does not stop prematurely, before dt sav is completed. Figure 10.7 shows a snapshot of the simulation. The original rotor design is shown in Figure 10.8(left). An additional STL le, STRROTOR2.STL, representing a different design (Figure 10.8(right)), is also included, and can be substituted in place of STRROTOR.STL. Example 10.2 Main routine of STR.DAT
;fname: STR.DAT ; ; Itasca Consulting Group, Inc. ; ====================================================================== ; Importing CAD geometry data in PFC3D ; Stirred Tank Reactor example ; ------------------------------------------new ; Load support function call ../CAD_support.fis ;-------------; makeAssembly ;-------------def makeAssembly dens_b = 1000.0 s_stiff = 2.0e7 n_stiff = 2.0e7 s_stiffw = 2.0e7 n_stiffw = 2.0e7 x_min = 0.65

PFC 3D Version 4.0

10 - 14

Example Applications

x_max = 2.15 y_min = 0.65 y_max = 2.15 z_min = -2.29 z_max = 2.29 r1 = 0.075 ; --- Create assembly --; We create 4 set of balls in 2 colors num1 = 0 num2 = 0 num = 500 num1 = num2 + 1 num2 = num1 + num - 1 bc = wcolor_ command gen id=num1,num2 x=x_min,x_max y=y_min,y_max z=z_min,z_max & rad=r1, r1 prop color bc range id num1 num2 end_command temp = x_min x_min = -x_max x_max = -temp num1 = num2 + 1 num2 = num1 + num - 1 command gen id=num1,num2 x=x_min,x_max y=y_min,y_max z=z_min,z_max & rad=r1, r1 prop color bc range id num1 num2 end_command bc = wcolor_ + 1 temp = y_min y_min = -y_max y_max = -temp num1 = num2 + 1 num2 = num1 + num - 1 command gen id=num1,num2 x=x_min,x_max y=y_min,y_max z=z_min,z_max & rad=r1, r1 prop color bc range id num1 num2 end_command

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 15

temp = x_min x_min = -x_max x_max = -temp num1 = num2 + 1 num2 = num1 + num - 1 command gen id=num1,num2 x=x_min,x_max y=y_min,y_max z=z_min,z_max & rad=r1, r1 prop color bc range id num1 num2 end_command

ii = out(string(num)+ particles were created) end ;--------------------------- MAIN ROUTINE ----------------------------; initialize the simulation simini ; Read the STL files set fn_stl = STRrotor.stl readStlFile set fn_stl = STRstator.stl readStlFile ; Generate balls makeAssembly prop dens dens_b ks=s_stiff kn=n_stiff fric=0.4 wall prop ks=s_stiffw kn=n_stiffw ; set wall velocity set wxvel_ = 0. wyvel_ = 0. wzvel_ = 0. set wrxvel_ = 0. wryvel_ = 0. wrzvel_ = 1.57 _iniWallVel ;set gravity set grav 0 0 -10.0 ; plot view set pint 100 plot_view ; run the simulation loop set dt_sav = 1.0e-1 set flg_colorBallsBasedOnVel = 0

; translation ; rotation

PFC 3D Version 4.0

10 - 16

Example Applications

simloop ; ------------------------------------------return ; ====================================================================== ; EoF : STR.dat

Figure 10.7 Simulation of a stirred tank reactor with PFC 3D (STR.DAT)

Figure 10.8 Two bafe designs represented by STRROTOR.STL (left) and STRROTOR2.STL (right)

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 17

10.4.2 Additional Examples The following examples are not described in detail. The data les used to run the simulations have the same structure as STR.DAT, described above. The makeAssembly FISH function is specic to each case, and thus dened in a specic data le. All examples make use of simini and simloop, dened in the le CAD support.s. 10.4.2.1 Ball Mill A ball mill is used to grind particles. The following les are used in this application: BALLMILL.DAT, BALLMILLBODY.STL and BALLMILLCAP.STL. BALLMILLBODY.DAT represents the geometry of the mill. BALLMILLCAP.DAT is an end cap holding the particles inside the mill. The cap is rendered transparent to make the interior visible. BALLMILL.DAT contains a function that colors balls according to the magnitude of velocity (Figure 10.9(bottom)).

Figure 10.9 Ball mill (BALLMILL.DAT): the geometry (top) in operation, with balls colored according to the magnitude of their velocity (bottom)

PFC 3D Version 4.0

10 - 18

Example Applications

10.4.2.2 Blade Mill A blade mill is also used to grind particles. The following les are used in this application: BLADEMILL.DAT, BLADEMILLSTATOR.STL and BLADEMILLROTOR.STL. Particles are created in two different colors in order to illustrate the mixing process (Figure 10.10).

Figure 10.10 Blade mill

PFC 3D Version 4.0

Reading Computer-Aided Design (CAD) Data into PFC 3D

10 - 19

10.4.2.3 Bulldozer The following les are used in this application (Figure 10.11): BULLDOZER.DAT, BULLDOZER.STL and FLOOR.STL.

Figure 10.11 Bulldozer

PFC 3D Version 4.0

10 - 20

Example Applications

PFC 3D Version 4.0

Anda mungkin juga menyukai