Problem 2134 - Wrong density calculation in ConstructNewIdealGasMaterial
Summary: Wrong density calculation in ConstructNewIdealGasMaterial
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: materials (show other problems)
Version: 10.5
Hardware: All All
: P4 major
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2019-02-13 13:14 CET by Shoichiro Nishimura
Modified: 2019-02-26 11:22 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Shoichiro Nishimura 2019-02-13 13:14:23 CET
When the material is constructed by G4NistMaterialBuilder::ConstructNewIdealGasMaterial() and the number of atoms (nbAtoms) increases, its density also increase in spite of the same temperature and pressure.
I think that its density must be divided by the total number of atoms.
However the type of this argument is <int>, so I cannot control at all.
Comment 1 Vladimir.Ivantchenko 2019-02-17 11:25:51 CET
Dear Shoichiro,

thank you very much for this post. When we introduced a fix for your problem report 2133 we also extend example code $G4INSTALL/examples/extended/electromagnetic/TestEm8, where we test now all material constructors. From this test the density and other parameters seems to be as expected, so the method seems to be correct.

You may do an independent test: define material by different methods and compare results printing material properties.

best regards,
Vladimir
Comment 2 Shoichiro Nishimura 2019-02-19 07:02:07 CET
Dear Vladimir,

thank you for the confirmation and comment.
I'm very sorry, but now I understand that my usage of this function might be wrong.

I want to construct Kr-He mixture gas, so the vector,
vector<int> v_n_atoms = {4,6};
was used. However, the constructor ConstructNewIdealGasMaterial supports for compound gas (e.g. CH4), not for mixture gas.

I wish a new constructor for mixture gas would be developed in the future.
(Maybe I should use ConstructNewMaterial. 
or the constructor for mixture gas has already implemented?)


best regards,
Shoichiro

(In reply to Vladimir.Ivantchenko from comment #1)
> Dear Shoichiro,
> 
> thank you very much for this post. When we introduced a fix for your problem
> report 2133 we also extend example code
> $G4INSTALL/examples/extended/electromagnetic/TestEm8, where we test now all
> material constructors. From this test the density and other parameters seems
> to be as expected, so the method seems to be correct.
> 
> You may do an independent test: define material by different methods and
> compare results printing material properties.
> 
> best regards,
> Vladimir
Comment 3 Vladimir.Ivantchenko 2019-02-26 11:22:07 CET
Dear Shoichiro,

If you need an extra constructor then you may propose a signature of such new material constructor. 

You need to take into account, that we have two type of constructors: via number of atoms and via mass fraction. In the case of mass fraction, it is not possible internally recompute the number of molecules. Simple example: CH and C2H2 molecules have the same mass fraction of C and H atoms but different pressure for the same density. The ideal gas condition requires knowledge on number of atoms.

In general, construction via number of atoms is needed for gases, for mass fractions - for compound solids and liquids where we do not care about pressure.

Vladimir