<<

Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

HyEIT : Iterative Reconstruction Methods in MATLAB for Hybrid Inverse Problems in Electrical Impedance 1

A.D. Garnadi23a,b, Mokhamad Fakhrul Ulum4d, Deddy Kurniadi51, Utriweni Mukhaiyar6f, Lina Choridah7c, Nurhuda Hendra Setyawan8c, Khusnul Ain9g

aInstitute for Globally Distributed Open Research and Education bIPB University, Indonesia cFaculty of Medicine, Public Health, and Nursing Universitas Gadjah Mada, Yogyakarta, Indonesia dFaculty of Veterinary Medicine, IPB University, Indonesia eInstrumentation and Control Research Division, Faculty of Industrial Technology, Institut Teknologi Bandung, Indonesia fStatistics Research Division, Faculty of Mathematics and Natural Sciences, Institut Teknologi Bandung, Indonesia gFaculty of Sciences and Technology, Airlangga University, Surabaya, Indonesia

Abstract We present a MATLAB-based, open source reconstruction software for Hybrid Imaging problem arising from Current Density Impedance Imaging (CDII) and Acoustic-Electrical Impedance Tomography (AEIT), utilizing mixed finite element method solver of Darcy toolbox DarcyLite . For a formulation of hybrid inverse problems in impedance tomography the successive substitution iterative schemes are adapted and an reconstruc- tion is developed. The problem formulation is a class of hybrid

1Funded by ”Riset Kolaborasi Indonesia 2019”,”Pengembangan Tomografi Elektrik Se- bagai ’Contrasting Agent’ Magnetic Resonance Imaging” AND by ”Riset Kolaborasi In- donesia 2020”, ’Pengembangan Tomografi Hibrida : Electrical Impedance Tomography + Ultrasonography Dalam Bidang Biomedika’ 2e-mail address:[email protected] 3home address: Gg Bungur IV 107, Perumahan Cijerah II, Melong, Cimahi Selatan, Indonesia 40534 4e-mail address: [email protected]; OrcID: http://orcid.org/0000-0003-2092-9645 5e-mail address: [email protected] 6e-mail address:[email protected] 7e-mail address: [email protected] 8e-mail address: [email protected] 9e-mail address: k [email protected]

Preprint submitted to SoftwareX February 6, 2021

© 2021 by the author(s). Distributed under a Creative Commons CC BY license. Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

imaging modality which is current density impedance imaging or Acoustic- Electrical Impedance Tomography. The proposed algorithm is implemented numerically in two dimensions.

Keywords: Hybrid inverse problems, Iterative reconstruction methods, Impedance tomography, Current density impedance imaging, Magnetic resonance imaging, electrical impedance tomography, Ultrasound modulated electrical impedance tomography

Required Metadata Current code version Ancillary data table required for subversion of the codebase. Kindly re- place examples in right column with the correct information about your cur- rent code, and leave the left column as it is.

Nr. Code metadata description Please fill in this column C1 Current code version Version 0.0 C2 Permanent link to code/repository NA used for this code version C3 Code Ocean compute capsule C4 Legal Code License CC-BY NC 4.0 International C5 Code versioning system used For example svn, git, mercurial, etc. put none if none C6 Compilation requirements, operat- MATLAB/GNU OCTAVE for the ing future C7 Compilation requirements, operat- DarcyLite ing environments & dependencies http://www.math.colostate.edu/ li- u/DarcyLite.zip C8 If available Link to developer docu- NA mentation/manual C9 Support email for questions agah.garnadi[at]gmail.com

Table 1: Code metadata (mandatory)

1 The permanent link to code/repository or the zip archive should include

2 the following requirements:

3 README.txt and LICENSE.txt.

4 Source code in a src/ directory, not the root of the repository.

5 Tag corresponding with the version of the software that is reviewed.

2 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

6 Documentation in the repository in a docs/ directory, and/or READMEs,

7 as appropriate.

8 1. Motivation and significance

9 In this note we develop and analyse an iterative reconstruction method

10 for the following hybrid :

11

12 Reconstruct the scalar function σ from measurements of the form

A = σ|∇u|p in Ω, p = 1, 2 (1)

13 where u is the solution to the linear PDE problem

∇(−σ∇u) = 0 in Ω,  (2) u|∂Ω = uD,

n 14 Here Ω is a smooth open bounded domain in R , n ∈ {2, 3}, and σ is

15 bounded from above and from below by positive constants in Ω. We will

