MONTE CARLO SIMULATION OF FLUID FLOW M. Ragheb 3/7/3 INTRODUCTION We conside the situation of Fee Molecula Collisionless and Reflective Flow. Collisionless flows occu in the field of aefied gas dynamics. The molecules in this case can impinge on a suface and then be eflected to e-impinge on the suface seveal times befoe escape. These types of flow which involve multiple inteactions occu in intenal as well as extenal flows past bodies of complex geomety. If we conside a suface exposed to a gas unde fee-molecule conditions, the numbe of molecules incident pe unit time on a suface element d at the location diectly fom the extenal gas can be witten as: N () d () The numbe of molecules pe second that stikes d at thei second collision is: N ( ) d = P( ', ) N ( ') d ' d () whee P(,) is the pobability that a molecule eflected fom the element of suface d at the location stikes the new location. The numbe of paticles stiking d at thei thid collision becomes: N ( ) d = P( ', ) N ( ') d ' d (3) 3 As descibed by G. Bid, the total numbe flux at a location becomes the sum: N() = N () + N () + N () +... (4) 3 Substituting fom Eqs.-3 into Eqn. 4 yields: N () = N() + P( ', )[ N ( ') + N ( ') + N ( ') +...] d' 3 (5) This yields a Fedholm integal equation of the second kind: N () = N() + P (',) Nd () ' (6)
This integal equation is analogous to othe equations aising in the field of neuton tanspot, namely the desciption of a neuton beam impinging on a shield, o the slowing down of a neuton in a modeato. This means that the methods of analysis in both fields ae simila. PARTICLE TRACKING IN MONTE CARLO SIMULATIONS The tacking of paticles in complex geometies is an impotant aspect of Monte Calo simulations. Complex geometies ae descibed in paticle tanspot codes in tems of diffeent sufaces whose intesections and unions ae in tun descibed in combinatoial geometies modules. Figue. Geomety fo paticle tacking and detemination of diection cosines. The intesection of paticle tajectoies with diffeent sufaces can be obtained fom thee-dimensional coodinate geomety. Consideing the x-axis as the diection of popagation, the diection cosines of a paticle ae given by: x u = = cosθ y v = = sinθcosφ z w = = sinθsinφ (7)
A staight line tajectoy can be descibed in tems of these u, v and w diection cosines and the initial point fom which the line oiginates: (x, y, z ). We conside the intesection of a line of length l descibed as: x= x + ul. y= y + vl. z = z + wl. (8) with a quadic suface given by: Sxyz (,, ) = ax + a y + a z + 33 a yz + a zx + a xy + 44 3 3 a x+ a y+ a z+ a 4 4 34 = (9) Defining: A= au + av+ aw+ 33 a vw + a wu + a uv 3 3 A = ua ( x+ a y+ a z+ a ) + 3 4 va ( x+ a y+ a z+ a ) + 3 3 4 wa ( x+ a y+ a z+ a ) A= Sx (, y, z) 3 3 33 34 () The positive eal oot of the quadatic equation gives the intesection point of the line and the quadatic suface: Al + Al+ A = () 3 The two eal oots ae: l, A ± 4A 4AA = A 3 A ± A AA = A 3 () The eal oots ae substituted into the equation of the line to detemine the two intesection points:
X = x + ul. Y = y + vl. Z = z + wl. (3) and: X = x + ul. Y = y + vl. Z = z + wl. (4) The positive oot is taken as the new point fom which to stat a new paticle eflection and tanspot. CYLINDRICAL TUBE FREE MOLECULAR FLOW As an application we conside the fee molecula gas flow though a cylindical tube of adius and length b as shown in Fig.. The gas impinges fom the left side and flows though the tube though the pocess of effusion to the ight side along the x-axis. The molecules passing though the tube ae of two categoies:. Those that pass diectly though the tube,. Those that ae eflected once o multiple times though the inne suface of the tube. The total paticle flux though the tube thus takes the fom of Eqn. 6 as: b N = N + N( x) P( x) dx (5) total diect whee P(x) is the pobability that a paticle eflected fom the element of length dx at x passes though the tube. This equation cannot be applied to unsteady flows since it does not contain the time explicitly. Its solution has been fist been attempted by Clausing in 96. The testpaticle Monte Calo method can be applied to its solution by consideing a lage numbe of molecula tajectoies to calculate the values of N total and N diect. The solution to the poblem is dependent on the tube length to diamete atio: b L = (6) as shown in Fig..
Figue. Cylindical Tube Flux poblem geomety. MONTE CARLO PROCEDURE The fist step in simulating the paticle tanspot poblem is to sample the adial position of the souce paticle on the left face of the tube. The appopiate pobability density function fo the adial position is: πd πd p() d = = a π a π d (7) Its cumulative distibution function is equated to a pseudoandom numbe unifomly distibuted ove the unit inteval as: C () π d = = = π a a ρ (8) Upon invesion this yields a sampled adius given by: = aρ (9)
The impinging paticles follow a cosine pobability density function epesenting a souce on a plane coveing a π solid angle, with the pola angle vaying ove the inteval to π/, given by: sinθcosθdθdφ p( θφ, ) dθdφ= () π which can be sepaated into the two pobability density functions fo the pola and the azimuthal angles: p( θφ, ) dθdφ= p( θ) dθ. p( φ) dφ, p( θ) dθ = sinθcos θdθ, dφ p( φ) dφ =. π () The cumulative distibution function fo the azimuthal angle is given by: C( φ) φ dφ φ π π = = = ρ () Upon invesion this yields the sampled azimuthal angle: φ = πρ (3) The cumulative distibution fo the pola angle is given by: θ C( θ) = sinθcosθdθ = cos θd(cos θ) = cos θ = cos θ = ρ θ (4) θ 3 This yields fo the sampled pola cosine of the pola angle: 3 3 µ = cos θ = ( ρ ) ρ (5) The diection cosines can then be calculated accoding to Eqn. 7:
x u = = µ y v = = ( µ ) cosφ z w = = ( µ ) sin φ (6) The paticle tacking pocess then poceeds accoding to the pocedue shown in Fig. 3.! Fee_Molecula_Flow.fo! Fee collisionless molecula flow though a cicula tube! Test Paticle Monte Calo Simulation! Magdi Ragheb pogam Fee_Molecula_Flow eal lt,diect,fdiect,passing,fpassing,l,m,n intege tials eal :: adius=. eal :: length=.! Length to adius atio, lt lt=length/adius wite(*,*) 'Length to adius atio=',lt! Total numbe of tials tials= wite(*,*) 'Total numbe of tials=',tials! Initialize countes! Numbe of paticles passing diectly though tube without! collisions: though diect=.! Total numbe passing though tube passing=.! Loop ove total numbe of tials do i=,tials! Sample a andom adius at tube enty face call andom() =adius*sqt()! Sample souce diection cosines call souce(l,m,n)! Calculate position of souce intesection with cylinde a=m*m b=n*n c=adius*adius d=* position=l*(*m+sqt(c*(a+b)-d*b))/(a+b)! Test fo paticle exiting cylinde if(position.gt.length) goto 777! Calculate diffuse diection cosines fo eflection off the wall! Upon eflection, m eveses to l and m eveses to l call souce(m,l,n)! Detemine next intesection point position=position+.*l*adius*m/(m*m+n*n)! Test if position less than zeo if (position lt..) goto 999! Test fo position lage than length of tube
if (position.gt length) goto 888! Let paticle eflect off bounday go to! Scoe a paticle diectly passing though tube 777 diect=diect+.! Scoe a tansmitted paticle 888 passing=passing+.! Do not scoe, stat new saouce paticle 999 continue end do! Geneate output esults! Faction passing diectly though tube without collisions fdiect=diect/tials! Total faction of paticles passing though tube fpassing=passing/tials wite(*,*)'faction passing diectly though=',fdiect wite(*,*)'total faction passing=',fpassing end suboutine souce(w,u,v) eal u,v,w! Simulation of effusion o gas emission pi=3.459 call andom()! Diection cosine along diection of effusion o z-axis! w=cos(pola angle theta), takes values fom zeo to one costheta=sqt() sintheta=sqt(.-w*w)! Sample azimuthal angle phi call andom() phi=.*pi*! Diection cosines! elative to x-axis u=sintheta*cos(phi)! elative to y-axis v=sintheta*sin(phi)! elative to z-axis w=costheta etun end Figue 3. Monte Calo pocedue fo the cylindical Tube Flux Poblem.
Figue 4. Flow Chat fo computational steps.
A special case of the quadatic suface of Eqn. 9 fo the case of the cylinde is given with: a a = a =,. 33 44 = The initial coodinates take advantage of symmety and and become: z y x =, =, =. Thus one can deduce that the coodinates of the intesection of the paticle s path with the cylinde, using symmety is: x u v + v + w w int = y z int int { [ ( ) } ], v + w = =. The new x coodinate value of the next point of intesection with the cylindical suface becomes: x new u v = x + int int int vint + wint A flow Chat fo the computational steps is shown in Fig. 4. DISCUSSION The esult of the Monte Calo simulation fo a tube with a length to adius atio of unity is shown in Table. It is also compaed to the same analytical esult by Clausius fo the same atio. It should be noticed that the methodology discussed hee is useful fo steady state flows. Howewve since it does not involve the time vaiable explicitly, if unsteady flow is unde consideation, then an appoach involving Diect Simulation Monte Calo (DSMC) becomes the possible altenative. Table. Compaison of Monte Calo and Analytical esults. Monte Calo Simulation Exact Analytical esult 6 paticles Clausing (93) Length to adius atio
Faction passing diectly though Total faction passing though tube.3899 -.683983.67 EXERCISE. Fo the poblem of fee molecula flow though a tube, plot the faction passing diectly though and the total faction passing as a function of the length to adius atio of the tube.