{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Refractive Index Information DB

" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from solcore.absorption_calculator.nk_db import download_db, search_db\n", "from solcore import material\n", "from solcore import si\n", "from solcore.solar_cell import SolarCell\n", "from solcore.structure import Layer\n", "from solcore.solar_cell_solver import solar_cell_solver, default_options\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "wl = si(np.arange(100, 900, 10), 'nm')\n", "\n", "opts = default_options\n", "opts.optics_method = 'TMM'\n", "opts.wavelength = wl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download the database from refractiveindex.info. This only needs to be done once.\n", "Can specify the source URL and number of interpolation points." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# download_db()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Can search the database to select an appropriate entry. Search by element/chemical formula.\n", "In this case, look for silver." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# search_db('Ag', exact = True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This prints out, line by line, matching entries. This shows us entries with\n", "\"pageid\"s 0 to 14 correspond to silver.\n", "\n", "Let's compare the optical behaviour of some of those sources:\n", "(The pageid values listed are for the 2021-07-18 version of the refractiveindex.info database)\n", "pageid = 0, Johnson\n", "pageid = 2, Jiang\n", "pageid = 4, McPeak\n", "pageid = 10, Hagemann\n", "pageid = 14, Rakic (BB)\n", "\n", "Then, create instances of materials with the optical constants from the database.\n", "The name (when using Solcore's built-in materials, this would just be the\n", "name of the material or alloy, like 'GaAs') is the pageid, AS A STRING, while\n", "the flag nk_db must be set to True to tell Solcore to look in the previously\n", "downloaded database from refractiveindex.info" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Ag_Joh = material(name='0', nk_db=True)()\n", "# Ag_Jia = material(name='2', nk_db=True)()\n", "# Ag_McP = material(name='4', nk_db=True)()\n", "# Ag_Hag = material(name='10', nk_db=True)()\n", "# Ag_Rak = material(name='14', nk_db=True)()\n", "# Ag_Sol = material(name='Ag')() # Solcore built-in (from SOPRA)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "plot the n and k data. Note that not all the data covers the full wavelength range,\n", "so the n/k value stays flat." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# names = ['Johnson', 'Jiang', 'McPeak', 'Hagemann', 'Rakic', 'Solcore built-in']\n", "#\n", "# plt.figure(figsize=(8,4))\n", "# plt.subplot(121)\n", "# plt.plot(wl*1e9, np.array([Ag_Joh.n(wl), Ag_Jia.n(wl), Ag_McP.n(wl),\n", "# Ag_Hag.n(wl), Ag_Rak.n(wl), Ag_Sol.n(wl)]).T)\n", "# plt.legend(labels=names)\n", "# plt.xlabel(\"Wavelength (nm)\")\n", "# plt.title(\"(2) $n$ and $\\kappa$ values for Ag from different literature sources\")\n", "# plt.ylabel(\"n\")\n", "#\n", "# plt.subplot(122)\n", "# plt.plot(wl*1e9, np.array([Ag_Joh.k(wl), Ag_Jia.k(wl), Ag_McP.k(wl),\n", "# Ag_Hag.k(wl), Ag_Rak.k(wl), Ag_Sol.k(wl)]).T)\n", "# plt.legend(labels=names)\n", "# plt.xlabel(\"Wavelength (nm)\")\n", "# plt.ylabel(\"k\")\n", "# plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Compare performance as a back mirror on a GaAs 'cell'\n", "\n", "Solid line: absorption in GaAs\n", "Dashed line: absorption in Ag" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# GaAs = material('GaAs')()\n", "#\n", "# colors = ['k', 'r', 'g', 'y', 'b', 'm']\n", "#\n", "# plt.figure()\n", "# for c, Ag_mat in enumerate([Ag_Joh, Ag_Jia, Ag_McP, Ag_Hag, Ag_Rak, Ag_Sol]):\n", "# my_solar_cell = OptiStack([Layer(width=si('50nm'), material = GaAs)], substrate=Ag_mat)\n", "# RAT = calculate_rat(my_solar_cell, wl*1e9, no_back_reflection=False)\n", "# GaAs_abs = RAT[\"A_per_layer\"][1]\n", "# Ag_abs = RAT[\"T\"]\n", "# plt.plot(wl*1e9, GaAs_abs, color=colors[c], linestyle='-', label=names[c])\n", "# plt.plot(wl*1e9, Ag_abs, color=colors[c], linestyle='--')\n", "#\n", "# plt.legend()\n", "# plt.xlabel(\"Wavelength (nm)\")\n", "# plt.ylabel(\"Absorbed\")\n", "# plt.title(\"(3) Absorption in GaAs depending on silver optical constants\")\n", "# plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.9" } }, "nbformat": 4, "nbformat_minor": 2 }