16 henceforth assume that |∇u| is uniformly bounded from below by a positive

17 constant in Ω. The problem formulation and the reconstruction methods are

18 independent of the spatial dimension, here we only works on n = 2, for pro-

19 totyping. This inverse problem can be identified as a hybrid inverse problem

20 or, equivalently, as a coupled-physics inverse problem, since it models an

21 imaging modality utilizing coupled different physical phenomena.

22 The functions (1) model measurements from a couple of hybrid inverse

23 problems of Electrical Impedance Tomography, i.e.

24 1. In the case p = 1, the functions (1) model measurements of the internal

25 electrical current density and the tomographic method is known as

26 Current Density Impedance Imaging (CDII); the same model appears

27 in certain formulations of Magnetic Resonance Electrical Impedance

28 Tomography (MREIT). [12], [13],[14]

29 2. While for p = 2, coming from AEIT (Acoustics Induce Electric Impedance

30 Tomography). [15], [16] [17], [18]

31 The only package we are aware of with fully fledged capabilities was [21],

32 implemented in PDE suite FENICS, written in C++.

33 2. Software description

34 In this section we derive an iterative reconstruction for the pre-

35 sented inverse problem. It is common feature of all the presented algorithms,

3 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

36 that they are based on a transformation of a non-linear problem into a series

37 of linear problems for which the corresponding solutions, under appropriate

38 conditions, converge to a solution to the original non-linear problem. In this

39 section, we explain how to use the successive iterative scheme to reformulate

40 the inverse problem, develop a general iterative reconstruction algorithm and

41 implement it numerically.

42 A way to reformulate (1)-(2) is to recast the set of generalized Laplace

43 problems (2) as non-linear PDE problems. The unknown function σ can be

44 eliminated from the PDEs using the internal measurements, since A σ = , p = 1, 2. |∇u|p

45 This gives the non-linear PDE problems

∇ − A ∇u = 0 in Ω, p = 1, 2,  |∇u|p (3) u|∂Ω = uD,

46 In this setting a procedure for solving the inverse problem would be to

47 first solve the non-linear problems for u and then determine σ by (1). One of

48 the simplest approaches to approximate solutions to such a non-linear PDE

49 problem is to use a fixed-point iteration or successive iterative scheme, also

50 known as the method of successive substitutions [4]. The idea behind the

51 successive substitution scheme is basically to make an initial guess on the

52 non-linear coefficient in the PDE problems (3); then the now linear PDE

53 problem is solved, and we get an approximation of u which is used to up- 54 date the estimate of the coefficient. Let the initial guess be denoted by σ0. 55 Throughout this paper, we use a superscript to denote the iteration num-

56 ber. The successive substitution scheme, applied to (3), generates a series of

57 solving linear problems of the type

∇(−σk∇uk) = 0 in Ω, k = 0; 1; ...;  k (4) u |∂Ω = uD, k k+1 58 which are solved successively for (u ). The coefficient σ is defined by

59 the relation A σk+1 = |∇uk|p

60 It is important to notice that the transformation of the non-linear problem

61 into a series of linear problems is not a result of any algebraic or symbolic

62 manipulations; it simply a consequence of a substitution made directly in the

63 non-linear PDE. The choice of stopping criteria for the successive iterations

64 depends on the application. For problems like ours, where the objective is

4 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

65 to estimate the PDE coefficient σ, and not to the functions u, it is natural k+1 k 66 to choose a stopping criteria based on the tolerance kσ − σ k in some

67 suitable function space and the iteration number k.

68 The performance of the successive substitution relies on an initial guess

69 that provides a sufficiently good starting point, such that the successive ap-

70 proximation of the nonlinear coefficients is improved in each iteration. The

71 convergence properties of the successive substitution scheme can be studied

72 using contraction maps and the application of the Banach fixed point theo-

73 rem, however the practicality of applying this theory on a general non-linear

74 PDE problem seems rather limited [4]. Nonetheless, for our case, the con-

75 vergence properties of the successive substitution have been analysed [2, 6].

76 The successive substitution scheme was the main idea behind one of the

77 first reconstruction algorithms for the hybrid inverse problems expressed in

78 the form of the non-linear PDE problems given by (3). The resulting al-

79 gorithm was denoted the J-substitution algorithm, due to the fact that the

80 functions A models measurements of the magnitude of the current density

81 vector field, often denoted by A [3]. Note that the original formulation of

