EGSnrc icon indicating copy to clipboard operation
EGSnrc copied to clipboard

Single element materials without density correction file not working with pegsless mode

Open ojalaj opened this issue 5 years ago • 8 comments

When using a single element material without a density correction file, following is output:

  density_file polymethylmethacrylate__lucite___perspex___plexiglas_                                                                                                                         
  Error: Material not defined: W16p9_700

***************** Error:
 Material used in the geometry was not defined in the material data.

***************** Quiting now.

and to .mederr:

  For medium: W16p9_700
  Rho specified in material data file
  IAPRIM specified in material data file
  Error: Medium W16p9_700                not correctly defined.

Tested e.g. with EX16MVp on a develop branch from early October 2018. Works fine e.g. with WRE_19p4_700 (multiple elements, no density correction file) or SN700ICRU (single element, density correction file) or STEEL700ICRU (multiple elements, density correction file).

ojalaj avatar Feb 02 '19 21:02 ojalaj

@ojalaj is this still an issue?

ftessier avatar Apr 21 '21 19:04 ftessier

@ftessier Haven't tested on newest release, but tested on 2020 release and the answer is yes - I was still able to reproduce this issue.

ojalaj avatar Apr 21 '21 19:04 ojalaj

Then it is probably still active then (I don't recall any changes to pegsless in Release 2021). I will check it here, thank you! 🙏🏻

ftessier avatar Apr 21 '21 20:04 ftessier

I am not able to reproduce this problem in egs++ (using the egs_app example on a fresh EGSnrc clone). Here is the content of my mat.dat file:

medium   = test
rho      = 1
elements = AG

The simulation runs as expected and the relevant part of the output shows:

  Material data file: mat.dat                                                                                                                                                                                                                                                         

   Medium: air                     
 Sterncid: air                     
     rho:    1.20479E-03 g/cm^3
 Elements: C   N   O   AR  
    rhoz:    1.24000E-04   7.55267E-01   2.31781E-01   1.28270E-02
      pz:    1.03237E-05   5.39218E-02   1.44869E-02   3.21092E-04
  iunrst:     0
  iaprim:     0
    gasp:    0.00000E+00 atm.
  density correction file: /home/ftessier/repos/tmp/HEN_HOUSE/pegs4/density_corrections/compounds/air_dry_nearsealevel.density

   Medium: test                    
 Sterncid: test                    
     rho:    1.00000E+00 g/cm^3
 Elements: AG  
    rhoz:    1.07870E+02
      pz:    1.00000E+00
  iunrst:     0
  iaprim:     0
    gasp:    0.00000E+00 atm.

Maybe this is a BEAMnrc-specific issue, I will now try with that. In the meantime @ojalaj can you share the relevant part of your material definition file (where W16p9_700 is defined), and the part of the .egslog output where media information is reported?

ftessier avatar Apr 22 '21 12:04 ftessier

Ok, I am amble to reproduce this with BEAMnrc. Looking into it.

ftessier avatar Apr 22 '21 12:04 ftessier

@ftessier Good to hear! BTW - I'm not @jarkko, but @ojalaj .

ojalaj avatar Apr 22 '21 13:04 ojalaj

Oops! 🤦🏻 Thanks for pointing that out... (although @jarkko is also from Tampere! 😄 )

ftessier avatar Apr 22 '21 13:04 ftessier

@blakewalters it seems that there is no ELSE to the relevant IF in egs_get_media_input.mortran, handle the case where the density correction file is not specified in the material. This seems to be the cause of this issue. Can you take a look at it?

ftessier avatar Apr 22 '21 18:04 ftessier