{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 電気抵抗計算:グリューナイゼンの式 \n", "\n", "(初版:2020年3月、更新:2023年2月21日) \n", "\n", "フォノンによる電気抵抗(グリューナイゼンの式)は、下記のように表されます。 \n", "\n", "  $\\rho (T) = C \\bigl( \\frac{T}{\\Theta_D} \\bigr)^5 \\int_{0}^{\\Theta_D /T} \\frac{x^5}{(e^x - 1)(1 - e^x)} dx$ \n", " \n", "この計算をJuliaですると、以下のようになります。" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.000158 seconds (114 allocations: 36.484 KiB)\n" ] }, { "data": { "image/svg+xml": [ "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", " \n", " \n", " \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "using Plots\n", "using Plots.PlotMeasures\n", "using QuadGK\n", "using LaTeXStrings\n", "\n", "#//---------- 図の描画のための関数 ----------//\n", "function DataPlot(xwave, ywave, titlename)\n", " Plots.reset_defaults()\n", " Plots.gr(\n", " titlefont=Plots.font(\"sans-serif\", 12),\n", " legendfont=Plots.font(\"sans-serif\", 8),\n", " guidefont=Plots.font(\"sans-serif\", 10),\n", " tickfont=Plots.font(\"sans-serif\", 8),\n", " )\n", " Plots.plot(size=(400, 400))\n", " p1 = Plots.plot(xwave, ywave,\n", " xscale = :identity, yscale = :identity,\n", " seriestype=:line, title=titlename, legend=false\n", " )\n", " p2 = Plots.plot(xwave, ywave,\n", " xscale = :log10, yscale = :log10,\n", " seriestype=:line, title=titlename, legend=false\n", " )\n", " Plots.plot(p1,p2,layout=(1,2),size=(800,400), bottom_margin = 20px, left_margin = [15px 15px 15px])\n", " Plots.plot!(ylabel=L\"R_\\textrm{phonon}\")\n", " Plots.plot!(xlabel=L\"T\\quad \\textrm{(K)}\")\n", "end\n", "\n", "#//---------- グリューナイゼンの式の計算をする関数 ----------//\n", "function ResistivityCalc()\n", " \n", " DT = 300 # デバイ温度 (K)。\n", " C = 10000 # 適当な定数。\n", " \n", " #温度の設定\n", " temp = collect(1:1:300)\n", " #グリューナイゼンの式の計算\n", " f(x) = x^5/((exp(x)-1)*(1-exp(-x))) #積分する式の定義\n", " intpart1 = quadgk.(f, 0, DT./temp) #積分部分の実行\n", " intpart2 = [intpart1[i][1] for i in 1:length(intpart1)] #TupleをArrayに変換とか\n", " calcR = (C/DT)*((temp./DT).^5).*intpart2\n", "\n", " return temp, calcR\n", "end\n", "\n", "#//---------- 計算の実行 ----------//\n", "@time temp, calcR = ResistivityCalc()\n", "\n", "#//---------- 図の描画とデータ保存 ----------//\n", "DataPlot(temp, calcR, \"Grüneisen Low\")" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"GruneisenR.csv\"" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "using CSV, DataFrames\n", "function saveData2(xwave, y1wave, filename::String)\n", " df = DataFrame(temp = xwave, resistivity = y1wave);\n", " df |> CSV.write(filename)\n", "end\n", "\n", "saveData2(temp, calcR, \"GruneisenR.csv\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.9.0-beta3", "language": "julia", "name": "julia-1.9" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.9.0" } }, "nbformat": 4, "nbformat_minor": 4 }