82 the J-substitution algorithm considered the corresponding Neumann prob-

83 lem. A similar implementation of the Dirichlet problem for a single internal

84 measurement has also been used to solve the equivalent inverse problem from

85 CDII [5, 6].

86 2.1. Software Architecture

87 The successive iterative scheme can be applied directly to the non-linear

88 PDE formulation of the inverse problem to produce the following algorithm:

89 - Algorithm. Successive algorithm

0 90 • Define σ , maximum number of iteration K and tolerance level T.

91 • Set k = 0 and ε = 2T.

92 • while k < K and ε > T do k k 93 1. Solve for (u , p ) in

pk − σk∇uk = 0 in Ω ∇ · pk = 0 in Ω k u = uD on ∂Ω,

94 2. update A σk+1 = |pk/σk|p

5 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

k+1 k 95 3. Set ε = |σ − σ | and k = +1

96 • end while

k 97 We assume that σ is uniformly bounded above and below in Ω for all k, k 98 such that the PDE problems for u are all well-posed.

99 2.2. Software Functionalities

100 The successive substitution Algorithm is fairly simple to implement, since

101 each iteration only involves some arithmetic operations on known functions

102 and the solution of a linear PDE problem. k k 103 For σ , we want to solve for ∇u in

∇(−σk∇uk) = 0 in Ω, k (5) u = uD, on ∂Ω,

104 We use a mixed formulation, such that we get a problem for the gradient k 105 ∇u , which is crucial for the reconstruction algorithm. In this way, we do not k 106 need to numerically differentiate u , which can introduce additional errors.

−σk∇uk + pk = 0 in Ω, ∇ · pk = 0 in Ω, (6) k u = uD, on ∂Ω,

107 We fully utilize DarcyLite [10], which provide solver for equation 6 in MAT-

108 LAB using Mixed Finite Element Method.

109 3. Illustrative Examples

110 We illustrate an example to test the implementation for p = 1, i.e. Cur-

111 rent Density Impedance Imaging, the case for p = 2, can be implemented

112 by modification a view lines within the main MATLAB script given below.

113 Here, we consider the reconstruction of a piece-wise constant conductivity

114 [11],

 1.0, 0 < x < 0.5, 0 < y < 1 σ = 1.4, 0.5 < x < 0, 0 < y < 1

2 115 For simplicity, the exact uσ in Ω = [0, 1] is set to be

uσ = cos(x − 0.5) ∗ exp(y).

116 The forward problem is sought successively iterated on a uniform trian-

117 gulation of the domain Ω = [0, 1] × [0, 1].

6 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

Figure 1: Domain Triangulation

Figure 2: Exact Conductivity is on the left column, while on the right column shows the approximate conductivity after the iteration satisfied the given tolerance with rate convergence given in table 2. In the middle column, given the current density as artificial measurement data.

118 4. Impact

119 Despite the clear relevance of Hybrid inverse in multiple research facets,

120 to the best of our knowledge, there are no open-source for Hybrid inverse

121 packages available. To that end, HyEIT is developed using a MATLAB -

122 based platform to solve the non-linear hybrid inverse problem.

k’th-iterates kσk+1−σkk2 kσk+1−σkk2 kσk+1k2 kσexactk2

1 0.718569590056506 0.718569590056506 2 5.31152248204223e-16 5.31152248204223e-16 Table 2: Stopping error value criteria at each iterate

7 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

123 Due to the rapid advances with the field of Hybrid Inerse over the recent

124 years by numerous researchers (for example, [22],[23] [24], [25]), we decided

125 to initiate releasing the package HyEIT as an open-source communal project,

126 which will allow users to continually improve HyEIT.

127 Potential near - term advances improving the applicability and perfor-

128 mance of HyEIT over the coming years may include

129 (i) additional prior models, for example Bounded Variation [19], which is 130 easily tested using Weak-Galerkin Element in DarcyLite as [20] studied 131 for Electrical Impedance Tomography, and pointed out some estimates

132 in Boundary Variation.

133 (ii) estimation of unknown boundaries and Uncertainty Quantification on

134 boundary values,

135 (iii) nonGaussian noise models, and

136 (iv) different optimization approaches, such as full Newton, quasi - Gauss,

137 gradient descent, primal dual interior point methods, and more[21].

138 Moreover, we look forward to extending the 2D HyEIT to a 3D version.

139 5. Conclusions

140 In this Note, we presented the MATLAB-based Hybrid Electrical Impedance

