EIDORS: Electrical Impedance Tomography and Diffuse Optical Tomography Reconstruction Software |
EIDORS
(mirror) Main Documentation Tutorials − Image Reconst − Data Structures − Applications − FEM Modelling − GREIT − Old tutorials − Workshop Download Contrib Data GREIT Browse Docs Browse SVN News Mailing list (archive) FAQ Developer
|
EIDORS fwd_modelsSolving the forward problem for EIT in 3D with higher order finite elementsThe implementation (and convergence analysis in 2D) of the high order finite elements for CEM are described in detail at
%Make an inverse model and extract forward model imdl = mk_common_model('n3r2',[16,2]); fmdl = imdl.fwd_model; %Default EIDORS solver %Make image of unit conductivity img0 = mk_image(fmdl,1); img0.fwd_solve.get_all_meas = 1; %Internal voltage v0=fwd_solve(img0); v0e=v0.meas; v0all=v0.volt; %High-order EIDORS solver %Change default eidors solvers fmdl.solve = @fwd_solve_higher_order; fmdl.system_mat = @system_mat_higher_order; fmdl.jacobian = @jacobian_adjoint_higher_order; %Add element type and make image of unit conductivity fmdl.approx_type = 'tet4'; % linear img1 = mk_image(fmdl,1); img1.fwd_solve.get_all_meas = 1; %Internal voltage v1 = fwd_solve(img1); v1e=v1.meas; v1all=v1.volt; %Plot electrode voltages and difference subplot(211); plot([v0e,v1e,[v0e-v1e]*100]); legend('0','1','(1-0) x 100','Location','SouthEast'); xlim([1,100]); print_convert forward_solvers_3d_high_order01a.png Figure: The plot reassuringly shows the two approximations (eidors default and the high order linear solver) both agree at machine precision on the electrodes. %Get internal linear voltage distribution for first stimulation v1all = v1.volt; img1n = rmfield(img1,'elem_data'); img1n.node_data = v1all(1:size(fmdl.nodes,1),1); %add first stim data %Plot the distribution subplot(121); show_slices(img1n,[inf,inf,2.5]); eidors_colourbar(img1n); %Get internal voltage distribution for difference eidors/high order img11n=img1n; img11n.node_data=v1all(1:size(fmdl.nodes,1),1)-v0all(1:size(fmdl.nodes,1),1); %Plot the difference of two linear approximations subplot(122); show_slices(img11n,[inf,inf,2.5]); eidors_colourbar(img11n); print_convert forward_solvers_3d_high_order02a.png Figure: The left plot shows the voltage distribution for the first stimulation using the linear high order solver. The right plot shows the difference between the default eidors solver and the linear high order solver, which agree to machine precision. %Repeat with quadratic and cubic finite elements %Quadratic FEM fmdl.approx_type = 'tet10'; %Quadratic img2 = mk_image(fmdl,1); img2.fwd_solve.get_all_meas = 1; %Internal voltage v2 = fwd_solve(img2); v2e=v2.meas; v2all=v2.volt; %Electrode voltages and difference for linear, quadratic and cubic subplot(211); plot([v1e,v2e,[v2e-v0e]*1]); legend('1','2','(2-0) x 10','Location','NorthEast') xlim([1,100]); print_convert forward_solvers_3d_high_order03a.png Figure: The electrode voltages for linear and quadratic approximation. The linear approximation agrees with the high order approximations away from the drive electrodes, but gets worse as we move toward the drive electrodes. %Difference between quadratic and linear approximation internal voltage img12n=img1n; img12n.node_data=v2all(1:size(fmdl.nodes,1),1)-v1all(1:size(fmdl.nodes,1),1); subplot(121); show_slices(img1n,[inf,inf,2.5]); eidors_colourbar(img1n); %Plot the difference subplot(122); show_slices(img12n,[inf,inf,2.5]); eidors_colourbar(img12n); print_convert forward_solvers_3d_high_order04a.png Figure: Images of the linear (left) and the difference between linear and quadratic approximation (right) on the internal voltage distribution. Iterate over model options (including solver and Jacobian)imdl = mk_common_model('b3cr',16); img = mk_image(imdl.fwd_model,1); vv=fwd_solve(img); v0e=vv.meas; JJ=calc_jacobian(img); J04=JJ(4,:)'; %High-order EIDORS solver %Change default eidors solvers img.fwd_model.solve = @fwd_solve_higher_order; img.fwd_model.system_mat = @system_mat_higher_order; img.fwd_model.jacobian = @jacobian_adjoint_higher_order; vve=[]; JJ4=[]; for i= 1:2; switch i; case 1; img.fwd_model.approx_type = 'tet4'; % linear case 2; img.fwd_model.approx_type = 'tet10'; % quadratic end %switch vv=fwd_solve(img); vve(:,i)=vv.meas; JJ=calc_jacobian(img); JJ4(:,i)=JJ(4,:)'; end subplot(311); plot([v0e,vve,(v0e*[1,1]-vve)*10]); legend('Default','linear','quadratic','(1-0)x10','(2-0)x10'); xlim([1,100]); imgJJ=img; imgJJ.elem_data = JJ4; imgJJ.show_slices.img_cols = 2; level = [inf,inf,0.3]; subplot(312); show_slices(imgJJ,level); eidors_colourbar(imgJJ); imgJJ.elem_data = JJ4 - J04*[1,1]; subplot(313); show_slices(imgJJ,level); eidors_colourbar(imgJJ); print_convert forward_solvers_3d_high_order05a.png Figure: (top) plot of foward solutions and the differences between FEM orders (middle) a slice of the Jacobian for different FEM orders (bottom) difference between Jacobian values for different FEM orders |
Last Modified: $Date: 2017-04-28 12:59:54 -0400 (Fri, 28 Apr 2017) $ by $Author: michaelcrabb30 $