Tests for thin layers

Scott Prahl

January 2021

version 2

[1]:
import numpy as np
import matplotlib.pyplot as plt
import iadpython

Zero thickness layer

[2]:
s = iadpython.Sample(n=1.5, quad_pts=8)
s.update_quadrature()

r, t = iadpython.zero_layer(s)
s.wrmatrix(r)
s.wrmatrix(t)
cos_theta |  0.05175  0.24597  0.49938  0.69360  0.76791  0.84962  0.94593  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.05175 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.24597 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.49938 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.69360 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.76791 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.84962 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  0.94593 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000
----------+-------------------------------------------------------------------------+---------
  flux    |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  0.00000

cos_theta |  0.05175  0.24597  0.49938  0.69360  0.76791  0.84962  0.94593  1.00000 |     flux
----------+-------------------------------------------------------------------------+---------
  0.05175 | 74.52736  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.24597 |  0.00000  8.36376  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.49938 |  0.00000  0.00000  4.11964  0.00000  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.69360 |  0.00000  0.00000  0.00000  5.56066  0.00000  0.00000  0.00000  0.00000 |  1.00000
  0.76791 |  0.00000  0.00000  0.00000  0.00000 11.59817  0.00000  0.00000  0.00000 |  1.00000
  0.84962 |  0.00000  0.00000  0.00000  0.00000  0.00000  5.95335  0.00000  0.00000 |  1.00000
  0.94593 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  6.31230  0.00000 |  1.00000
  1.00000 |  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000  0.00000 31.41641 |  1.00000
----------+-------------------------------------------------------------------------+---------
  flux    |  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000  1.00000 |  1.00000

IGI start method

[3]:
s = iadpython.Sample(a=1, b=100, g=0)

r, t = iadpython.igi(s)
s.wrmatrix(r)
s.wrmatrix(t)
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  1.55547  0.33652  0.17494  0.13780 |  0.27559
  0.40947 |  0.33652  0.07281  0.03785  0.02981 |  0.05962
  0.78766 |  0.17494  0.03785  0.01968  0.01550 |  0.03100
  1.00000 |  0.13780  0.02981  0.01550  0.01221 |  0.02441
----------+-------------------------------------+---------
  flux    |  0.27559  0.05962  0.03100  0.02441 |  0.04883

cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 | 13.04576  0.33652  0.17494  0.13780 |  0.72441
  0.40947 |  0.33652  2.84330  0.03785  0.02981 |  0.94038
  0.78766 |  0.17494  0.03785  1.83038  0.01550 |  0.96900
  1.00000 |  0.13780  0.02981  0.01550  7.62158 |  0.97559
----------+-------------------------------------+---------
  flux    |  0.72441  0.94038  0.96900  0.97559 |  0.95117

[4]:
s = iadpython.Sample(a=1, b=100, g=0.9, quad_pts=4)

r, t = iadpython.igi(s)
s.wrmatrix(r)
s.wrmatrix(t)
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  3.19060  0.51300  0.09360 -0.01636 |  0.33415
  0.40947 |  0.51300  0.04916  0.00524  0.00941 |  0.03956
  0.78766 |  0.09360  0.00524  0.00250  0.00486 |  0.00723
  1.00000 | -0.01636  0.00941  0.00486 -0.00628 |  0.00409
----------+-------------------------------------+---------
  flux    |  0.33415  0.03956  0.00723  0.00409 |  0.02988

cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  9.56148  0.66419  0.16129 -0.01868 |  0.66585
  0.40947 |  0.66419  2.80843  0.07395  0.02700 |  0.96044
  0.78766 |  0.16129  0.07395  1.83985  0.07886 |  0.99277
  1.00000 | -0.01868  0.02700  0.07886  7.57767 |  0.99591
----------+-------------------------------------+---------
  flux    |  0.66585  0.96044  0.99277  0.99591 |  0.97012

Diamond Initialization

[5]:
s = iadpython.Sample(a=1, b=100, g=0.0, quad_pts=4)

r, t = iadpython.diamond(s)

rr = np.array([[1.04004,0.27087,0.14472,0.11473],
[0.27087,0.07055,0.03769,0.02988],
[0.14472,0.03769,0.02014,0.01596],
[0.11473,0.02988,0.01596,0.01266]])

tt = np.array([[15.57900,0.27087,0.14472,0.11473],
[0.27087,2.86214,0.03769,0.02988],
[0.14472,0.03769,1.83444,0.01596],
[0.11473,0.02988,0.01596,7.63134],
[0.17543,0.94373,0.96994,0.97617]])

print("r true")
s.wrmatrix(rr)

print("r ")
s.wrmatrix(r)


print("t true")
s.wrmatrix(r)

print("t ")
s.wrmatrix(r)


r true
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  1.04004  0.27087  0.14472  0.11473 |  0.21605
  0.40947 |  0.27087  0.07055  0.03769  0.02988 |  0.05627
  0.78766 |  0.14472  0.03769  0.02014  0.01596 |  0.03006
  1.00000 |  0.11473  0.02988  0.01596  0.01266 |  0.02383
----------+-------------------------------------+---------
  flux    |  0.21605  0.05627  0.03006  0.02383 |  0.04488

r
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  1.04004  0.27087  0.14472  0.11473 |  0.21605
  0.40947 |  0.27087  0.07055  0.03769  0.02988 |  0.05627
  0.78766 |  0.14472  0.03769  0.02014  0.01596 |  0.03006
  1.00000 |  0.11473  0.02988  0.01596  0.01266 |  0.02383
----------+-------------------------------------+---------
  flux    |  0.21605  0.05627  0.03006  0.02383 |  0.04488

t true
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  1.04004  0.27087  0.14472  0.11473 |  0.21605
  0.40947 |  0.27087  0.07055  0.03769  0.02988 |  0.05627
  0.78766 |  0.14472  0.03769  0.02014  0.01596 |  0.03006
  1.00000 |  0.11473  0.02988  0.01596  0.01266 |  0.02383
----------+-------------------------------------+---------
  flux    |  0.21605  0.05627  0.03006  0.02383 |  0.04488

t
cos_theta |  0.08859  0.40947  0.78766  1.00000 |     flux
----------+-------------------------------------+---------
  0.08859 |  1.04004  0.27087  0.14472  0.11473 |  0.21605
  0.40947 |  0.27087  0.07055  0.03769  0.02988 |  0.05627
  0.78766 |  0.14472  0.03769  0.02014  0.01596 |  0.03006
  1.00000 |  0.11473  0.02988  0.01596  0.01266 |  0.02383
----------+-------------------------------------+---------
  flux    |  0.21605  0.05627  0.03006  0.02383 |  0.04488

[ ]: