Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. router = 2; (*outside radius*)
  2. rinner = 1; (*inside radius*)
  3. rsmall = 0.1; (*radius of small pores*)
  4. nsmall = 40; (*number of small pores*)
  5. radii = RandomReal[{rinner + 2*rsmall, router - 2 rsmall},nsmall];(*radial position of smallpores*)
  6.  
  7. angle1 = RandomReal[{0, 2 $Pi$},nsmall];(*angular position of small pores*)
  8. coords = Map[radii[[#]]*{0, Sin[angle1[[#]]], Cos[angle1[[#]]]} &,Range[nsmall]];(*coordinates of small pores*)
  9. hollowsphere = RegionDifference[Ball[{0, 0, 0}, 2], Ball[{0, 0, 0}, 1]];(*first region interesection*)
  10. smallspheres = RegionUnion[Map[Ball[coords[[#]], rsmall] &, Range[nsmall]]];(*combine small pores*)
  11.  
  12. hollowsphereminussmallspheres = RegionDifference[hollowsphere, smallspheres] (*second region interesection*)
  13. r1 = ImplicitRegion[x < 0, {x, y, z}]; (*For visualization*)
  14. rplot = RegionIntersection[r1, hollowsphereminussmallspheres];
  15.  
  16. RegionPlot3D[rplot, PlotPoints -> 100]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement