Message: Re: Cylinder volume filled with small spheres Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: Cylinder volume filled with small spheres 

Forum: Geometry
Re: Question Cylinder volume filled with small spheres (Cristian Bungau)
Date: 08 Mar, 2018
From: Michael H. Kelsey <Michael H. Kelsey>

On Thu, 08 Mar 2018 09:35:24 GMT, Cristian Bungau wrote:
> I have a tube of certain minimum and maximum radii, and I have to fill
> it with tiny spheres placed closed together right next to each other. I
> know one can use a for loop to place each volume with the calculated
> coordinates as a new placement copy of the same logical volume. But the
> memory consumption is huge and causes the code to crash because of this.
> If anyone can think of a better way using either replica or parametrised
> volumes, I would be very grateful if you could please let me know.

This is exactly what a parametrized volume is for. You'll need to make your physical tube a separate volume from the packed spheres. For example, create a "solid" cylindrical envelope volume (G4_Galactic material) matching your tube's OD. Place your tube as a daughter of that envelope.

Then make another "solid" cylinder (G4_Air material or whatever) matching your tube's ID. This will be the mother volume for a G4PVParameterised, containing all your little spheres. If you've already got a mapping from index to position, that will make writing your G4VPVParameterisation subclass much simpler. I had a case where the positions were taken from a CAD drawing (a lithography mask), so I put them into a text file and had my G4VPVParametrisation read it into a std::vector<G4ThreeVector>.

The spheres can't overlap, of course, but the also don't have to be touching. You will need to know in advance how many spheres there are in the tube (it's an argument to G4PVParameterised).

  -- Michael Kelsey

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: Cylinder volume filled with small spheres   (Cristian Bungau - 08 Mar, 2018)
(_ None: Re: Cylinder volume filled with small spheres   (Mike Kelsey - 08 Mar, 2018)
 Add Message Add Message
to: "Re: Cylinder volume filled with small spheres"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]