一个python软件包,用于设计用于散热的材料。

wptherml的Python项目详细描述


drawing 开创了热能利用材料的设计。

概述

wpthermal代表williampaterson大学的thermale能量和r层纳米结构辐射管理工具。 这个软件包的目标是提供一个易于使用的平台,用于设计具有定制光学和热性能的材料 在许多能源应用中,控制辐射的吸收和释放,或将热量转换成辐射,或反之亦然,是至关重要的。 光学性质在经典电动力学中处理,当前版本使用传输矩阵法严格求解麦克斯韦方程 对于层状各向同性介质。wptherml是由william paterson大学的foley实验室构想和开发的。传递矩阵方程的更多细节,以及目前在wptherml中实现的完整数学公式,可以在 文档

快速启动

  • wptherml是用python 3编写的,需要numpy、scipy和matplotlib包。当前安装的anaconda python 3包应该提供您所需要的一切 在Windows、Mac或Linux平台上

  • 从github安装:

    • git克隆https://github.com/foleylab/wptherml.git
    • cd wptherml
    • python3 setup.py安装
  • 从克隆存储库运行单元测试:

    • CD测试
    • python3-m py test test.py
  • 运行单元测试的测试脚本可以在这里下载

  • 使用PIP3安装:

    • pip3安装wptherml
  • 在您喜爱的文本编辑器或IDE中打开一个新的.py文件,例如

vim example.py

这个包的功能包含在一个叫做multilayer的类中。一个基本的例子 对于导入多层膜类的脚本,计算涂有50 nm 二氧化钛和100纳米二氧化硅,以及绘图 它使用pyplot如下:

fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()

{:。语言python}

  • 将此脚本保存并在终端中运行为

python3 example.py

其中example.py是您创建的文件的名称,或者如果您在IDE中执行此操作,请在IDE中执行它!

下图显示了上述示例的示意图。请注意 图片中的图层以及如何通过材质列表和厚度列表相对于 入射光、反射光、透射光和热发射光 drawing

在这个存储库中有一些使用jupyter笔记本中包含的多层类特性的示例,包括:

在不久的将来还会有更多的人加入!

播放列表

wptherml的开发人员编写了一个主题为spotify playlist的spotify playlist,名为"一切都是热的";我们希望它能激励您为 利用热量和热辐射!

