Skip to content

Commit

Permalink
Merge f70c737 into d61c3e6
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebe-p committed Mar 24, 2020
2 parents d61c3e6 + f70c737 commit 95d9891
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 151 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ dielectric models or available n and k data.
- A set of test have been written to assert the correct behaviour of Solcore, either before performing the installation or if one of the existing packages is modified. They can be run with 'python3 setup.py test'
- The 'poisson_drift_diffusion' solver now can print the output of the calculation to a log file, rather than the terminal.
- The correct temperature dependence has been incorporated to the analytic IV calculator.
- A set of examples have been created to illustrate the use of Solcore. Such examples can be copied to a user-speficied folder, where they can be easily edited.
- A set of examples have been created to illustrate the use of Solcore. Such examples can be copied to a user-speficied folder, where they can be easily edited.
46 changes: 23 additions & 23 deletions coverage/solcore_absorption_calculator_transfer_matrix_py.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/source/Examples/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Optical methods
---------------

- :doc:`Using the TMM solver to calculate the reflextion of a multilayered ARC <example_RAT_of_ARC>`
- :doc:`Looking at the effect of substrate and the no_back_reflexion option in the TMM solver <substrate_example>`
- :doc:`Looking at the effect of substrate and the no_back_reflection option in the TMM solver <substrate_example>`
- :doc:`Coherent and incoherent layers in the TMM solver<example_coherency>`

Custom materials
Expand Down
14 changes: 7 additions & 7 deletions docs/source/Examples/substrate_example.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Looking at the effect of substrate and the no_back_reflexion option in the TMM solver
Looking at the effect of substrate and the no_back_reflection option in the TMM solver
=====================================================================================

.. image:: substrate_RAT.png
Expand Down Expand Up @@ -32,13 +32,13 @@ Looking at the effect of substrate and the no_back_reflexion option in the TMM s
wl = si(np.linspace(300, 900, 200), 'nm')
# Thin solar cell, no substrate - will get significant absorption enhancement from reflection at the GaAs/air interface at the back
# MUST specify no_back_reflexion = False, so that Solcore does not automatically suppress reflections from the back
# (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflexion = True
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': False})
# MUST specify no_back_reflection = False, so that Solcore does not automatically suppress reflections from the back
# (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflection = True
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': False})
z_pos = np.linspace(0, thin_GaAs.width, 201)
profiles_thin = thin_GaAs[0].absorbed(z_pos)
# Same thin solar cell, but now on a GaAs substrate. In this case, we get the same result whether or not we specify
# no_back_reflexion to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway
# no_back_reflection to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway
solar_cell_solver(GaAs_on_substrate, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM'})
profiles_thick = GaAs_on_substrate[0].absorbed(z_pos)
Expand All @@ -49,10 +49,10 @@ Looking at the effect of substrate and the no_back_reflexion option in the TMM s
# Now we consider the thin solar cell without substrate again but ask Solcore to suppress back reflections. We must also
# ask Solcore to recalculate the absorption, otherwise it will just use the results calculated above which are already
# in the thin_GaAs object
# What no_back_reflexion = True actually does is add a highly absorbing layer based on the final layer in the stack so that
# What no_back_reflection = True actually does is add a highly absorbing layer based on the final layer in the stack so that
# nothing is reflected.
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': True,
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': True,
'recalculate_absorption': True})
plt.plot(wl * 1e9, thin_GaAs[0].layer_absorption, '--')
Expand Down
2 changes: 1 addition & 1 deletion docs/source/Optics/tmm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Transfer matrix method

Example 1: :doc:`Using the TMM solver to calculate the reflextion of a multilayered ARC <../Examples/example_RAT_of_ARC>`

Example 2: :doc:`Looking at the effect of substrate and the no_back_reflexion option in the TMM solver <../Examples/substrate_example>`
Example 2: :doc:`Looking at the effect of substrate and the no_back_reflection option in the TMM solver <../Examples/substrate_example>`

Example 3: :doc:`Coherent and incoherent layers in the TMM solver<../Examples/example_coherency>`