141 Tomography Imaging (HyEIT) open-source package. The present version of

142 the packages only provide a basic successive iterations solver by users, but

143 open to the developer to adds-on for HyEIT problems with different prior

144 models, constraints, optimization parameters, geometries, boundary condi-

145 tions, and more. In the future, we hope to engage other researchers to further

146 develop and improve the capabilities of HyEIT for a large suite of potential

147 applications.

148 6. Conflict of Interest

149 No conflict of interest exists: We wish to confirm that there are no known

150 conflicts of interest associated with this publication and there has been no

151 significant financial support for this work that could have influenced its out-

152 come.

8 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

153 Acknowledgements

154 The lead author, would like to thank the Department of Mathematics,

155 Institut Pertanian Bogor, who give exempt of teaching duties enjoying the

156 pleasure of research.

157 References

158 [1] Garnadi, A.D. and Bahriawati, C., 2020. A mixed RT0 − P0 Raviart- 159 Thomas finite element implementation of Darcy Equation in GNU Oc-

160 tave. https://doi.org/10.31223/osf.io/wjeq8

161 [2] Kim, Y. J., Kwon, O., Seo, J. K., & Woo, E. J. (2003). Uniqueness and

162 convergence of conductivity image reconstruction in magnetic resonance

163 electrical impedance tomography. 19(5), 1213–1225. doi:10.1088/0266-

164 5611/19/5/312.

165 [3] Kwon, O., Woo, E. J., Yoon, J.-R., & Seo, J. K. (2002). Magnetic reso-

166 nance electrical impedance tomography (MREIT): Simulation study of

167 Jsubstitution algorithm. IEEE Transactions on Biomedical Engineering,

168 49(2), 160–167. doi:10.1109/10.979355.

169 [4] Langtangen, H. P. (2003). Computational partial differential equa-

170 tions: Numerical methods and diffpack programming. Texts in com-

171 putational science and engineering. Berlin, Heidelberg: Springer. ISBN:

172 9783540434160.

173 [5] Nachman, A., Tamasan, A., & Timonov, A. (2011). Current den-

174 sity impedance imaging. Tomography and Inverse Transport Theory.

175 doi:10.1090/conm/559/11076.

176 [6] Nachman, A., Tamasan, A., & Timonov, A. (2009). Recovering the con-

177 ductivity from a single measurement of interior data. Inverse Problems,

178 25(3), 035014. doi:10.1088/0266-5611/25/3/035014.

179 [7] Bahriawati, C.& Carstensen, C.,(2005), Three MATLAB implementa-

180 tions of the lowest-order Raviart-Thomas MFEM with a posteriori er-

181 ror control, Computational Methods in Applied Mathematics Comput.

182 Methods Appl. Math., 5,4,333–361,De Gruyter

183 [8] Adler A., Lionheart W.R.,(2006), Uses and abuses of EIDORS: an ex-

184 tensible software base for EIT Physiological Measurement, 27 (5) , p.

185 S25

9 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

186 [9] Hoffmann, Kristoffer and Knudsen, Kim, Iterative reconstruction meth-

187 ods for hybrid inverse problems in impedance tomography, Sensing and

188 Imaging, 15(1), 96, 2014, Springer

189 [10] Liu, Jiangguo and Sadre-Marandi, Farrah and Wang, Zhuoran, Dar-

190 cyLite: A Matlab toolbox for Darcy flow computation, Procedia Com-

191 puter Science, 80, 1301–1312, 2016, Elsevier

192 [11] Faouzi Triki and Tao Yin., 2020,Inverse conductivity equation with in- 193 ternal data,arXiv, eprint= 2003.13638

194 [12] Bal, G., 2012, Hybrid inverse problems and internal functionals, Inverse

195 Problems and Applications: Inside Out Vol - II

196 [13] Kuchment, P. (2012). Mathematics of hybrid imaging: A brief review.

197 In: Springer Proceedings in Mathematics, 183–208. doi:10.1007/978-88-

198 470-1947-812.

199 [14] Widlak, T., & Scherzer, O. (2012). Hybrid tomography for conduc-

200 tivity imaging. Inverse Problems, 28(8), 084008. doi:10.1088/0266-

201 5611/28/8/084008.

202 [15] Ammari, H., Bonnetier, E., Capdeboscq, Y., Tanter, M., & Fink,

203 M. (2008). Electrical impedance tomography by elastic deforma-

