hi Viet,
I see you are using a planar source type - a planar source launches photons at various locations, it is one of what we called a "widefield" sources. If the source-aperture is outside of the mesh domain, it requires an extra "mesh re-tessellation" step, see our 2016 paperhttps://opg.optica.org/boe/fulltext.cfm?uri=boe-7-1-171&id=333806
you can also see how this is done in our built-in mmclab
examples:
https://github.com/fangq/mmc/blob/master/mmclab/example/demo_sfdi_2layer.m#L55-L60
if you don't have this step, you can not set the "InitElem" value
(the index of the tetrahedron that encloses all launched photon
position) in the input file because the photon launch position is
outside of the mesh. I see you set InitElem to 1, but if a photo
is launched outside of element#1, then mmc could crash and cause
memory errors.
to launch a widefield source located inside the mesh is a bit tricky.
if your mesh is generated so that there is a single tetrahedron element completely enclosing your source aperture, then, in theory, you should be able to set InitElem (or cfg.e0) to the index of this element, just like a pencil beam source. I used "in theory" here because this did not actually work, until last week after this fix
https://github.com/fangq/mmc/commit/e68a427e8e9f3d962eaa5b6e97a9a4cc91e34cf4
if a widefield source embedded inside a mesh covers more than a single element, it is still possible to model it - in this case, you should find all elements that are potential photon launch sites, and label their element type (cfg.elemprop) to -1. This is a special label indicating that these are elements to be tested for photon launching. When running the simulation, mmc sequentially test each -1 labeled elements and find the initial element ID dynamically. The only down-side of this approach is that mmc treats -1 labeled elements as air (use cfg.prop(1,:) as optical property), so it is quite limited.
Qianqian
--
You received this message because you are subscribed to the Google Groups "mmc-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mmc-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mmc-users/2dfe4db7-e73f-432d-bc3f-220d0ed80fcdn%40googlegroups.com.
by the way, as I announced recently, we also have released pmmc -
the Python version of mmc - on pypi
https://pypi.org/project/pmmc/
you don't really need to save mesh/input to files and run mmc binary for this simulation. You can just define a cfg dict and call pmmc.run(cfg) in Python, see examples
To view this discussion visit https://groups.google.com/d/msgid/mmc-users/d304319f-6237-4b80-8610-61363c1c7b45%40neu.edu.