|Message: Re: bad_alloc error after changing 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)|
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: > http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2010/01/22/05.03-15657-alDetectorConstruction.cc > > 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:||Outline Depth:||Add message:|