Expand Down
2 changes: 1 addition & 1 deletion examples/Optical_constants_ellipsometry_modelling_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# This results must be taken with care. As the ellipsometry routine can only deal with coherent light, there might be
# strange oscillations related with intereference in thick layers, something that should not happen.
# Setting no_back_reflexion=True (the default) should take care of most of this effects, but might add other unexpected
# Setting no_back_reflection=True (the default) should take care of most of this effects, but might add other unexpected
# ones.
fig, ax1 = plt.subplots(1, 1)
ax2 = ax1.twinx()
Expand Down
2 changes: 1 addition & 1 deletion examples/Optics_comparison_of_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
light_source = LightSource(source_type='standard', version='AM1.5g', x=wl,
output_units='photon_flux_per_m', concentration=1)
opts = default_options
opts.wavelength, opts.no_back_reflexion, opts.size, opts.light_source, opts.T_ambient = \
opts.wavelength, opts.no_back_reflection, opts.size, opts.light_source, opts.T_ambient = \
wl, False, [400, 400], light_source, T
opts.recalculate_absorption = True
# The size of the unit cell for the RCWA structure is 400 x 400 nm
Expand Down
2 changes: 1 addition & 1 deletion examples/coherency_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
options = State()
options.wavelength = wl
options.optics_method = 'TMM'
options.no_back_reflexion = False
options.no_back_reflection = False
options.BL_correction = True
options.recalculate_absorption = True

Expand Down
2 changes: 1 addition & 1 deletion examples/coherency_example_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def this_dir_file(f): # this is just Python stuff, so it can find external file
options = State()
options.wavelength = wl
options.optics_method = 'TMM'
options.no_back_reflexion = False
options.no_back_reflection = False
options.pol = 'p'
options.BL_correction = True
options.coherency_list = 111*['c']
Expand Down
10 changes: 5 additions & 5 deletions examples/notebooks/substrate_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"colab_type": "text"
},
"source": [
"Thin solar cell, no substrate - will get significant absorption enhancement from reflection at the GaAs/air interface at the back MUST specify no_back_reflexion = False, so that Solcore does not automatically suppress reflections from the back (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflexion = True"
"Thin solar cell, no substrate - will get significant absorption enhancement from reflection at the GaAs/air interface at the back MUST specify no_back_reflection = False, so that Solcore does not automatically suppress reflections from the back (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflection = True"
]
},
{
Expand All @@ -92,7 +92,7 @@
"colab": {}
},
"source": [
"solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': False})\n",
"solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': False})\n",
"z_pos = np.linspace(0, thin_GaAs.width, 201)\n",
"profiles_thin = thin_GaAs[0].absorbed(z_pos)"
],
Expand All @@ -106,7 +106,7 @@
"colab_type": "text"
},
"source": [
"Same thin solar cell, but now on a GaAs substrate. In this case, we get the same result whether or not we specify no_back_reflexion to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway"
"Same thin solar cell, but now on a GaAs substrate. In this case, we get the same result whether or not we specify no_back_reflection to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway"
]
},
{
Expand All @@ -133,7 +133,7 @@
"colab_type": "text"
},
"source": [
"Now we consider the thin solar cell without substrate again but ask Solcore to suppress back reflections. We must also ask Solcore to recalculate the absorption, otherwise it will just use the results calculated above which are already in the thin_GaAs object What no_back_reflexion = True actually does is add a highly absorbing layer based on the final layer in the stack so that nothing is reflected."
"Now we consider the thin solar cell without substrate again but ask Solcore to suppress back reflections. We must also ask Solcore to recalculate the absorption, otherwise it will just use the results calculated above which are already in the thin_GaAs object What no_back_reflection = True actually does is add a highly absorbing layer based on the final layer in the stack so that nothing is reflected."
]
},
{
Expand All @@ -144,7 +144,7 @@
"colab": {}
},
"source": [
"solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': True,\n",
"solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': True,\n",
" 'recalculate_absorption': True})\n",
"\n",
"plt.plot(wl * 1e9, thin_GaAs[0].layer_absorption, '--')\n",
Expand Down
12 changes: 6 additions & 6 deletions examples/substrate_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
wl = si(np.linspace(300, 900, 200), 'nm')

# Thin solar cell, no substrate - will get significant absorption enhancement from reflection at the GaAs/air interface at the back
# MUST specify no_back_reflexion = False, so that Solcore does not automatically suppress reflections from the back
# (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflexion = True
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': False})
# MUST specify no_back_reflection = False, so that Solcore does not automatically suppress reflections from the back
# (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflection = True
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': False})
z_pos = np.linspace(0, thin_GaAs.width, 201)
profiles_thin = thin_GaAs[0].absorbed(z_pos)
# Same thin solar cell, but now on a GaAs substrate. In this case, we get the same result whether or not we specify
# no_back_reflexion to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway
# no_back_reflection to be True or False, since with a GaAs on GaAs cell we don't get any reflection at the back interface anyway
solar_cell_solver(GaAs_on_substrate, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM'})
profiles_thick = GaAs_on_substrate[0].absorbed(z_pos)

Expand All @@ -37,10 +37,10 @@
# Now we consider the thin solar cell without substrate again but ask Solcore to suppress back reflections. We must also
# ask Solcore to recalculate the absorption, otherwise it will just use the results calculated above which are already
# in the thin_GaAs object
# What no_back_reflexion = True actually does is add a highly absorbing layer based on the final layer in the stack so that
# What no_back_reflection = True actually does is add a highly absorbing layer based on the final layer in the stack so that
# nothing is reflected.

solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflexion': True,
solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': True,
'recalculate_absorption': True})