功能列表

  1. 使用传输矩阵方法计算任意多层平面结构的反射率、透射率和吸收率/发射率谱
  2. 将多层结构在给定温度下的热发射光谱计算为发射率*黑体光谱
  3. 计算从吸收率*am1.5光谱吸收的太阳能
  4. 根据上述数量,可以为各种热相关应用计算以下性能相关数量:
    • 给定pv下(s)tpv发射器的光谱效率
    • 给定pv的有效功率密度tpv发射器
    • 给定pv的短路电流密度tpv发射器
    • 给定pv的tpv效率tpv发射器
    • 给定浓度因子下stpv吸收器的吸收器效率
    • 白炽灯泡灯丝的发光效率/发光效率
    • 在给定的环境温度和多层温度下,白天辐射冷却的冷却功率
  5. 根据光学量,可以进行以下分析
    • 识别表面等离子体激元模式
    • 完全识别吸收模式
    • 在低温和高温下渲染多层的颜色
  6. < > >

    上述量的计算由一个叫做多层的类来简化。多层类分析字典中的键 结构数据,如构成正在建模的多层结构的材料和厚度,以及需要的应用类型 考虑的多层结构。下面是多层类将识别的字典键的完整列表,以及 用户可以提供的与每个键相关的数据:

    'Lambda_List'# a list of three floats that includes in order (i) shortest wavelength in meters, (ii) longest wavelength in meters, and (iii) total number of wavelengths where you would like the optical quantities to be evaluated.  (Default is [400e-9,6000e-9,1000])'Thickness_List'# a list of floats that specify the thickness in meters of each layer.  Note that the terminal layers (first and last) must have thickness of 0. (Default is [0, 900e-9, 0].)'Material_List'# a list of strings that specify the materials in each layer (Default is ['Air', 'W', 'Air'].  Thefollowingstringsarecurrentlyrecognizedforthefollowingsupportedmaterials:*'Air'-keywordforAir*'SiO2'-keywordforGlass*'HfO2'-keywordforHafniumOxide*'Al2O3'-keywordforAluminumOxide*'TiO2'-keywordforTitaniumOxide*'AlN'-keywordforAluminumNitride*'TiN'-keywordforTitaniumNitride*'Ag'-keywordforSilver*'Au'-keywordforGold*'Pd'-keywordforPalladium*'Pt'-keywordforPlatinum*'W'-keywordforTungsten'Temperature'# a float specifying the temperature of the multi-layer structure in Kelvin.  (Default is 300 K)'PV_Temperature'# a float specifying the temperature of a PV cell in a (S)TPV device in Kelvin.  (Default is 300 K).'Ambient_Temperature'# a float specifying the ambient temperature in Kelvin for radiative cooling applications. (Default is 300 K).'STPV_EMIT'# an int where '1' means compute properties associated with (S)TPV emitters. (Default is 0, do not compute these quantities).'STPV_ABS'# an int where '1' means compute properties associated with STPV/Concentrated Solar absorbers. (Default is 0).'COOLING'# an int where '1' means compute properties associated with radiative cooling. (Default is 0).'LIGHTBULB'# an int where '1' means compute properties associated with incandescent sources. (Default is 0).'COLOR'# an int where '1' means compute and display the ambient and thermal color of a structure. (Default is 0).'EXPLICIT_ANGLE'# an int where '1' means compute the optical properties and thermal emission at a range of angles and, when applicable, compute performance properties with explicit angular dependence.  (Default is 0, meaning most quantities will be computed assuming the emissivity does not depend upon angle.)'DEG'# an int that specifies the number of different angles that will be considered inthecalculationofopticalandthermalemissionpropertiesasafunctionofangle.(Defaultis7,whichhasbeenobservedtogivereasonablygoodaccuracywhenallangularintegralsareperformedusingGauss-Legendrequadrature).

    {:。语言python}

    多层类的方法和属性列表

    给定上面指定的输入参数,multilay类使用不同的方法来计算与热应用相关的属性,这些属性存储为属性 多层对象的。下面是多层类的方法及其相关属性的列表:

    definline_structure(structure):### a method to parse input parameters from a dictionary (here called structure, all currently-supported dictionary ### keys are defined above.  This method is called by the __init__ and defines the following attributes:self.lambda_array# the list of wavelengths in meters that will be used to evaluate optical and thermal spectraself.d# the list of thicknesses that define the geometry of the multilayerself.matlist# the list of strings that specify the materialsself.n# the 2D arrays of refractive index values for each material for each wavelength (inner index specifies material, outter index wavelength)self.T_ml# the temperature of the multi-layer in Kelvinself.T_cell# the temperature of the PV cell in Kelvinself.T_amb# the ambient temperature in Kelvinself.stpv_emitter_calc# the flag that determines if (S)TPV emitter properties will be computedself.stpv_absorber_calc# the flag that determines if (S)TPV absorber properties will be computedself.cooling_calc# the flag that determines if radiative cooling properties will be computedself.lightbulb_calc# the flag that determines if incandescent properties will be computedself.color_calc# the flag that determines if colors will be renderedself.explicit_angle# the flag that determines if explicit angle-dependence of optical properties will be consideredself.deg# the number of different angles that will be computed for angle-dependent optical properties

    {:。语言python} 除了通过解析用户输入显式设置的属性之外,还有几个数组属性 基于内联结构定义的属性分配:

    ### The following are always createdself.reflectivity_array# initialized as an array of zeros the same length as self.lambda_arrayself.transmissivity_array# initialized as an array of zeros the same length as self.lambda_arrayself.emissivity_array# initialized as an array of zeros the same length as self.lambda_arrayself.thermal_emission_array# initialized as an array of zeros the same length as self.lambda_array### The following are created if self.explicit_angle == 1self.x# points from Gauss-Legendre grid of degree self.deg from 0 to 1self.t# self.deg angles on Gauss-Legendre grid transformed to be between 0 and pi/2self.w# self.deg weights from Gauss-Legendre grid transformed to be between 0 and pi/2self.reflectivity_array_p# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.reflectivity_array_s# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.transmissivity_array_p# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.transmissivity_array_s# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.emissivity_array_p# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.emissivity_array_s# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.thermal_emission_array_p# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_arrayself.thermal_emission_array_s# initialized as a 2D array of zeros, inner dimension same as self.deg and outter same as self.lambda_array

    {:。语言python}

    ''' Method to compute optical properties of reflectivity, transmissivity, and emissivity of structure as a function of wavelength assuming normal incidence '''deffresnel()### Upon execution, the following arrays are filled with their respective values### for every wavelength in self.lambda_arrayself.reflectivity_arrayself.transmissivity_arrayself.emissivity_array

    {:。语言python}

    ''' Method to compute optical properties of reflectivity, transmissivity, and emissivity of structure as a function of wavelength and angle, both p- and s-polarizationsare considered '''deffresnel_ea()### Upon execution, the following arrays are filled with their respective values### for every wavelength in self.lambda_array and every angle in self.tself.reflectivity_array_pself.reflectivity_array_sself.transmissivity_array_pself.transmissivity_array_sself.emissivity_array_pself.emissivity_array_s

    {:。语言python}

    ''' Method to compute thermal emission spectrum of a structure at a given temperature;note temperature specified by self.T_ml '''defthermal_emission()### Upon execution, the following arrays are computed for every wavelength in self.lambda_array### for temperature given by self.T_mlself.BBs# Blackbody spectrumself.thermal_emission_array## thermal emission of structure defined as Blackbody * emissivity

    {:。语言python}

    ''' Method to compute thermal emission spectrum of a structure at a given temperature for a range of angles '''defthermal_emission_ea()### Upon execution, the following arrays are computed for every wavelength in self.lambda_array### and every angle in self.t for temperature given by self.T_mlself.thermal_emission_array_p## thermal emission of structure defined as Blackbody * p-polarized emissivityself.thermal_emission_array_s## thermal emission of structure defined as Blackbody * s-polarized emissivity

    {:。语言python}

    ''' Method to compute optical properties of reflectivity, transmissivity, and emissivity as a function of angle for a given polarization self.pol and wavelength lambda_0 '''defangular_fresnel(self,lambda_0)### Upon execution, the following arrays are computed for 180 angles between 0 and pi/2self.r_vs_theta# reflectivityself.t_vs_theta# transmissivityself.eps_vs_theta# emissivity

    {:。语言python}

    fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()
    0

    {:。语言python}

    fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()
    1

    {:。语言python}

    fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()
    2

    {:。语言python}

    fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()
    3

    {:。语言python}

    fromwptherml.wpmlimportmultilayerfrommatplotlibimportpyplotasplt### dictionary that stores basic properties ### of the multilayer structure you want to simulatestructure={### actual materials the structure is made from... note terminal layers are air and### top-side layer (layer upon which light is incident) is SiO2.### Refractive index values are stored in the attribute self.n'Material_List':['Air','SiO2','TiO2','Au','Air'],### thickness of each layer... terminal layers must be set to zero### values are stored in attribute self.d'Thickness_List':[0,100e-9,50e-9,20e-9,0],### range of wavelengths optical properties will be calculated for### values are stored in the array self.lam'Lambda_List':[400e-9,800e-9,1000]}### create the instance called coated_au_filmcoated_au_film=multilayer(structure)### create a plot of the reflectivity of the coated au film - use red lines### the wavelengths are stored in SI units so we will multiply by 1e9 to ### plot them in nanometersplt.plot(1e9*coated_au_film.lambda_array,coated_au_film.reflectivity_array,'red')plt.show()
    4

    {:。语言python}

    扩展多层类

    多层类应该提供一个方便的机制来扩展包以包括 附加应用(可能需要对菲涅耳进行不同的操作 存储为属性self.reflectivity_array、self.emissibility_array的数量, 自透射系数阵列,或作为属性存储的热发射 自热发射或者包括不同类别的结构 (非平面结构,例如,相同属性的自反射率阵列等, 计算方法与传递矩阵法不同。典型 扩展软件包功能的工作流可以包括

    • 确定将由 扩展并向多层类添加适当的属性
    • 向库中添加一个或多个函数(stpvlib等) 将菲涅耳和/或热发射量子化为 需要计算新的所需属性
    • 添加一个或多个多层方法以调用新库函数 并根据需要将生成的数据存储在新的或现有的多层属性中。

    欢迎加入QQ群-->: 979659372 Python中文网_新手群

    推荐PyPI第三方库


热门话题
爪哇领导人选举   java查询MongoDB数组并使用最匹配的元素进行排序   java使用Maven在Tomcat上生成和访问WSDL   java从给定列表中做出不同的选择   java读取netflow/rflow(ddwrt)数据包内容   jaxb反序列化XML以在Java中动态创建类   通过Java执行的Curl命令在windows中有效,而不是在linux中   java同步方法是否阻止更新对象字段?   带有自定义适配器崩溃应用程序的java Android ListView   java字符串到字符串数组的转换   使用redis缓存java对象:为什么它比ConcurrentHashMap更好?   java再次加载jni库时会发生什么?   java ClassNotFoundException在JustSerialized类的反序列化期间发生