204 tion, SIAM Journal on Applied Mathematics, 68(6), 1557–1573.

205 doi:10.1137/070686408.

206 [16] Capdeboscq, Y., Fehrenbach, J., de Gournay, F., & Kavian, O. (2009).

207 Imaging by modification: Numerical reconstruction of local conductivi-

208 ties from corresponding power density measurements, SIAM Journal on

209 Imaging Sciences, 2(4), 1003–1030, doi:10.1137/080723521.

210 [17] Gebauer, B., & Scherzer, O. (2008). Impedance-acoustic tomog-

211 raphy. SIAM Journal on Applied Mathematics, 69(2), 565–576.

212 doi:10.1137/080715123.

213 [18] Kuchment, P., & Kunyansky, L., 2011, 2D and 3D reconstruc-

214 tions in acousto-electric tomography, Inverse Problems, 27(5), 055013.

215 doi:10.1088/0266-5611/27/5/055013.

216 [19] Charalambopoulos, Antonios and Markaki, Vanessa and Kourounis,

217 Drosos, The inverse conductivity problem via the calculus of functions

218 of bounded variation, Mathematical Methods in the Applied Sciences,

219 43,8,5032–5072, 2020

10 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

220 [20] Liang, Ying and Zou, Jun, Weak Galerkin Method for Electrical

221 Impedance Tomography,arXiv preprint arXiv:2011.04991, 2020

222 [21] Hoffmann, Kristoffer and Knudsen, Kim, Iterative reconstruction meth-

223 ods for hybrid inverse problems in impedance tomography, Sensing and

224 Imaging, 15,1,96,2014

225 [22] Hubmer, Simon and Knudsen, Kim and Li, Changyou and Sherina, Eka-

226 terina, Limited-angle acousto-electrical tomography, Inverse Problems in

227 Science and Engineering, 27, 9, 1298–1317, 2019

228 [23] Adesokan, Bolaji James and Jensen, Bjørn and Jin, Bangti and Knud-

229 sen, Kim, Acousto-electric tomography with total variation regulariza-

230 tion, Inverse Problems, 35, 3, 035008, 2019

231 [24] Li, Changyou and An, Kang and Zheng, Kuisong and Lesselier, Do-

232 minique, A complete framework for acousto-electric tomography with

233 numerical examples, IEEE Access, 2020

234 [25] Li, Changyou and An, Kang and Zheng, Kuisong, The Levenberg–

235 Marquardt Method for Acousto-Electric Tomography on Different Con-

236 ductivity Contrast, Applied Sciences, 10, 10, 3482, 2020

237 Current executable software

238 Main MATLAB Script

2391 %% 2402 %% run HyEIT CDII MFEM v0 2413 %% 2424 %% ... 243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ... 244 %% 2455 %% Algorithm1 Successive Iteration algorithm ... 246 %% 2476 %% Define: \sigmaˆ0,%% 2487 %% maximum number of iterationK and ... 249 %% 2508 %% tolerance levelT. ... 251 %% 2529 %% Setk=0 and \varepsilon=2T. ... 253 %% 25410 %% whilek < K and \varepsilon > T do ... 255 %%

11 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

25611 %%1 ... 257 ... 258 %% 25912 %%2 Solve foruˆk in ... 260 %% 26113 %%3 \nabla (− \sigmaˆk nablauˆk)=0 in \Omega ... 262 %% 26314 %%4u=u D on \partial \Omega, ... 264 %% 26515 %%5 update ... 266 %% 26716 %%6 \sigmaˆ{k+1} =a/ |\nablauˆk | ... 268 %% 26917 %%7 Set \varepsilon= | \ sigmaˆ{k+1} − \sigmaˆk | andk ... 270 =+1%% 27118 %% end while ... 272 %% 27319 %% ... 274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ... 275 %% 27620 %% 27721 %% Modified from: 27822 %% run Darcy MFEM TriRT0P0.m 27923 % Assuming CondKs is an elementwise constant scalar 28024 % James Liu, ColoState; 2012/07−−2017/02 28125 % DarcyLite 28226 % 28327 % Modified by A.D. Garnadi, Institut Pertanian Bogor; ... 284 2019/03−2020/12 28528 % For Riset Kolaborasi Indonesia− 2019/2020 28629 % Hybrid Imaging: EIT+MRI and USG+EIT 28730 % 28831 % Conductivity := CondKs 28932 % 29033 % 29134 % clc; 29235 clear all; close all; 29336 format compact; format short e; 29437 29538 %% Setting up the problem 29639 xa = 0; xb = 1; yc = 0; yd = 1; 29740 BndryDescMat = [xa,yc,xb,yc, 0,−1;... 29841 xb,yc,xb,yd, 1, 0;... 29942 xb,yd,xa,yd, 0, 1;... 30043 xa,yd,xa,yc,−1, 0]; 30144 % Setting up the Darcy equation& boundary conditions on ... 302 four sides: 30345 %1 for Dirichlet,2 for Neumann,0 for coding convenience ... 304 in Matlab

