Message: Re: Using density to define geometry Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Sad Re: Using density to define geometry 

Forum: Geometry
Re: None Using density to define geometry (Steven Walton)
Re: None Re: Using density to define geometry (Michael H. Kelsey)
Re: None Re: Using density to define geometry (Steven Walton)
Re: Idea Re: Using density to define geometry (Michael H. Kelsey)
Date: 03 Aug, 2015
From: Steven Walton <Steven Walton>

On Tue, 04 Aug 2015 01:21:21 GMT, Michael H. Kelsey wrote:
> 
> The division I showed in the G4cout statement is _only_ for purposes of
> human readability. All of the dimensional parameters you pass into G4
> functions should have the units multiplied into them. In the case of
> your box, you should have something like
> 
>     new G4Box("myBox", 10*cm, 1*m, 1*m);
> 
> or whatever. If you assign those quantities to variables, include the
> units in the assignment:
> 
>     G4double thickness = 10*cm;
>     G4double length = 1*m;
>     G4double width = 1*m;
> 
> In your example, you want to scale the thickness according to density,
> so that you always have a fixed mass of material (I guess). The simplest
> way to do this is to pre-set the total mass you want, e.g.,
> 
>     G4double kevlarMass = 1.44 * g/cm3 * 0.1*m3;    // Showing the density and volume explicity
> 
>     G4double density = // your scaled density here, in units of g/cm3
>     G4double thickness = kevlarMass/density/length/width;
> 
> So long as you assigned all of the values with units, as I've shown
> above, you will end up with thickness in units of length consistent with
> the length and width.
> 
> If you go to print stuff out, just do the division in the G4cout
> statements, not in assignments.
> 

Yes, I am trying to vary a box to have constant mass. And I am switching materials. I want the box to just be changing in thickness and everything else to be constant.

I am still at a loss here. Because if we look back to what I wrote in the OP I had

   G4double density = kevlarDensity; // 1.44 * g/cm3 from above
   G4double mass = 1. * g;
   G4double Box_y, Box_z = 1. * cm;
   G4double thickness = mass/(density * Box_y * Box_z);

So all of these have their correct units. (kevlarDensity was defined in the DefineMaterials() function to be 1.44*g/cm3) So we are correctly multiplying and dividing units. Or if I am not, I do not see where. Because in thickness I essentially have

   G4double thickness = (1.*g)/((1.44*g/cm3) * (1.*cm) * (1.*cm));

Which should result in 0.694444 * cm. But it doesn't. In fact, my box doesn't even show up. I have a detector behind this box and this is actually where I found the error. Because I was having the detector fill the empty space behind it, but was getting negative values. And even with using the units I am still getting these same errors. Honestly I don't understand what I am doing wrong. With units it works out on paper, I don't see why it doesn't on Geant4.

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

1 None: Re: Using density to define geometry   (Mike Kelsey - 03 Aug, 2015)
(_ Question: Re: Using density to define geometry   (Steven Walton - 04 Aug, 2015)
(_ None: Re: Using density to define geometry   (Mike Kelsey - 04 Aug, 2015)
(_ Note: Re: Using density to define geometry   (Steven Walton - 04 Aug, 2015)
(_ More: Re: Using density to define geometry   (Michael H. Kelsey - 04 Aug, 2015)
(_ Ok: Re: Using density to define geometry   (Steven Walton - 05 Aug, 2015)
(_ Ok: Re: Using density to define geometry   (Michael H. Kelsey - 05 Aug, 2015)
 Add Message Add Message
to: "Re: Using density to define geometry"

 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 ]