Hi, This is a code snippet to create a hollow cylinder that’s closed from both ends that I’ve been using
G4double shroudThickness = 0.1*mm
G4Tubs* outer = new G4Tubs("outer", 0.0*mm, fRadius, (fLength/2.0), 0, 2*pi);
G4Tubs* inner = new G4Tubs("inner", 0.0*mm, fRadius-shroudThickness, (fLength/2.0)-shroudThickness, 0, 2*pi);
G4SubtractionSolid* shell = new G4SubtractionSolid("shell",outer,inner);
How can I make the cylinder open ended from top and closed from bottom?
I’m trying something like this
G4double shroudThickness = 0.1*mm
G4Tubs* outer = new G4Tubs("outer", 0.0*mm, fRadius, (fLength/2.0), 0, 2*pi);
G4Tubs* inner = new G4Tubs("inner", 0.0*mm, fRadius-shroudThickness, (fLength/2.0), 0, 2*pi);
G4SubtractionSolid* shell = new G4SubtractionSolid("shell",outer,inner);
but that doesn’t seem to work.
When you do the subtraction, you need to specify an offset position for the “inner” cylinder, so that it “sticks out” on the side you want to have opened. See G4SubtractionSolid.hh
for the appropriate constructor arguments.
evc
July 6, 2023, 4:02pm
3
Required cylinder can also be constructed without Boolean subtraction, see G4Polycone.hh
.
I tried using it
const G4int numZPlanes = 5;
const G4double zPlane[numZPlanes] = {-fLength / 2.0, -fLength / 2.0, (fLength / 2.0 - shroudThickness), fLength / 2.0, fLength / 2.0};
const G4double rInner[numZPlanes] = {0.0, 0.0, 0.0, 0.0, 0.0};
const G4double rOuter[numZPlanes] = {fRadius, fRadius, fRadius - shroudThickness, fRadius, fRadius};
G4Polycone* tpbInnerShroud = new G4Polycone(logicalName + G4String("Inner"), 0, 2 * pi, numZPlanes, zPlane, rInner, rOuter);
but it constructs cylinder with both ends closed, am I doing something wrong?
evc
July 6, 2023, 5:25pm
5
const G4int numZPlanes = 4;
const G4double zPlane[numZPlanes] = {-fLength / 2.0, (-fLength / 2.0 + shroudThickness), (-fLength / 2.0 + shroudThickness), fLength / 2.0};
const G4double rInner[numZPlanes] = {0.0, 0.0, fRadius - shroudThickness, fRadius - shroudThickness};
const G4double rOuter[numZPlanes] = {fRadius, fRadius, fRadius, fRadius};
1 Like
system
Closed
July 13, 2023, 10:55pm
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.