12 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

30546 BndryCondType = [0;1;1;1;1];% Dirichlet Data 30647 % EqnBC= EqnBC Poisson Ex00Linear;% Case0 30748 EqnBC = EqnBC Poisson ExactTrikiYin;% Case1 30849 % EqnBC= EqnBC Poisson KelloggIntfc;% Case2 30950 %% Domain for case2: [−1,1]x[−1,1] 31051 % 31152 % 31253 % BndryCondType= [0;1;1;1;1]; 31354 31455 % 31556 31657 %% Discretization: Mesh generation and preparation 31758 % Modified later to accept the size of an image, 31859 k powerExperiment = [0:4];% Experiment index 31960 k power = k powerExperiment(3) 32061 n = 2ˆk power 32162 % 32263 nx = n; ny = n; 32364 TriMesh = RectDom TriMesh GenUnfm(xa,xb,nx,yc,yd,ny,2); 32465 TriMesh = TriMesh Enrich2(TriMesh,BndryDescMat); 32566 TriMesh = TriMesh Enrich3(TriMesh,BndryDescMat); 32667 32768 %% Setting up quadratures 32869 GAUSSQUAD = SetGaussQuad(5,25,13); 32970 33071 %% Sampling the conductivity/permeability(asa scalar) 33172 fxnKs = EqnBC.fxnKs ; 33273 CondKs = Darcy SmplnPermSca TriMesh(fxnKs, TriMesh, GAUSSQUAD); 33374 33475 %% Sorting out boundary edges: Dirichlet, Neumann 33576 DirichletEdge = find(BndryCondType(TriMesh.BndryEdge+1)==1); 33677 NeumannEdge = find(BndryCondType(TriMesh.BndryEdge+1)==2); 33778 %% 33879 show TriMesh(TriMesh,25) 33980 %% TriMesh: Show the mesh ina specified figure window 34081 % 34182 % show TriMesh labels(TriMesh,26,1,1,1) 34283 %show TriMesh labels(TriMesh,fwn,ch0,ch1,ch2) 34384 %% TriMesh: Show node, element, edge labels ina specified ... 344 window 34585 % fwn: figure window number 34686 % ch0: choice for showing node labels (0 or 1) 34787 % ch1: choice for showing edge labels (0 or 1) 34888 % ch2: choice for showing element labels (0 or 1) 34989 % 35090 %% Assembling and solving... 35191 % tic; 35292 [sln,MatA,MatB,GlbRHS] = Darcy MFEM TriRT0P0s AsmSlv(... 35393 EqnBC,TriMesh,CondKs,DirichletEdge,NeumannEdge,GAUSSQUAD);

13 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

