svalinn / DAGMC

Direct Accelerated Geometry Monte Carlo Toolkit
https://svalinn.github.io/DAGMC
Other
104 stars 65 forks source link

Review sourcb.F90 for compatibility with DagMC #3

Open gonuke opened 12 years ago

gonuke commented 12 years ago

(was CVSTrac Ticket 440)

Investigate MCNP5 file sourcb.F90 for compatibility with DagMC. Some features of MCNP's source specifications may be unsupported by DAG-MCNP, and these unsupported features need to be added or their absence documented.

gonuke commented 12 years ago

2011-Aug-15 17:38:44 by sjackson:

sourcb.F90 is a maintainer's nightmare. (Out of 650 lines, 49 lines contain goto statements, 28 lines are numeric labels, and and 26 lines contain cycle statements. Sigh.)

In the tests I'm doing, setting the dagmc check_src_cell=off card in an input file does not actually disable chkcel calls for newly born particles. This issue is observed in ticket 440. Fixing this feature is probably the first issue to address in dealing with sourcb.F90. Ticket 265 rightly observes "I think the chkcel call in sourcb.f90 around line 522 needs circumvented." There is code in sourcb.F90 that attempts to implement the dagmc source cell optimization, but I am doubtful whether this implementation was ever completely right, at least for most cases. I'd be curious to see the input files for any test cases where the source cell optimization was believed to have worked correctly.

gonuke commented 12 years ago

_2011-Aug-16 16:57:12 by sjackson:

I made two changes in r324 to attempt to fix support for check_src_cell=off.

These changes are sufficient to allow the unit test given in ticket 449 to behave as intended (particles spawned in the wrong cell get lost when the optimization is applied).

I'm not sure part (B) should ever have been implemented. The only behavioral difference I observed is that it causes MCNP5 to crash if =check_src_cell=off= is specified and the user forgets to add a =CEL= entry to the =SDEF= card. I think this code segment may only have executed when the =CEL= entry is not given on the =SDEF= card. But I am not sure, given the complexity of sourcb.

I've changed the glue code to print a warning on stdout that the source cell optimization is experimental. I'm not sure r324 is sufficient or correct in all cases. I am also hesitant to continue spending time on making this optimization work correctly, because its benefit is often minor: it saves one call to =chkcel= per particle history, resulting in a savings of one ray-fire per history.