the two quantities you computed, absorb and reflect, have different units, one is fluence (J/mm^2), the other is energy (J).
you should change the below line
--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/9f6f43f4-4296-48d5-8e4d-4c22c74a7479n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/16cbbfd3-9b61-4565-360e-90847b50b30b%40neu.edu.
Haohui,
thanks, now I see the issue. I also understood now why you designed such a large domain - as you intended to minimize the escaping photons from other sides.
I was able to reproduce the loss of total energy (absorb+reflect) in 1e8 and 1e9 cases. I recognize that this is a bug in the code - reminding me that I had encountered a similar bug previously.
I just created a ticket for this problem and explained the reasons, please see #195
https://github.com/fangq/mcx/issues/195
basically, this is related to another high-priority bug I fixed back in 2018 (#41)
https://github.com/fangq/mcx/issues/41
what happened was that mcx uses "single-precision" floating point numbers for all fluence calculations instead of "double precision". This is because modern GPUs primarily uses single-precision float (fp32) for the bulk of the computation; double-precision hardware is very weak (1-vs-32 compared to single hardware) on consumer-grade GPUs (gaming or laptop GPUs), and only has strong presence on enterprise grade GPUs (Tesla), which are very expensive.
Because of this, we have optimized mcx to avoid double-precision
(fp64) math or storage and exclusively using fp32. However, fp32
has limitations when performing numerous accumulations like the
one used in mcx: when adding a small energy loss over a large
existing number, such as a voxel near the source, the round-off
error is quite large and resulting in loss of precision (and
effectively loss of energy).
In #41, we developed a double buffer approach to avoid such loss
using pure fp32 storage (see the figures in #41), however, it was
only applied to fluence, but not applied to dref accumulation.
the issue you reported is related to such loss in dref (i.e. your
reflect value) due to the above reason. I just applied the
following patch to fix this
https://github.com/fangq/mcx/commit/9220578840024b296843dc595432471086037a25
after using this patch, the loss in 1e8 an 1e9 are gone. the absorb+reflect values are reasonably close to 1.
I just recompiled all mcx-related nightly-build packages, please download from https://mcx.space/nightly/ and test again. I have also updated pmcx to v0.2.6 to include the fix to this critical bug.
by the way: if you know how to recompile mcx, you can run "make double" or "make moredouble" to use double-precision buffer to accumulate fluence/dref. This is an alternative solution, but its speed depends on your GPU fp64 hardware.
Qianqian
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/9d805f87-9ff1-4bc4-bd37-45802e18dc04n%40googlegroups.com.