35494 % toc 35595 35696 %% Computing numerical ElectricalPotential, velocity, flux, etc. 35797 [NumElPotEm,NumElCurrEmCntr,NumerFlux,LMCR,FluxDscp] = ... 35898 Darcy MFEM TriRT0P0 PresVelFlux(TriMesh,sln,BndryDescMat); 35999 % 360100 % NumElPotEm(i)=p h(i),1 ≤ i ≤ NumEl 361101 % NumElCurrEmCntr(i)=u h(i,[1 2]),1 ≤ i ≤ NumEl 362102 %u h=−K gradp h 363103 % NumerFlux(i,[12 3])=u h(i,[1 2])'(n(i,[1 2])) 364104 % 365105 %% GENERATE SYNTHETIC DATA: 366106 % 367107 % 368108 NumCurrPowerDensity = zeros(size(CondKs)) ; 369109 % 370110 for ix=1:length(NumCurrPowerDensity) 371111 absJix = norm(NumElCurrEmCntr(ix,:),2) ; 372112 %% For CDII, sigma | \ nablau |: 373113 % NumCurrPowerDensity(ix)= absJ; 374114 NumCurrPowerDensity(ix) = absJix; 375115 %% For AEIT, sigma | \ nablau |ˆ2: 376116 % NumCurrPowerDensity(ix)= (1/CondKs(ix)) *absJixˆ2; 377117 end 378118 % NumElPotEm= Elementwise Numerical ElectricalPotential 379119 % NumElCurrEmCntr= Elementwise Numerical Velocity/Current ... 380 (at the centre of Element) 381120 %% Presenting numerical& graphical results 382121 % 383122 show TriMesh ScaVecEm mix(TriMesh, NumCurrPowerDensity, ... 384 NumElCurrEmCntr, ... 385123 23,'MFEM: Current Density(CDII) and Current', 1); 386124 % 387125 %% show TriMesh ScaVecEm mix(TriMesh, NumCurrPowerDensity2, ... 388 NumElCurrEmCntr, ... 389126 %% 24,'MFEM: Current Density(AEIT) and Current', 1); 390127 %% 391128 % DATA for Successive Iteration 392129 % 393130 %% CDII: 394131 % element coordinate NumCurrPowerDensity 395132 %% AEIT: 396133 % element coordinate NumCurrPowerDensity2 397134 % 398135 %% 399136 %% Define: \sigmaˆ0, ... 400 % 401137 Sigmak = ... 402 mean(NumCurrPowerDensity)*ones(size(NumCurrPowerDensity)) ;

14 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

403138 % Sigmak= CondKs; 404139 % 405140 absGradU = zeros(size(NumCurrPowerDensity)) ;% Memory ... 406 allocation 407141 %%maximum number of iterationK 408142 % 409143 Kmax = 10 ; 410144 Norm2OfRatio = zeros(1,10)' ;% Place holder 411145 Norm2OfRatioRel = zeros(1,10)' ;% Place holder 412146 NumGradEmCntr = zeros(size(NumElCurrEmCntr(:,1))) ;% Place ... 413 holder 414147 %% tolerance levelT. ... 415 %% 416148 TolLevel = (max(NumCurrPowerDensity) − ... 417 min(NumCurrPowerDensity))/2 ; 418149 %% Setk=0 and \varepsilon=2T. ... 419 %% 420150 kIteration = 0 ; VarEpsilon = 2*TolLevel ; 421151 %% whilek < K and \varepsilon > T do ... 422 %% 423152 while (kIteration < Kmax) & (VarEpsilon >TolLevel) 424153 %%1 ... 425 ... 426 %% 427154 %%2 Solve foruˆk in ... 428 %% 429155 %%3 \nabla (− \sigmaˆk nablauˆk)=0 in \Omega ... 430 %% 431156 %%4u=u D on \partial \Omega, ... 432 %% 433157 %% Assembling and solving... 434158 % tic; 435159 [sln,MatA,MatB,GlbRHS] = Darcy MFEM TriRT0P0s AsmSlv(... 436160 EqnBC,TriMesh,Sigmak,DirichletEdge,NeumannEdge,GAUSSQUAD); 437161 % toc 438162 %% 439163 %% Computing numerical ElectricalPotential, velocity, flux, etc. 440164 [NumElPotEm,NumElCurrEmCntr,NumerFlux,LMCR,FluxDscp] = ... 441165 Darcy MFEM TriRT0P0 PresVelFlux(TriMesh,sln,BndryDescMat); 442166 % 443167 %%5 update ... 444 %% 445168 %%6 \sigmaˆ{k+1} =a/ |\nablauˆk | ... 446 %% 447169 % absGradU= sqrt(NumerFlux(:,1).ˆ2+ NumerFlux(:,2).ˆ2); 448170 NumGradEmCntr(:,1) = NumElCurrEmCntr(:,1)./Sigmak ; 449171 NumGradEmCntr(:,2) = NumElCurrEmCntr(:,2)./Sigmak ; 450172 absGradU = sqrt(NumGradEmCntr(:,1).ˆ2 + ... 451 NumGradEmCntr(:,2).ˆ2) ;

15 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

