|Message: Re: Using density to define geometry||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
On Mon, 03 Aug 2015 22:39:21 GMT, Steven Walton wrote:
> > You need to include the unit conversion in the output. What you're > > seeing is the internal storage of dimensional values in Geant4. For > > density, the internal units would be something like MeV/mm^3. Change > > your output to be: > > > > G4cout << kevlarDensity / (g/cm3) << " g/cm3" << G4endl; > > > > You can also ask Geant4 to do this for you automatically in output: > > > > G4cout << G4BestUnit(kevlarDensity, "Density") << G4endl; > > > > where G4BestUnit is defined in G4UnitsTable.hh.
> Then how do I properly define my box > > G4Box* testBox = new G4Box("testBox", > thickness, > worldSize, > worldSize); > When I output > > G4cout << kevlarDensity / (g/cm3) << " g/cm3" << G4endl; > > I get 1.95527e+195 g/cm3, which is the same output I get if I just > output "density" (not the kevlarDensity). I've been trying to remove the > units in my equation and then add the remaining unit I need but this > doesn't seem to be working.
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.
|Inline Depth:||Outline Depth:||Add message:|