Message: Re: bad_alloc error after changing geometry Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: bad_alloc error after changing geometry 

Forum: Processes Involving Optical Photons
Re: Question bad_alloc error after changing geometry (Astrid Velroyen)
Date: 27 Jan, 2010
From: Wolfgang Lukas <Wolfgang Lukas>

Dear Astrid,

I have done similar simulations (also with an air gap defined as a separate physical volume) and hope to be able to give you some helpful ideas.

For me the air gap also increased the total computation time: there is an additional volume layer (air gap), so there will be more steps for the photons, and more calculations at the boundaries. Also the possibility of lossless total internal reflection at the scintillator-air boundary increases the lifetime of the photons, and it can cause "eternal trapping" inside a scintillator of e.g. box or cylinder shape.

I see that your LYSO crystal has a very high optical attenuation length (50m) and very thin diameter (1mm x 1mm), so "eternally trapped" photons bouncing around with very small y momentum will do "infinite loops" with many thousands of steps! Now in fact even a "perfectly polished" surface has some degree of roughness - if you use the UNIFIED model, I think a good value range for the "sigma_alpha" parameter is 0.5-1.0 deg (you can look for papers by M.Janecek for example). This can break the symmetry and reduce the CPU time.

If you prefer to keep your surfaces perfectly polished, you can perform a check for each new photon and eliminate the "eternal trapping" candidates (compare incident angles and critical angles on your boundaries).

Some further ideas on how to determine the source of the error:

- use e.g. /tracking/verbose 2 (in interactive mode or in a macro)

- print a warning in SteppingAction when e.g. the step number of your photons exceeds certain values

- use SteppingAction for detailed bookkeeping on the involved processes, volumes, etc. (you could write the data into a logfile)

I hope this gives you some helpful ideas to solve your problem. Good luck! :-)

Best regards, Wolfgang

On Fri, 22 Jan 2010 13:13:32 GMT, Astrid Velroyen wrote:

> Hi there!
> I have a problem with my optical photons simulation: I got a code which
> described a scintillation crystal within a box of aluminum as a
> reflector. On its one end of the crystal there is placed a quartz window
> and a photon sensitive detector. Everything with this code seems to work
> fine. Now, to make it more realistic, I tried to create a thin air gap
> between the crystal and the Aluminum reflector. I followed the same
> system as before: A box of Aluminum, which contains a box of air, which
> contains a box of scintillator. Air and scintillator should be shifted
> to one end, so that between the quartzwindow and the scintillator there
> is no other material. Please find my detector construction code
> attached.
>    Attachment:
> If I start this version, after some while (during the first event) I get
> a bad_alloc error. I can avoid this error by setting the polish of the
> crystal-air-surface to a 0.99. But still this version then needs a lot
> more (~ at least 10 times more) time than the version without the
> air-gap. My guess was that between the two parallel polished surfaces
> photons are captured for eternity. I tried to limit the maximum run time
> for a photon as described in the Application Guide on page 176 for
> neutrons, but if I set the maximum time to 200 ns (which is already too
> short for my simulation) the eror still occurs. Now I am running out of
> ideas what could cause this error or this extreme long duration of
> simulation. I have seen that some of you have implemented similar
> scenarios which are working fine. Does anyone have an idea what's wrong
> with my code? thanks in advance and best regards,
> Astrid

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

1 Feedback: Re: bad_alloc error after changing geometry   (Astrid Velroyen - 28 Jan, 2010)
 Add Message Add Message
to: "Re: bad_alloc error after changing geometry"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews