solving the 3d steady radiative transfer equation with freefem++ …+days/2015/pdf/lehardy.pdf ·...

25
Solving the 3D steady Radiative Transfer Equation with FreeFem++ D. Le Hardy , Y. Favennec, B. Rousseau 16 th December 2015 C´ e f o p Ram D. Le Hardy , Y. Favennec, B. Rousseau FreeFem 16 th December 2015 1 / 21

Upload: dangdung

Post on 14-Sep-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Solving the 3D steady Radiative Transfer Equation withFreeFem++

D. Le Hardy, Y. Favennec, B. Rousseau

16th December 2015

CefopRam1

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 1 / 21

Forward Model and Weak Formulation

Plan

1 Forward Model and Weak Formulation

2 Iterative Method and Parallelization Strategy

3 Validation

4 Conclusion

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 2 / 21

Forward Model and Weak Formulation

Radiative Transfer Equation

s · ∇L(x, s)︸ ︷︷ ︸+ (κ+ σs)L(x, s)︸ ︷︷ ︸ = σs

∫4π

Φ(s′ → s)L(x, s′) ds′︸ ︷︷ ︸+ κLb(x, T )︸ ︷︷ ︸Transport

Loss by absorbtion

and scatteringGain by scattering Emission

L(x, s)

σsΦ(s′ → s)L(x, s′)

L(x + ∆x, s)

σsL(x, s)

κL(x, s)

κLb(x, T )

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 3 / 21

Forward Model and Weak Formulation

Boundary Conditions

L(x, s) = L(x, s)︸ ︷︷ ︸ +(1− α) ρ(s · n)L(x, ζ(s))︸ ︷︷ ︸ +α1− επ

∫s′·n>0

L(x, s′)s′ · n ds′︸ ︷︷ ︸Entering

Radiance

Specular

Reflection

Diffuse

Reflection

L(x, s) L(x, ζ(s))

L(x, s′)

n2n1

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 4 / 21

Forward Model and Weak Formulation

Discrete Ordinate Method

Angular Discretization

z

y

x

•sm

Ωm

1

(SDSm) : (sm · ∇+ κ+ σs)L(x, sm)− σsNd∑j=1

ωjL(x, sj)Φm,j = κLb(T )

with ωm = mes Ωm

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 5 / 21

Forward Model and Weak Formulation

Discrete Boundary Conditions

Ωj Ω′j(n) Ωj

Ω′j(n)

1

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 6 / 21

Forward Model and Weak Formulation

Discrete Boundary Conditions

z

y

x

1z

y

x

1

Lm(x) = Lm + δm,m(n)Lm +∑j 6=m

δm,j(n)Lj

for sm · n < 0D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 7 / 21

Forward Model and Weak Formulation

Weak Formulation of (SDSm) by the SUP-G finite elementmethods

∫D

(sm · ∇Lm) (sm · ∇v) dx−∫Dβm(sm · ∇Lm)v dx

+∫∂Dm+

βmLmv(sm · n) dΓ +∫∂Dm−

βmδm,m(n)Lmv(sm · n) dΓ

−∑j 6=m

[ωjΦm,j

∫DσsLj(sm · ∇v) dx +

∫∂Dm−

βmδm,j(n)Ljv(sm · n) dΓ

]

= −∫∂Dm−

βmLmv(sm · n) dΓ +∫DκLb(sm · ∇v) dx

∀m = 1, · · · , Nd

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 8 / 21

Forward Model and Weak Formulation

Size Problem (Nd ×Ndof)2

Nd∑m=1

am,m(Lm, v) +∑j 6=m

am,j(Lj , v)

=

Nd∑m=1

lm(v)

⇓ ⇓ ⇓Am,m Am,j bm

A =

· · ·Am,m

Am,j j < m

Am,j j > m

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 9 / 21

Iterative Method and Parallelization Strategy

Plan

1 Forward Model and Weak Formulation