452173 Sigmak1 = NumCurrPowerDensity./absGradU ; 453174 %%7 Set \varepsilon= | \ sigmaˆ{k+1} − \sigmaˆk | andk ... 454 =+1%% 455175 kIteration = kIteration + 1; 456176 %% Computing errors: 457177 %% Compute \Vert Sigmak1− Sigmak \Vert (Lˆ2)/\Vert Sigma ... 458 \Vert (Lˆ2) 459178 %[L2ErrPotential]= ... 460 Darcy MFEM TriRT0P0 Err(EqnBC,TriMesh,sln,GAUSSQUAD); 461179 Norm2OfRatioRel(kIteration) = norm((Sigmak1 − ... 462 Sigmak),2)/norm(Sigmak1,2) ; 463180 Norm2OfRatio(kIteration) = norm((Sigmak1 − ... 464 Sigmak),2)/norm(CondKs,2) ; 465181 % 466182 VarEpsilon = norm((Sigmak1 − Sigmak),1) ; 467183 Sigmak = Sigmak1 ; 468184 %% end while ... 469 %% 470185 end 471186 show TriMesh ScaEm ClrImg(TriMesh,CondKs,24,' Exact ... 472 Conductivity') 473187 show TriMesh ScaEm ClrImg(TriMesh,NumCurrPowerDensity,26,' ... 474 Current Density(CDII)') 475188 show TriMesh ScaEm ClrImg(TriMesh,Sigmak1,27,' Approximate ... 476 Conductivity') 477189 disp('======FINISH======') 478190 return; 479191 %

480 Test Case

4811 function EqnBC = EqnBC Poisson ExactTrikiYin 4822 %% EqnBC: EqnBC Poisson ExactTrikiYin 4833 % Exact Solution of 4844 % 4855 % Inverse conductivity equation with internal data, 4866 % Triki, Faouzi and Yin, Tao, 4877 % arXiv preprint arXiv:2003.13638}, 4888 % 2020 4899 % 49010 % Let$ \Omega 1$ be the unit square [0,1]ˆ2 49111 % Set 49212 %p(x,y)= cos(x−0.5). *exp(y); 49313 % Ks= \sigma=1.0,0

16 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

49717 %f n=u 49818 % Observe, that¬: 49919 %p satisfies \[\nablak \nablap =0, \] 50020 % with Dirichlet data 50121 %g D=p= 50222 % 50323 % 50424 EqnBC = struct('fxnKs',@fxnKs,'fxnK',@fxnK,'fxnf',@fxnf, ... 50525 'fxnpD',@fxnpD,'fxnuN',@fxnuN, ... 50626 'fxnp',@fxnp,'fxnpg',@fxnpg,'fxnu',@fxnu); 50727 50828 % Diffusion coeff. or permeability asa scalar 50929 function Ks = fxnKs(pt) 51030 x = pt(:,1); 51131 y = pt(:,2);% 51232 Ks = ones(size(x) ; 51333 %Ks= \sigma=1.0,0 0.5) ; 51636 Ks(ix) = 1.4 ; 51737 end 51838 51939 % Diffusion coeff. or permeability as2x2 SPD matrix 52040 function K = fxnK(pt) 52141 x = pt(:,1); 52242 NumPts = size(pt,1); 52343 ix = (x => 0.5) ; 52444 K = zeros(NumPts,2,2); 52545 % 52646 K(:,1,1) = 1; 52747 K(:,2,2) = 1; 52848 % 52949 K(ix,1,1) = 1.4; 53050 K(ix,2,2) = 1.4; 53151 end 53252 53353 % The right−hand side function in the Poisson/Darcy equation 53454 function f = fxnf(pt) 53555 x = pt(:,1);%y= pt(:,2); 53656 f = zeros(size(x)) ; 53757 end 53858 53959 % Dirichlet boundary condition 54060 function pD = fxnpD(pt) 54161 %x= pt(:,1);y= pt(:,2); 54262 pD = fxnp(pt); 54363 end 54464 54565 % Neumann boundary condition

17 Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 8 February 2021

54666 % None 54767 54868 % Known exact"pressure" solution 54969 function p = fxnp(pt) 55070 x = pt(:,1); y = pt(:,2); 55171 %u exact= cos(x−0.5) *exp(y) 55272 p = cos(x−0.5).*exp(y); 55373 end 55474 55575 % Known gradient of the exact"pressure" solution 55676 function pg = fxnpg(pt) 55777 x = pt(:,1); y = pt(:,2); 55878 pg = [sin(x−0.5).*exp(y), cos(x−0.5).*exp(y)]; 55979 end 56080 56181 % Known exact solution for"velocity" 56282 function u = fxnu(pt) 56383 x = pt(:,1); y = pt(:,2); 56484 u1 = − sin(x−0.5).*exp(y) ; 56585 u2 = − cos(x−0.5).*exp(y); 56686 u = [u1,u2]; 56787 end 56888 56989 end

18