InverseLight / ValoMC

Monte Carlo software for simulating light propagation
https://inverselight.github.io/ValoMC/
Other
43 stars 14 forks source link

Error using MC2Dmex #26

Open Waves-base opened 10 months ago

Waves-base commented 10 months ago

While i try to run propram, i faced follwing error, any suggestions ?

xsize =  10;    % width of the region  [mm]
ysize =  10;    % height of the region [mm]
dh = 1;         % discretisation size  [mm]
vmcmesh = createRectangularMesh(xsize, ysize, dh);

% Create a light source
%    - Set a light source from boundary elements 4 to 7 
%    - Photons are launched at a random angle so that all angles have a cosinic distribution 
vmcboundary.lightsource(4:7) = {'cosinic'};

% Give optical parameters
%    - Constant optical parameters are set troughout the medium.
%    - Alternatively, optical parameters can set be for each element using indexing 

vmcmedium.absorption_coefficient = 0.01;     % [1/mm]
vmcmedium.scattering_coefficient = 1.0;      % [1/mm]
vmcmedium.scattering_anisotropy = 0.9;       % anisotropy parameter g [unitless]
vmcmedium.refractive_index = 1.3;            % refractive index [unitless]

% Run the Monte Carlo simulation
solution = ValoMC(vmcmesh, vmcmedium, vmcboundary);

% Plot the solution using MATLAB 
patch('Faces',vmcmesh.H,'Vertices',vmcmesh.r,'FaceVertexCData', solution.element_fluence, 'FaceColor', 'flat', 'LineWidth',1.5);
Error in initializing MC2D: The boundary condition array is not equal in size to the number of boundary elements

Error in ValoMC (line 265)
        [solution.element_fluence, solution.boundary_exitance, solution.boundary_fluence, solution.simulation_time, solution.seed_used] =
        MC2Dmex(H, HN, BH, r, BCType, BCIntensity, BCLightDirectionType, BCLightDirection, BCn, mua, mus, g, n, f, phase0, Nphoton,
        GaussianSigma, disable_pbar, uint64(rnseed));

Error in Test (line 21)
solution = ValoMC(vmcmesh, vmcmedium, vmcboundary);
Waves-base commented 10 months ago

This Issue has been solved.