plt.plot(wl * 1e9, thin_GaAs[0].layer_absorption, '--')
Expand Down
2 changes: 1 addition & 1 deletion solcore/absorption_calculator/rigorous_coupled_wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def initialise_S(stack, size, orders, substrate=None):
S.SetMaterial('shape_mat_' + str(i1 + 1), 1)

## Make the layers
stack_OS = OptiStack(stack, no_back_reflexion=False, substrate=substrate)
stack_OS = OptiStack(stack, no_back_reflection=False, substrate=substrate)
widths = stack_OS.get_widths()

for i1 in range(len(widths)): # create 'dummy' materials for base layers including incidence and transmission media
Expand Down
20 changes: 3 additions & 17 deletions solcore/absorption_calculator/tmm_core_vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
so you can call them with tmm.coh_tmm(...) etc.
"""

# from __future__ import division, print_function, absolute_import

import scipy as sp
import numpy as np
Expand Down Expand Up @@ -513,20 +512,14 @@ def fill_in(self, coh_tmm_data, layer):

if pol == 's':
temp = (n * np.cos(th) * kz).imag / (n_0 * np.cos(th_0)).real
#print('temp', temp)
self.A1 = temp * abs(w) ** 2
#print('A1', self.A1)
self.A2 = temp * abs(v) ** 2
#print('A2', self.A2)
self.A3 = temp * v * np.conj(w)
else: # pol=='p'
temp = (2 * (kz.imag) * (n * np.cos(np.conj(th))).real /
(n_0 * np.conj(np.cos(th_0))).real)
#print('temp', temp)
self.A1 = temp * abs(w) ** 2
#print('A1', self.A1)
self.A2 = temp * abs(v) ** 2
#print('A2', self.A2)
self.A3 = v * np.conj(w) * (-2 * (kz.real) * (n * np.cos(np.conj(th))).imag /
(n_0 * np.conj(np.cos(th_0))).real)
return self
Expand All @@ -553,11 +546,6 @@ def run(self, z):
part4 = np.conj(self.A3[:, None]) * np.exp(-1j * self.a3[:, None] * z[None, :])

part1[self.A1 < 1e-100, :] = 0
#print('part1', part1)
#print('part2', part2)
#print('part3+4', part3 + part4)


return (part1 + part2 + part3 + part4)
else:
return (self.A1 * np.exp(self.a1 * z) + self.A2 * np.exp(-self.a1 * z)
Expand Down Expand Up @@ -813,7 +801,6 @@ def inc_tmm(pol, n_list, d_list, c_list, th_0, lam_vac):

coh_tmm_bdata_list = []
for i in range(num_stacks):
# print(th_list[all_from_stack[i][0]])

coh_tmm_data_list.append(coh_tmm(pol, stack_n_list[i],
stack_d_list[i],
Expand Down Expand Up @@ -903,7 +890,6 @@ def inc_tmm(pol, n_list, d_list, c_list, th_0, lam_vac):
L_list.append(L)
Ltilde = np.matmul(Ltilde, L)

#print('Ltilde', Ltilde)
T = 1 / Ltilde[:, 0, 0]
R = Ltilde[:, 1, 0] / Ltilde[:, 0, 0]

Expand Down Expand Up @@ -1038,11 +1024,11 @@ def inc_find_absorp_analytic_fn(layer, inc_data):
backfunc = absorp_analytic_fn()
backfunc.fill_in(inc_data['coh_tmm_bdata_list'][stackindex],
-1 - withinstackindex)
#print('before scale', backfunc.A2, backfunc.A1)

backfunc.scale(inc_data['stackFB_list'][:, stackindex, 1])
#print('after scale', backfunc.A2, backfunc.A1)

backfunc.flip()
#print('after flip', backfunc.A2, backfunc.A1)

return forwardfunc.add(backfunc)


Expand Down

0 comments on commit 95d9891

Please sign in to comment.