2 Iterative Method and Parallelization Strategy

3 Validation

4 Conclusion

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 10 / 21

Iterative Method and Parallelization Strategy

Gauss-Siedel iterative method

Nd∑m=1

am,m(LN+1m , v) +

∑j<m

am,j(LN+1j , v) +

∑j>m

am,j(LNj , v)

=

Nd∑m=1

lm(v)

Am,m

Am,j j < m

...

LN+11

LN+1Nd

=

−Am,j j > m

...

LN1

LNNd

+ ...

b1

bNd

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 11 / 21

Iterative Method and Parallelization Strategy

Parallelization

mth line →

·· ·Am,m

Am,j j < m

Am,j j > m

· · · · · ·

Proc 0 Proc n− 1Build the linear part

combined with bm

Proc 0 Proc n− 1”Inverse” the Am,m

matrix with MUMPS

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 12 / 21

Iterative Method and Parallelization Strategy

Parallelization

mth line →

·· ·Am,m

Am,j j < m

Am,j j > m

· · · · · ·

Proc 0 Proc n− 1Build the linear part

combined with bm

Proc 0 Proc n− 1”Inverse” the Am,m

matrix with MUMPS

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 12 / 21

Iterative Method and Parallelization Strategy

Building matrices Am,m in FreeFem++

v a r f b i l 1 ( L , v)=i n t 3 d (Mh) ( ( s1 ∗dx ( L)+s2 ∗dy ( L)+s3 ∗dz ( L ) )∗( s1 ∗dx ( v)+s2 ∗dy ( v)+s3 ∗dz ( v ) )−(kap+s i g ∗(1−Pp ) )∗ ( s1 ∗dx ( L)+s2 ∗dy ( L)+s3 ∗dz ( L ) )∗ v)+i n t 2 d (Mh) (( kap+s i g ∗(1−Pp ) )∗L∗vh ∗( s1 ∗N. x+s2 ∗N. y+s3 ∗N. z )∗( s1 ∗N. x+s2 ∗N. y+s3 ∗N. z>=−10.ˆ−10))+i n t 2 d (Mh, g1 ) (( kap+s i g ∗(1−Pp ) )∗ F1 (Np ,N. x ,N. y ,N. z , Np)∗L∗v)+i n t 2 d (Mh, g2 ) (( kap+s i g ∗(1−Pp ) )∗ F2 (Np ,N. x ,N. y ,N. z , Np)∗L∗v) ;

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 13 / 21

Iterative Method and Parallelization Strategy

Building ”matrices” −Am,j in FreeFem++

v a r f b i l 2 ( L , v)=− i n t 3 d (Mh0) (

−s i g ∗Ps ∗( s1 ∗dx ( v)+s2 ∗dy ( v)+s3 ∗dz ( v ) )∗ Ln)− i n t 2 d (Mh0 , g1 ) (

+(kap+s i g ∗(1−Pp ) )∗ F1 (Np ,N. x ,N. y ,N. z , Ns )∗Ln∗v)− i n t 2 d (Mh0 , g2 ) (

+(kap+s i g ∗(1−Pp ) )∗ F2 (Np ,N. x ,N. y ,N. z , Ns )∗Ln∗v);

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 14 / 21

Iterative Method and Parallelization Strategy

Building ”matrices” −Am,j in FreeFem++

v a r f b i l 2 ( L , v)=− i n t 3 d (Mh0) (

−s i g ∗Ps ∗( s1 ∗dx ( v)+s2 ∗dy ( v)+s3 ∗dz ( v ) )∗ Ln)− i n t 2 d (Mh0 , g1 ) (

+(kap+s i g ∗(1−Pp ) )∗ F1 (Np ,N. x ,N. y ,N. z , Ns )∗Ln∗v)− i n t 2 d (Mh0 , g2 ) (

+(kap+s i g ∗(1−Pp ) )∗ F2 (Np ,N. x ,N. y ,N. z , Ns )∗Ln∗v);

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 14 / 21

