diff --git a/Oven Brick Model.ipynb b/Oven Brick Model.ipynb index eb5ab36..cff1f8d 100644 --- a/Oven Brick Model.ipynb +++ b/Oven Brick Model.ipynb @@ -11,6 +11,8 @@ "import cantera as ct\n", "import pde\n", "\n", + "import ipywidgets as widgets\n", + "\n", "from matplotlib import pyplot as plt\n", "%matplotlib widget" ] @@ -45,7 +47,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ed6ee54043434154a827020efbee7467", + "model_id": "c7038d50268541e680fd49194661f002", "version_major": 2, "version_minor": 0 }, @@ -70,7 +72,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "8e7a0d0a9f784ebdaf657d3722690175", + "model_id": "dd4bd23cf2e546b9a7bd17b74f5769f2", "version_major": 2, "version_minor": 0 }, @@ -84,7 +86,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "21a25e45f3a846e5bd8e8097e7a36359", + "model_id": "f7e512a0f1b44f1ab67d93d7d9043b19", "version_major": 2, "version_minor": 0 }, @@ -904,6 +906,81 @@ "h2.thermo.h(25+273.15)" ] }, + { + "cell_type": "markdown", + "id": "75feeff2", + "metadata": {}, + "source": [ + "# A/F 계산기" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "bf8c7fe0", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e44ad08b1cf141639749b2aca1c1b6d7", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "interactive(children=(Textarea(value='', description='Fuel Composition:', placeholder='\"species_name_0:X0, spe…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "@widgets.interact(\n", + " composition=widgets.Textarea(\n", + " value='',\n", + " placeholder='\"species_name_0:X0, species_name_1:X1, species_name_2:X2, ... \"',\n", + " description='''Fuel Composition:''',\n", + " disabled=False\n", + "),\n", + " O2_in_exhaust=widgets.FloatSlider(\n", + " value=0,\n", + " min=0,\n", + " max=21.0,\n", + " step=0.1,\n", + " description='excess O2(%)',\n", + " readout=True,\n", + " readout_format='.1f',\n", + ")\n", + ")\n", + "def calculate_AF (composition, O2_in_exhaust):\n", + " gas = ct.Solution('gri30.xml')\n", + " try:\n", + " gas.TPX = 300, ct.one_atm, composition\n", + " except ct.CanteraError:\n", + " gas.TPX = 300, ct.one_atm, \"H2:1\"\n", + " \n", + " gas()\n", + " \n", + " AF_st = stoich_AF(composition)\n", + " \n", + " print(f'stoichiometric A/F = {AF_st}')\n", + " \n", + " f_found = opt.root_scalar(lambda x: exhaust_stoichiometry(x)[\"O2\"] - O2_in_exhaust/100, \n", + " bracket=[3e-1, 1])\n", + " \n", + " # print(f_found)\n", + " \n", + " phi = f_found.root\n", + " print(f_found)\n", + " print(f'phi for {O2_in_exhaust}% O2 in exhaust gas = {phi}')\n", + " print(f'A/F(vol) for {O2_in_exhaust}% O2 in exhaust gas = {AF_st / phi}')\n", + " # mean molecular weight needed to calc mass A/F\n", + "\n", + " gas.TPX = 300, ct.one_atm, exhaust_stoichiometry(phi)\n", + " gas()" + ] + }, { "cell_type": "markdown", "id": "4c6c962f", @@ -914,7 +991,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "2f732468", "metadata": { "scrolled": false @@ -934,47 +1011,10 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "53b2c1b9", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " gri30:\n", - "\n", - " temperature 298.15 K\n", - " pressure 1.0133e+05 Pa\n", - " density 1.1869 kg/m^3\n", - " mean mol. weight 29.039 kg/kmol\n", - " phase of matter gas\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.5255e+06 -4.4299e+07 J\n", - " internal energy -1.6109e+06 -4.6778e+07 J\n", - " entropy 6999.5 2.0326e+05 J/K\n", - " Gibbs function -3.6124e+06 -1.049e+08 J\n", - " heat capacity c_p 1027.5 29837 J/K\n", - " heat capacity c_v 741.17 21523 J/K\n", - "\n", - " mass frac. Y mole frac. X chem. pot. / RT\n", - " --------------- --------------- ---------------\n", - " H2 0.0018679 0.026906 -19.333\n", - " O2 0.1362 0.1236 -26.764\n", - " CH4 0.0041445 0.0075018 -57.401\n", - " CO 0.098029 0.10163 -70.646\n", - " CO2 0.12525 0.082645 -186.95\n", - " C2H4 0.00052634 0.00054482 -12.715\n", - " C2H6 0.00017359 0.00016764 -70.088\n", - " N2 0.63381 0.657 -23.453\n", - " [ +45 minor] 0 0 \n", - "\n" - ] - } - ], + "outputs": [], "source": [ "gas_u = ct.Solution('gri30.xml')\n", "gas_u.TPX = 25 + 273.15, ct.one_atm, Xu\n", @@ -991,43 +1031,10 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "a1bc3d15", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " gri30:\n", - "\n", - " temperature 298.15 K\n", - " pressure 1.0133e+05 Pa\n", - " density 1.2684 kg/m^3\n", - " mean mol. weight 31.031 kg/kmol\n", - " phase of matter gas\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -2.9803e+06 -9.2481e+07 J\n", - " internal energy -3.0602e+06 -9.496e+07 J\n", - " entropy 6565.1 2.0372e+05 J/K\n", - " Gibbs function -4.9377e+06 -1.5322e+08 J\n", - " heat capacity c_p 997.71 30960 J/K\n", - " heat capacity c_v 729.77 22645 J/K\n", - "\n", - " mass frac. Y mole frac. X chem. pot. / RT\n", - " --------------- --------------- ---------------\n", - " O2 0.046403 0.045 -27.775\n", - " H2O 0.026987 0.046486 -123.33\n", - " CO2 0.2928 0.20645 -186.03\n", - " N2 0.63381 0.70206 -23.387\n", - " [ +49 minor] 0 0 \n", - "\n" - ] - } - ], + "outputs": [], "source": [ "gas_b = ct.Solution('gri30.xml')\n", "gas_b.TPX = 25 + 273.15, ct.one_atm, Xb\n", @@ -1044,21 +1051,10 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "067ae187", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'1.454825772118082 MJ/kg'" - ] - }, - "execution_count": 46, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "heating_value_J_kg = gas_u.enthalpy_mass - gas_b.enthalpy_mass\n", "f'{heating_value_J_kg*1e-6} MJ/kg'" @@ -1066,7 +1062,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "f8713062", "metadata": {}, "outputs": [], @@ -1076,21 +1072,10 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "42f68b81", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'3636.3636363636365 MJ / hr to a combustion chamber'" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "heat_to_chamber = heat_to_battery * 1000 * 3 / 66 # MJ / hr\n", "f'{heat_to_chamber} MJ / hr to a combustion chamber'" @@ -1106,21 +1091,10 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "fd85f6dc", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'2499.5182970050437 (kg/hr) = 3636.3636363636365 (MJ/hr) / 1.454825772118082 (MJ/kg)'" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mfr_to_chamber = heat_to_chamber * 1e6 / heating_value_J_kg # kg / hr\n", "f'{mfr_to_chamber} (kg/hr) = {heat_to_chamber} (MJ/hr) / {heating_value_J_kg * 1e-6} (MJ/kg)'" @@ -1136,47 +1110,10 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "fa7ef7a2", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " gri30:\n", - "\n", - " temperature 1990.3 K\n", - " pressure 1.0133e+05 Pa\n", - " density 0.18983 kg/m^3\n", - " mean mol. weight 31.002 kg/kmol\n", - " phase of matter gas\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -8.9328e+05 -2.7694e+07 J\n", - " internal energy -1.427e+06 -4.4241e+07 J\n", - " entropy 8783.1 2.7229e+05 J/K\n", - " Gibbs function -1.8374e+07 -5.6963e+08 J\n", - " heat capacity c_p 1347.2 41767 J/K\n", - " heat capacity c_v 1079 33452 J/K\n", - "\n", - " mass frac. Y mole frac. X chem. pot. / RT\n", - " --------------- --------------- ---------------\n", - " O 6.69e-05 0.00012964 -15.939\n", - " O2 0.045092 0.043688 -31.879\n", - " OH 0.00048954 0.00089239 -30.541\n", - " H2O 0.02669 0.045932 -45.143\n", - " CO 0.001079 0.0011942 -41.097\n", - " CO2 0.29111 0.20507 -57.036\n", - " NO 0.003114 0.0032174 -29.575\n", - " N2 0.63235 0.6998 -27.272\n", - " [ +45 minor] 8.9232e-06 7.3917e-05 \n", - "\n" - ] - } - ], + "outputs": [], "source": [ "gas_chamber = ct.Solution('gri30.xml')\n", "gas_chamber.TPX = 600 + 273.15, ct.one_atm, Xu\n", @@ -1190,73 +1127,30 @@ }, { "cell_type": "code", - "execution_count": 87, + "execution_count": null, "id": "1d6c95a7", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Tad = 1717.1055126606984 `C\n" - ] - } - ], + "outputs": [], "source": [ "print(f'Tad = {eq_state[0] - 273.15} `C')" ] }, { "cell_type": "code", - "execution_count": 89, + "execution_count": null, "id": "e437f3b4", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "NO: 3217.3809731942233 ppm\n" - ] - } - ], + "outputs": [], "source": [ "print(f'NO: {gas_chamber.mole_fraction_dict()[\"NO\"] * 1e6} ppm')" ] }, { "cell_type": "code", - "execution_count": 103, + "execution_count": null, "id": "683e1479", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "564968.6851296029 1057170.3471485006\n", - "258568.46996560355\n", - "239.0022179980857 1363443.6972422504\n", - "-612434.5630397515\n", - "400326.765370211 1148091.5363109885\n", - "3005.361043723591\n", - "398382.53608438675 1149155.5265008416\n", - "-2.858431953645777\n", - "398384.3836843984 1149154.51548965\n", - "0.000179249735083431\n", - "398384.3835685452 1149154.5155530453\n", - "8.731149137020111e-10\n", - "398384.38356854365 1149154.515553046\n", - "-1.6298145055770874e-09\n", - "496.511875 converged: True\n", - " flag: 'converged'\n", - " function_calls: 7\n", - " iterations: 6\n", - " root: 1558.4107622013973\n", - "Outlet Gas Temperature: 1285.2607622013975 `C\n" - ] - } - ], + "outputs": [], "source": [ "htc = 568 # W / m2 / K\n", "\n", @@ -1310,8 +1204,21 @@ " self.T0 = T0\n", " self.P0 = P0\n", " self.X0 = X0\n", + " self.gas = ct.Solution(\"gri30.xml\")\n", + " self.h0 = 0\n", " \n", - " def balance_energy_equation (Tout, Twall0, Twall1):\n", + " def energy_balance_equation (Tout, Twall0, Twall1):\n", + " # mdot * (dh) - self.heat()\n", + " pass\n", + " \n", + " \n", + " def solve (self, ):\n", + " pass\n", + " \n", + " def heat (self, Tgas, Twall0, Twall1):\n", + " # Tgas = (T0 + T1) / 2\n", + " # heat_to_Twall0 + heat_to_Twall1\n", + " pass\n", " " ] }, @@ -1325,18 +1232,10 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": null, "id": "858a862e", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "346.5 Mcal / ton\n" - ] - } - ], + "outputs": [], "source": [ "# 50'C 장입탄 1 톤을 1100'C 코크스로 건류시키기 위해 필요한 열량\n", "heat_coking_mcal_per_ton = (1100 - 50) * 0.33 # Mcal / t-c\n", @@ -1345,18 +1244,10 @@ }, { "cell_type": "code", - "execution_count": 78, + "execution_count": null, "id": "d9a3443d", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "925.2 Mcal / ton\n" - ] - } - ], + "outputs": [], "source": [ "# 50`C 물 1톤을 800`C 수증기로 증발하는데 필요한 열량\n", "# 액체 가열 + 증발 + 증기 가열\n", @@ -1367,18 +1258,10 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": null, "id": "bc35e30a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "90.223776 GJ / charge\n" - ] - } - ], + "outputs": [], "source": [ "# 1~4 기 장입 습탄 34 톤 중 수분 5.9% (2 톤) 제외 건탄 32 톤\n", "# 1 문당 장입에서 추출까지 필요한 열량\n", @@ -1389,7 +1272,7 @@ }, { "cell_type": "code", - "execution_count": 80, + "execution_count": null, "id": "c5a556cd", "metadata": {}, "outputs": [], @@ -1399,18 +1282,10 @@ }, { "cell_type": "code", - "execution_count": 81, + "execution_count": null, "id": "2b8e5d35", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "59.4 rev / charge\n" - ] - } - ], + "outputs": [], "source": [ "# 건류 시간 동안 rev 횟수\n", "n_rev_total = 3 * 24 * 66 / 80\n", @@ -1421,21 +1296,10 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": null, "id": "9e3eee55", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'100.24864 GJ / rev'" - ] - }, - "execution_count": 82, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# 66 문에 rev 당 공급되는 열량\n", "f'{66 * heat_total_gj / n_rev_total} GJ / rev'" @@ -1443,7 +1307,7 @@ }, { "cell_type": "code", - "execution_count": 83, + "execution_count": null, "id": "4ae27703", "metadata": {}, "outputs": [], @@ -1453,7 +1317,7 @@ }, { "cell_type": "code", - "execution_count": 90, + "execution_count": null, "id": "d552c14d", "metadata": {}, "outputs": [], @@ -1463,72 +1327,20 @@ }, { "cell_type": "code", - "execution_count": 91, + "execution_count": null, "id": "c4d73576", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 300 K\n", - " pressure 1.0132e+05 Pa\n", - " density 996.63 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 0\n", - " phase of matter liquid\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.5858e+07 -2.857e+08 J\n", - " internal energy -1.5858e+07 -2.857e+08 J\n", - " entropy 3913.2 70500 J/K\n", - " Gibbs function -1.7032e+07 -3.0685e+08 J\n", - " heat capacity c_p 4180.8 75321 J/K\n", - " heat capacity c_v 4131 74424 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water" ] }, { "cell_type": "code", - "execution_count": 93, + "execution_count": null, "id": "4c82456a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 313.15 K\n", - " pressure 1.0132e+05 Pa\n", - " density 992.27 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 0\n", - " phase of matter liquid\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.5803e+07 -2.8471e+08 J\n", - " internal energy -1.5803e+07 -2.8471e+08 J\n", - " entropy 4092.4 73728 J/K\n", - " Gibbs function -1.7085e+07 -3.078e+08 J\n", - " heat capacity c_p 4175.6 75228 J/K\n", - " heat capacity c_v 4067.9 73288 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water.TP = 40 + 273.15, ct.one_atm\n", "\n", @@ -1537,36 +1349,10 @@ }, { "cell_type": "code", - "execution_count": 97, + "execution_count": null, "id": "9dd982a4", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 313.15 K\n", - " pressure 7367.2 Pa\n", - " density 0.051107 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 1\n", - " phase of matter liquid-gas-mix\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.3397e+07 -2.4135e+08 J\n", - " internal energy -1.3541e+07 -2.4395e+08 J\n", - " entropy 11778 2.1219e+05 J/K\n", - " Gibbs function -1.7085e+07 -3.078e+08 J\n", - " heat capacity c_p 1884.7 33955 J/K\n", - " heat capacity c_v 1414.4 25481 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water.TQ = 40 + 273.15, 1\n", "h_vapor = water.enthalpy_mass\n", @@ -1575,36 +1361,10 @@ }, { "cell_type": "code", - "execution_count": 98, + "execution_count": null, "id": "70b5436f", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 313.15 K\n", - " pressure 7367.2 Pa\n", - " density 992.23 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 0\n", - " phase of matter liquid-gas-mix\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.5803e+07 -2.8471e+08 J\n", - " internal energy -1.5803e+07 -2.8471e+08 J\n", - " entropy 4092.4 73729 J/K\n", - " Gibbs function -1.7085e+07 -3.078e+08 J\n", - " heat capacity c_p 4176.1 75236 J/K\n", - " heat capacity c_v 4067.9 73287 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water.TQ = 40 + 273.15, 0\n", "h_water = water.enthalpy_mass\n", @@ -1613,57 +1373,20 @@ }, { "cell_type": "code", - "execution_count": 99, + "execution_count": null, "id": "1c18625b", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "2406727.679574404" - ] - }, - "execution_count": 99, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "h_vapor - h_water" ] }, { "cell_type": "code", - "execution_count": 100, + "execution_count": null, "id": "17f8781a", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 282.88 K\n", - " pressure 1.0133e+05 Pa\n", - " density 999.71 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 0\n", - " phase of matter liquid\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.593e+07 -2.8699e+08 J\n", - " internal energy -1.593e+07 -2.8699e+08 J\n", - " entropy 3667 66064 J/K\n", - " Gibbs function -1.6967e+07 -3.0568e+08 J\n", - " heat capacity c_p 4201.1 75688 J/K\n", - " heat capacity c_v 4197.7 75626 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water.TP = 40+273.15, ct.one_atm\n", "h0 = water.enthalpy_mass\n", @@ -1673,36 +1396,10 @@ }, { "cell_type": "code", - "execution_count": 104, + "execution_count": null, "id": "f4e62efb", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - " water:\n", - "\n", - " temperature 338.15 K\n", - " pressure 24986 Pa\n", - " density 0.16107 kg/m^3\n", - " mean mol. weight 18.016 kg/kmol\n", - " vapor fraction 1\n", - " phase of matter liquid-gas-mix\n", - "\n", - " 1 kg 1 kmol \n", - " --------------- ---------------\n", - " enthalpy -1.3353e+07 -2.4056e+08 J\n", - " internal energy -1.3508e+07 -2.4335e+08 J\n", - " entropy 11352 2.0451e+05 J/K\n", - " Gibbs function -1.7191e+07 -3.0972e+08 J\n", - " heat capacity c_p 1926.9 34715 J/K\n", - " heat capacity c_v 1443.6 26008 J/K\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "water.TQ = 65 + 273.15, 1\n", "water()" @@ -1710,32 +1407,13 @@ }, { "cell_type": "code", - "execution_count": 106, + "execution_count": null, "id": "54881653", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0.8110541903465941" - ] - }, - "execution_count": 106, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "20 / (24986 / ct.one_atm * 100)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "38f04ea4", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {