%-------------------------------------------------------------------------------
% UF Sparse Matrix Collection, Tim Davis
% http://www.cise.ufl.edu/research/sparse/matrices/Dehghani/light_in_tissue
% name: Dehghani/light_in_tissue
% [Light transport in soft tissue. Hamid Dehghani, Univ. Exeter, UK]
% id: 1873
% date: 2007
% author: H. Dehghani
% ed: T. Davis
% fields: name title A id date author ed kind b aux notes
% aux: Q nodes elements
% kind: electromagnetics problem
%-------------------------------------------------------------------------------
% notes:
% % The problem is solving the fluence (PHI) of light in soft tissue using
% % a simplified 3rd spherical harmonic expansion (SPN3) of the Radiative 
% % Transport Equation.  There are two coupled equations to solve:        
% % M1*phi1 = Q + (M2*phi2)                                   eq(1)       
% % (M4 - (M3*inv(M1)*M2))*phi2 = -2/3*Q + M3*inv(M1)*Q       eq(2)       
% % PHI = phi1 - (1/3).*phi2                                  eq(3)       
%                                                                         
% Problem = UFget ('Dehghani/light_in_tissue') ;                          
% A = Problem.A ;                   % get the problem                     
% Q = Problem.aux.Q ;                                                     
% k = size (A,1) / 2 ;                                                    
% M1 = A (1:k,1:k) ;                                                      
% M2 = A (1:k,k+1:end) ;                                                  
% M3 = A (k+1:end, 1:k) ;                                                 
% M4 = A (k+1:end, k+1:end) ;                                             
% elements = Problem.aux.elements ;                                       
% nodes = Problem.aux.nodes ;                                             
%                                                                         
% Q2 = (-(2/3).*Q) + (M3*(M1\Q)) ;  % create rhs for equation 2           
% Q2 = [sparse(k,1) ; Q2] ;                                               
% phi2 = A\Q2 ;                     % solve for phi2                      
% phi2 = phi2 (end/2+1:end,:) ;                                           
% Q1 = Q + M2*phi2 ;                % calculate rhs for equation 1        
% phi1 = M1\Q1;                     % solve for phi1                      
% PHI = phi1 - (1/3).*phi2;                                               
% figure (1) ; clf                  % plot results                        
% trisurf(elements, nodes(:,1), nodes(:,2), nodes(:,3), log(abs(PHI))) ;  
% shading interp ;                                                        
% view (2) ;                                                              
% colorbar('horiz') ;                                                     
% axis equal ;                                                            
% axis off ;                                                              
% colormap hot ;                                                          
%-------------------------------------------------------------------------------