Iterative Method and Parallelization Strategy

F2 function

f u n c r e a l F2 ( i n t Np , r e a l Nx , r e a l Ny , r e a l Nz , i n t Ns )

i n t NumNorm ;f o r ( i n t iNorm =0; iNorm<NbNormal ; iNorm++)

i f ( abs (Nx−norm ( iNorm ,0))<10.ˆ−5&& abs (Ny−norm ( iNorm ,1))<10.ˆ−5&& abs ( Nz−norm ( iNorm ,2))<10.ˆ−5)

NumNorm=iNorm ;break ;

return D e l t a 2 (NumNorm∗Nd+Ns , Np ) ;

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 15 / 21

Iterative Method and Parallelization Strategy

CPU time

761 vertices

3088 tetrahedrons

980 triangles

4183 numElements

P1 basis

48 directions

8 proc

With F1/F2 Without F1/F2

CPU/iteration ' 800s ' 50s

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 16 / 21

Validation

Plan

1 Forward Model and Weak Formulation

2 Iterative Method and Parallelization Strategy

3 Validation

4 Conclusion

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 17 / 21

Validation

2D and 3D code

2D : Discontinuous Galerkin (DG) and SUP-G3D : SUP-G

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 18 / 21

Validation

Analytical Validation

L(x) = arctan(πx) cos(2πx) + 3

κLb = s · ∇L(x) + κL(x)

G(x) =

∫4πL(x, s) dΩ(s) = 4πL(x)

κ = 0.5cm−1, σs = 1cm−1, g = 0.8

20

25

30

35

40

45

50

55

-1 -0.5 0 0.5 1

y

x

G(x) = 4πL(x)

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 19 / 21

Validation

Analytical Validation

L(x) = arctan(πx) cos(2πx) + 3

κLb = s · ∇L(x) + κL(x)

G(x) =

∫4πL(x, s) dΩ(s) = 4πL(x)

κ = 0.5cm−1, σs = 1cm−1, g = 0.8

0.0001

0.001

0.01

0.1

1

10

100

0.1 1 10

||Gex−G

num|| L

2(D

)

h

P1

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 19 / 21

Validation

Analytical Validation

L(x) = arctan(πx) cos(2πx) + 3

κLb = s · ∇L(x) + κL(x)

G(x) =

∫4πL(x, s) dΩ(s) = 4πL(x)

κ = 0.5cm−1, σs = 1cm−1, g = 0.8

0.0001

0.001

0.01

0.1

1

10

100

0.1 1 10

||Gex−G

num|| L

2(D

)

h

P1P2

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 19 / 21

Validation

Refracted pulse function on the π4 direction

κ = 0.1cm−1

σs = 0.5cm−1

g = 0

n2 = 1.4

1 000 000 photons

Tnh/Rnh FEM EMC(X) σMC(X)

Reflectance 1.34× 10−1 1.33× 10−1 6.66× 10−4

Transmittance 1.12× 10−1 1.08× 10−1 6.10× 10−4

Lateral transmittance 1 7.64× 10−2 7.55× 10−2 5.18× 10−4

Lateral transmittance 2 7.64× 10−2 7.50× 10−2 5.16× 10−4

Lateral transmittance 3 3.47× 10−1 3.26× 10−1 9.19× 10−4

Lateral transmittance 4 7.29× 10−2 6.97× 10−2 4.99× 10−4

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 20 / 21

Conclusion

Conclusion

Solving the RTE with specularreflection on the boundary with DG in2D and with SUP-G in 2D and 3D

Parallelization stategy to use the code on alaptop

Forward : Find a alternative toreplace the F2 functions (P0

function, emptymesh, labels, · · · )

D. Le Hardy, Y. Favennec, B. Rousseau FreeFem 16th December 2015 21 / 21