This project has moved and is read-only. For the latest updates, please go here.

Gaussian Beam Input Source

Sep 29, 2011 at 5:17 PM

I would like to use the command-line MC solver to compute the reflectance as a function of "rho" due to a Gaussian beam incident normally on a homogeneous semi-infinite medium. In particular, I would like to be able to compute this reflectance for different values of the "beam waist" (i.e. the standard deviation of the Gaussian beam profile). Could you provide some help on how to specify such a problem within an input XML file?


Sep 30, 2011 at 4:05 AM

Hi Arnold!  Thanks for your question.

I have generated an input xml file for your use. Please copy the line below, paste into notepad or XMLNotepad (it should work either way but
will be easier to edit with XMLNotepad) and save to a file with ".xml" extension.

SimulationInput xmlns="" xmlns:i=""><DetectorInputs xmlns:a=""><a:anyType i:type="ROfRhoDetectorInput"><Name>ROfRho</Name><Rho xmlns:b=""><Count xmlns="">101</Count><Delta xmlns="">0.1</Delta><Start xmlns="">0</Start><Stop xmlns="">10</Stop></Rho><TallyType>ROfRho</TallyType></a:anyType></DetectorInputs><N>100</N><Options><AbsorptionWeightingType>Discrete</AbsorptionWeightingType><PhaseFunctionType>HenyeyGreenstein</PhaseFunctionType><RandomNumberGeneratorType>MersenneTwister</RandomNumberGeneratorType><Seed>0</Seed><SimulationIndex>0</SimulationIndex><TallySecondMoment>true</TallySecondMoment><TrackStatistics>false</TrackStatistics><WriteDatabases /></Options><OutputName>Gaussian_source_one_layer_ROfRho</OutputName><SourceInput i:type="CustomCircularSourceInput"><AzimuthalAngleEmissionRange xmlns:a=""><Count xmlns="">2</Count><Delta xmlns="">0</Delta><Start xmlns="">0</Start><Stop xmlns="">0</Stop></AzimuthalAngleEmissionRange><BeamRotationFromInwardNormal xmlns:a=""><a:Phi>0</a:Phi><a:Theta>0</a:Theta></BeamRotationFromInwardNormal><InitialTissueRegionIndex>0</InitialTissueRegionIndex><InnerRadius>0</InnerRadius><NewDirectionOfPrincipalSourceAxis xmlns:a=""><a:Ux>0</a:Ux><a:Uy>0</a:Uy><a:Uz>1</a:Uz></NewDirectionOfPrincipalSourceAxis><OuterRadius>3</OuterRadius><PolarAngleEmissionRange xmlns:a=""><Count xmlns="">2</Count><Delta xmlns="">0</Delta><Start xmlns="">0</Start><Stop xmlns="">0</Stop></PolarAngleEmissionRange><SourceProfile i:type="a:GaussianSourceProfile" xmlns:a=""><a:BeamDiaFWHM>1</a:BeamDiaFWHM></SourceProfile><SourceType>CustomCircular</SourceType><TranslationFromOrigin xmlns:a=""><a:X>0</a:X><a:Y>0</a:Y><a:Z>0</a:Z></TranslationFromOrigin></SourceInput><TissueInput i:type="MultiLayerTissueInput"><Regions xmlns:a=""><a:anyType i:type="b:LayerRegion" xmlns:b=""><b:RegionOP xmlns:c=""><c:G>1</c:G><c:Mua>0</c:Mua><c:Mus>1E-10</c:Mus><c:Musp>1E-10</c:Musp><c:N>1</c:N></b:RegionOP><b:ZRange xmlns:c=""><Count xmlns="">2</Count><Delta xmlns="">INF</Delta><Start xmlns="">-INF</Start><Stop xmlns="">0</Stop></b:ZRange></a:anyType><a:anyType i:type="b:LayerRegion" xmlns:b=""><b:RegionOP xmlns:c=""><c:G>0.8</c:G><c:Mua>0.01</c:Mua><c:Mus>5.0000000000000009</c:Mus><c:Musp>1</c:Musp><c:N>1.4</c:N></b:RegionOP><b:ZRange xmlns:c=""><Count xmlns="">2</Count><Delta xmlns="">100</Delta><Start xmlns="">0</Start><Stop xmlns="">100</Stop></b:ZRange></a:anyType><a:anyType i:type="b:LayerRegion" xmlns:b=""><b:RegionOP xmlns:c=""><c:G>1</c:G><c:Mua>0</c:Mua><c:Mus>1E-10</c:Mus><c:Musp>1E-10</c:Musp><c:N>1</c:N></b:RegionOP><b:ZRange xmlns:c=""><Count xmlns="">2</Count><Delta xmlns="">INF</Delta><Start xmlns="">100</Start><Stop xmlns="">INF</Stop></b:ZRange></a:anyType></Regions></TissueInput></SimulationInput>


The "SourceInput" defines a normally incident beam.  Fields that need editing are:

  1. "SourceProfile->BeamDiaFWHM" - this is the full width half max of Gaussian beam.
  2. "OuterRadius" - this defines the maximum radius of sampled source, e.g. 3 * BeamDiaFWHM would define a source that goes out to 6 sigma.
  3. "InitialTissueRegionIndex" - in the 3-layer system (air-tissue-air) that is defined in "TissueInput", this should be set to 0 if you'd like the source to go through Fresnel prior to entering the tissue, or 1 if not.

Let me know if you have any problems or questions.

Sep 30, 2011 at 6:16 AM

They really should allow attachments to these discussions! For reference, here's a "prettier" version (raw XML at the bottom):

Sep 30, 2011 at 5:20 PM

Thanks! I'll give it a try this weekend and report back with details of my success or some follow-up questions.

Sep 30, 2011 at 6:44 PM

You can find more information about sources in this document

Sep 30, 2011 at 10:50 PM

Hi All. I tried running the code using the XML file David posted and I got the following error.

input file specified as infile_adk.xml

Invalid enum value '       ROfRho      ' cannot be deserialized into type

'Vts.MonteCarlo.TallyType'. Ensure that the necessary enum values are

present and are marked with EnumMemberAttribute attribute if the type has

DataContractAttribute attribute.

Any ideas? Did I not copy something correctly into the infile?

Sep 30, 2011 at 10:51 PM

Sorry - I forwarded blindly and should have checked the fidelity. Will take a look right now...

Sep 30, 2011 at 11:03 PM

My mistake.  I found a missing [KnownType] in SimulationInput while testing it but forgot to push the fixes to codeplex.  I'll do that right now.

Sep 30, 2011 at 11:10 PM

I don't think that was the only problem...the XML I posted was confused with all the '\n' new-lines in the pretty version. Using the XML Carole pasted should create the following "new" issue:

e.Message = "Type 'Vts.MonteCarlo.Sources.DirectionalCircularSource' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.

Janaka, can you perhaps help to make sure we have serialization (read/write) tests for all the source inputs?

Sep 30, 2011 at 11:15 PM

I just tested the posted infile with the addition of the [KnownType] and all looks good.  I will push to codeplex and call it MC 1.0.2?

Sep 30, 2011 at 11:39 PM

I just created a new MC download V1.0.2 Beta.  In it there is a sample input file called infile_Gaussian_source_one_layer_ROfRho.xml that should work for you. 

I'm sorry about the trouble you've experienced.  I hope it goes more smoothly for you now.   Carole

Oct 1, 2011 at 2:26 AM

Running the code as I write. Thanks! Will keep you posted on what I obtain.