원시데이터 수집 시스템
선정목록으로

Modelling One Dimensional Steady State Heat Conduction Problem Using Monte Carlo Simulation: A Python View Point

관련 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)

기본 정보

저자
  1. Gajula, Krishna — Department of Mechanical Engineering, Jaypee University of Engineering and Technology, Guna, Madhya Pradesh, India
  2. Yashasvini Raghuvanshi — Department of Computer Science Engineering, Jaypee University of Engineering and Technology, Guna, Madhya Pradesh, India
  3. Priyanshi Mishra — Department of Computer Science Engineering, Jaypee University of Engineering and Technology, Guna, Madhya Pradesh, India
  4. Dhananjay R. Mishra — Department of Mechanical Engineering, Jaypee University of Engineering and Technology, Guna, Madhya Pradesh, India
  5. Dumka Pankaj — Department of Mechanical Engineering, Jaypee University of Engineering and Technology, Guna, Madhya Pradesh, India
DOI
10.5281/zenodo.7756158
저널
Zenodo (CERN European Organization for Nuclear Research)
발행년도
2023
발행기관
European Organization for Nuclear Research
피인용수
0
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.5281/zenodo.7756158
토픽
Thermal properties of materials
OpenAlex ID
W6912810688

평가 내용

관련도
관련
사업분야
수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

<em>In this article an attempt has been made to model one-dimensional steady state heat conduction problem using Monte Carlo simulation (random walk). First, the differential equation has been discretized and the probabilities are set. Then an algorithm has been devised to apply the simulation and the detailed process has been described and is composed of a Python-program. A numerical problem was used to test the software, and it was found that the outcomes are extremely similar to those of the analytical results. It has been observed that more the number of random walks the more the accuracy of the results will be. </em>

본문 19,144자

본문 펼치기
g g gy Volume 6 Issue 1 # Modelling One Dimensional Steady State Heat Conduction Problem Using Monte Carlo Simulation: A Python View Point _Krishna Gajula_ <sup>_1_</sup> _, Yashasvini Raghuvanshi_ <sup>_2_</sup> _, Priyanshi Mishra_ <sup>_3_</sup> _, Dhananjay R. Mishra_ <sup>_4_</sup> _,_ _Pankaj Dumka_ <sup>_5_</sup> _*_ _1,4,5Department of Mechanical Engineering, Jaypee University of Engineering and_ _Technology, Guna, Madhya Pradesh, India_ _2,3Department of Computer Science Engineering, Jaypee University of Engineering and_ _Technology, Guna, Madhya Pradesh, India_ _*Corresponding Author_ _E-mail Id:_ _p.dumak.ipec@gmail.com_ _ABSTRACT_ _In this article an attempt has been made to model one-dimensional steady state heat_ _conduction problem using Monte Carlo simulation (random walk). First, the differential_ _equation has been discretized and the probabilities are set. Then an algorithm has been_ _devised to apply the simulation and the detailed process has been described and is composed_ _of a Python-program. A numerical problem was used to test the software, and it was found_ _that the outcomes are extremely similar to those of the analytical results. It has been_ _observed that more the number of random walks the more the accuracy of the results will be._ _Keywords:_ _Heat conduction, one dimensional heat conduction, Monte Carlo simulation,_ _random walk, python programming_ INTRODUCTION transfer problem first the differential In heat transfer problems specially for one equations are discetized as is done in the dimensional (1D) steady state cases the finite difference and the temperature at any solution strategy is straight forward [1]. node is written in terms of its surrounding Both analytical and numerical results are nodes and their respective uncertainties. there with many articles on different From that node random walks are taken aspects of 1D heat transfer [2–4]. But there and based on them the temperature of the are very few literature which not only node is predicted. The best part of the deals with the heat transfer problem with method is that if one requires the statistical approach but also explain and temperature at any point then the solution show the implementation in easy to at the entire domain is not at all required reproduce fashion [5,6]. instead the method can tell the value at discrete points without knowing about Therefore the authors of this research other points (except boundary nodes) [10]. article has felt a need to write an article to focus on the application of Monte Carlo For the accuracy of the solutions obtained simulation in 1D heat conduction problem. from Monte Carlo simulation the number Monte Carlo simulation is a statistical of random number generated (random approach to a problem, with is like a game walks) should be sufficiently large. Hence, [7–9]. If the rules of the game are set for a hand calculations are not possible, particular type of problem then the answer therefore computer programs have to be can be obtained without going into the written to perform the task. The choice of analytical nature of the problem. In heat Python programming for mathematical and HBRP Publication Page 1-8 2023 All Rights Reserved Page 1 scientific computation is eminent as its syntax is very easy and it is easy to implement [11–22]. Also, the libraries for arrays (NumPy) and data plotting (Matplotlib) are also very rich and robust [23–27]. In this article first the problem of heat conduction is explained the differential equations are discretized. The Monte Carlo algorithm is explained and the implementation procedure is explained and g g gy Volume 6 Issue 1 programmed in Python. Finally the results are tested on a standard heat transfer problem. MONTE CARLO FORMULATION Consider heat transfer through a slab as shown in Fig.1. The left and right end temperatures are ?1 and ?2 . The slab thickness in the direction of heat flow is ? and its area normal to heat flow is A. _Fig. 1:_ _Heat conduction in 1D slab._ As there is no variation in the temperature in the normal directions to x, this problem comes under the category of 1D conduction. The governing equation of 1D heat conduction is given by: <u>?</u> <sup>2</sup> <u>?</u> ?? <sup>2</sup> <sup>= 0 (1)</sup> _Fig. 2:_ _Computational grid_ Now discretizing the Eq. 1 in the domain using second order finite difference scheme with the help of grid shown in Fig. 2. <u>??+1−2??+??−1</u> = 0 (2) <u>??+1−2??+??−1</u> = 0 (2) Δ? <sup>2</sup> On further simplification Eq. 2 becomes: <u>1</u> <u>1</u> ?? = 2 <sup>??+1 +</sup> 2 <sup>??−1 (3)</sup> <u>1</u> <u>1</u> <u>1</u> 2 <sup>??+1 +</sup> 2 <u>1</u> <u>1</u> ?? = 2 <sup>??+1 +</sup> 2 <sup>??−1 (3)</sup> From the point of view of Monte Carlo simulation the coefficients of neighbouring points i.e. <u>12</u> <sup>can be written in terms of probability of random walk to these points which can be</sup> generally written as: ?? = ?? <sup>+</sup> ??+1 + ?? <sup>−</sup> ??−1 (3) HBRP Publication Page 1-8 2023 All Rights Reserved Page 2 ?+ = ??− <u>1</u> where, ??+ where, ??+ = ??− = <u>12</u> <sup>. The important point</sup> is that the probabilities should be positive and their sum should be 1. Now some rule has to be set for the random walk i.e. what philosophy has to be set for random number. The rule can be that the random walk is started at point ? and if the random number generated is more than 1/2 then move in forward direction else move in the backward direction. Finish the walk if the boundary point is arrived. Record the temperature and store it in memory. Start another random walk from the point ? and this has to be repeated till the number of times (N) the random walk is set. Finally, add all the recorded temperatures at the end of each walk and divide by the total number of walks, this will be the final temperature obtained at ? <sup>th</sup> location. Mathematically it is represented in Eq. 4. ?? = <u>1</u> Ni=1 Twi (4) ? <sup>∑</sup> ?− = <u>1</u> ?? = <u>1</u> Ni=1 Twi (4) ? <sup>∑</sup> where, Twi is the wall temperature at the <u>1</u> Ni=1 Twi ? <sup>∑</sup> where, Twi is the wall temperature at the end of ? <sup>th</sup> random walk. PYTHON IMPLEMENTATION The algorithm to implement the above algorithm is as follows: - Define the domain length - Define number of nodes and evaluate their spacing - Generate array of ? in the domain - Create an empty temperature array and set the left and right boundary temperatures g g gy Volume 6 Issue 1 - Select the total number of random walks (N) As the first and last nodes have already fixed temperatures (due to boundary conditions) so inner nodes have to be swept to evaluate the temperature. Therefore, run a for loop to sweep through second node till the second last node. For every node the random walk i.e. Monte Carlo simulation has to be performed as shown in above section. - Initialize Σ? with zero. - Run a indefinite loop which will break only when the boundary nodes are arrived at during a random walk. In this loop generate a random number (rn) between 0 and 1 (as probability cannot exceed 1). If rn > 1/2 then increment the node value by 1 else decrement it by 1. Repeat this procedure till the loop breaks. Before breaking the while loop increment Σ? by the boundary temperature at which the random walk has reached. - Repeat it for all the number of walks i.e. ?. And divide Σ? by ?. Store it in the ? <sup>th</sup> location of temperature array. - Repeat the procedure till all the inner nodes are covered. Consider the length of slab be 1 m and the left (??) and right (??) temperatures be 50 and 30 units. The analytical formula for the temperature variation is shown in Eq. 5. ?= ?? - <u>??−??</u> ? (5) ? <u>??−??</u> temperatures <u>??−??</u> ?= ?? - ? (5) ? The python program to perform the task of random walk will be as follows: from pylab import * from numpy import * _# Domain length_ ℓx=1 HBRP Publication Page 1-8 2023 All Rights Reserved Page 3 g g gy Volume 6 Issue 1 _# Number of nodes_ n=10 _# Spacing between nodes_ Δx=ℓx/(n-1) _# Array of x_ x=linspace(0,ℓx,n) _# Left and right end temperatures_ T_lb=50 T_rb=30 _# Temperature array_ T=empty(n) _# Updating the boundary conditions_ T[0]=T_lb T[-1]=T_rb _# Number of random walks_ N=2000 _# loop for moving along the domain_ for i in range(1,n-1): _# initializing ΣT_ ΣT=0 _# Starting random walks for ith node_ for rw in range(N): node=i _# Resetting of node at this point is must_ while True: _# Generating random number_ rn=random.uniform(0,1) _# Termination criterion_ if node==0 or node==n-1: ΣT=ΣT+T[node] break _# Random walk direction_ elif rn>0.5: node=node+1 else: node= node-1 _# Summing up all the tem's and their average_ T[i]=ΣT/N HBRP Publication Page 1-8 2023 All Rights Reserved Page 4 g g gy Volume 6 Issue 1 _# Analytical result_ T_ana=T[0]-x*(T[0]-T[-1])/ℓx _# Data Plotting_ figure(1,dpi=300) plot(x,T,'r-o',label='MC') plot(x,T_ana,'b-',label='Analytical') xlabel('x') ylabel('T') legend() savefig('1D.jpg') show() The program output is shown in Fig. 3. The number of random walks for each node has been set to 2000 in the program. _Fig. 3_ _: Variation of analytical and statistical temperatures along the slab_ One should be aware that the simulation result will always not be the same as shown above but there will be variation but the variation will be small for large number of random walks. Fig. 3 shows how the solution varies with the variation in the number of random walks. HBRP Publication Page 1-8 2023 All Rights Reserved Page 5 g g gy Volume 6 Issue 1 _Fig. 4:_ _Variation of temperature with different random walks_ . HBRP Publication Page 1-8 2023 All Rights Reserved Page 6 It can be seen from Fig. 4 that as the number of random walks increases the accuracy of solution also increases and for N=50000 the analytical and statistical results are almost overlapping. CONCLUSION In this communication the Monte Carlo simulation (random walk) has been used to model a one dimensional steady state conduction problem with fixed boundary conditions. The procedure has been explained and is formed as an algorithm which is programmed in Python. The program has been tested on a numerical problem and it has been observed that the results are very much close to the analytical results. Also, the accuracy of the algorithm increases with the number of random walks for each node. The Python programme created in this study will aid practitioners in comprehending how to incorporate statistical logics in a coding language. REFERENCES 1. <mark>Ma, Y., He, Z., Peng, X., & Xing, Z.</mark> <mark>(2012). Experimental investigation of</mark> <mark>the discharge valve dynamics in a</mark> <mark>reciprocating compressor for trans-</mark> <mark>critical</mark> <mark>CO2</mark> <mark>refrigeration</mark> <mark>cycle.</mark> _<mark>Applied</mark>_ _<mark>Thermal</mark>_ _<mark>Engineering</mark>_ <mark>,</mark> _<mark>32</mark>_ <mark>, 13-21.</mark> 2. <mark>Patankar, S. V. Numerical Heat</mark> <mark>Transfer and Fluid Flow.[M], 1980.</mark> 3. <mark>Deo, A., Joshi, A. R., Parashar, A.,</mark> <mark>Mishra, D. R., & Dumka, P. (2022).</mark> <mark>Analysing one dimensional tapered</mark> <mark>pin-fin using finite difference.</mark> _<mark>Res</mark>_ _<mark>Appl Therm Eng</mark>_ <mark>,</mark> _<mark>5</mark>_ <mark>(1), 1-6.</mark> 4. <mark>Dumka, P., Sharma, S., Gautam, H., &</mark> <mark>Mishra, D. R. (2021). Finite volume</mark> <mark>modelling</mark> <mark>of</mark> <mark>an</mark> <mark>axisymmetric</mark> <mark>cylindrical fin using python.</mark> _<mark>Res Appl</mark>_ _<mark>Therm Eng</mark>_ <mark>,</mark> _<mark>4</mark>_ <mark>(3), 1-11.</mark> 5. <mark>Hoff, S. J., & Janni, K. A. (1989).</mark> <mark>Monte</mark> <mark>Carlo</mark> <mark>technique</mark> <mark>for</mark> <mark>the</mark> <mark>determination of thermal radiation</mark> g g gy Volume 6 Issue 1 <mark>shape factors.</mark> _<mark>Transactions of the</mark>_ _<mark>ASAE</mark>_ <mark>,</mark> _<mark>32</mark>_ <mark>(3), 1023-1028.</mark> 6. <mark>Sizyuk, V., & Hassanein, A. (2014).</mark> <mark>Efficient Monte Carlo simulation of</mark> <mark>heat</mark> <mark>conduction</mark> <mark>problems</mark> <mark>for</mark> <mark>integrated</mark> <mark>multi-physics</mark> <mark>applications.</mark> _<mark>Numerical</mark>_ _<mark>Heat</mark>_ _<mark>Transfer,</mark>_ _<mark>Part</mark>_ _<mark>B:</mark>_ _<mark>Fundamentals</mark>_ <mark>,</mark> _<mark>66</mark>_ <mark>(5), 381-396.</mark> 7. <mark>Bonate,</mark> <mark>P.</mark> <mark>L. (2001).</mark> <mark>A</mark> <mark>brief</mark> <mark>introduction</mark> <mark>to</mark> <mark>Monte</mark> <mark>Carlo</mark> <mark>simulation.</mark> _<mark>Clinical</mark>_ _<mark>pharmacokinetics</mark>_ <mark>,</mark> _<mark>40</mark>_ <mark>, 15-22.</mark> 8. <mark>Zio, E., & Zio, E. (2013).</mark> _<mark>Monte carlo</mark>_ _<mark>simulation: The method</mark>_ <mark>(pp. 19-58).</mark> <mark>Springer London.</mark> 9. <mark>Harrison, R. L. (2010, January).</mark> <mark>Introduction</mark> <mark>to</mark> <mark>monte</mark> <mark>carlo</mark> <mark>simulation.</mark> <mark>In</mark> _<mark>AIP</mark>_ _<mark>conference</mark>_ _<mark>proceedings</mark>_ <mark>(Vol. 1204, No. 1, pp. 17-</mark> <mark>21). American Institute of Physics.</mark> 10. <mark>Harrison, R. L. (2010, January).</mark> <mark>Introduction</mark> <mark>to</mark> <mark>monte</mark> <mark>carlo</mark> <mark>simulation.</mark> <mark>In</mark> _<mark>AIP</mark>_ _<mark>conference</mark>_ _<mark>proceedings</mark>_ <mark>(Vol. 1204, No. 1, pp. 17-</mark> <mark>21). American Institute of Physics.</mark> 11. <mark>Gajula, K., Sharma, V., Sharma, B.,</mark> <mark>Mishra, D. R., & Dumka, P. (2022).</mark> <mark>Modelling of Energy in Transit Using</mark> <mark>Python.</mark> _<mark>Int J Innov Sci Res Technol</mark>_ <mark>,</mark> _<mark>7</mark>_ <mark>,</mark> <mark>1152-6.</mark> 12. <mark>Dumka, P., Chauhan, R., Singh, A.,</mark> <mark>Singh, G., & Mishra, D. (2022).</mark> <mark>Implementation of Buckingham's Pi</mark> <mark>theorem using Python.</mark> _<mark>Advances in</mark>_ _<mark>Engineering Software</mark>_ <mark>,</mark> _<mark>173</mark>_ <mark>, 103232.</mark> 13. <mark>Dumka, P., Rana, K., Tomar, S. P. S.,</mark> <mark>Pawar, P. S., & Mishra, D. R. (2022).</mark> <mark>Modelling</mark> <mark>air</mark> <mark>standard</mark> <mark>thermodynamic</mark> <mark>cycles</mark> <mark>using</mark> <mark>python.</mark> _<mark>Advances</mark>_ _<mark>in</mark>_ _<mark>Engineering</mark>_ _<mark>Software</mark>_ <mark>,</mark> _<mark>172</mark>_ <mark>, 103186.</mark> 14. <mark>Dumka, P., Deo, A., Gajula, K.,</mark> <mark>Sharma, V., Chauhan, R., & Mishra,</mark> <mark>D. R. (2022). Load and Load Duration</mark> <mark>Curves Using Python.</mark> _<mark>Int J All Res</mark>_ _<mark>Educ Sci Methods</mark>_ <mark>,</mark> _<mark>10</mark>_ <mark>, 2127-34.</mark> 15. <mark>Raghuvanshi, Y., Mishra, D. R., &</mark> <mark>Dumka, P. (2022). Modelling Logic</mark> HBRP Publication Page 1-8 2023 All Rights Reserved Page 7 <mark>Gates in Python.</mark> _<mark>IJFMR-International</mark>_ _<mark>Journal</mark>_ _<mark>For</mark>_ _<mark>Multidisciplinary</mark>_ _<mark>Research</mark>_ <mark>,</mark> _<mark>4</mark>_ <mark>(5).</mark> 16. <mark>Dumka, P., Deo, A., Gajula, K.,</mark> <mark>Sharma, V., Chauhan, R., & Mishra,</mark> <mark>D. R. (2022). Load and Load Duration</mark> <mark>Curves Using Python.</mark> _<mark>Int J All Res</mark>_ _<mark>Educ Sci Methods</mark>_ <mark>,</mark> _<mark>10</mark>_ <mark>, 2127-34.</mark> 17. <mark>Joshi, A. R., Deo, A., Parashar, A.,</mark> <mark>Mishra, D. R., & Dumka, P. (2023).</mark> <mark>Modelling Steam Power Cycle using</mark> <mark>Python.</mark> 18. <mark>Dumka,</mark> <mark>P.,</mark> <mark>&</mark> <mark>Mishra,</mark> <mark>D.</mark> <mark>R.</mark> <mark>Understanding the TDMA/Thomas</mark> <mark>algorithm and its Implementation in</mark> <mark>Python.</mark> 19. <mark>Dumka, P., Pawar, P. S., Sauda, A.,</mark> <mark>Shukla, G., & Mishra, D. R. (2022).</mark> <mark>Application of He's homotopy and</mark> <mark>perturbation method to solve heat</mark> <mark>transfer</mark> <mark>equations:</mark> <mark>a</mark> <mark>python</mark> <mark>approach.</mark> _<mark>Advances in Engineering</mark>_ _<mark>Software</mark>_ <mark>,</mark> _<mark>170</mark>_ <mark>, 103160.</mark> 20. <mark>Pawar, P. S., Mishra, D. R., Dumka,</mark> <mark>P., & Pradesh, M. (2022). Obtaining</mark> <mark>Exact</mark> <mark>Solutions</mark> <mark>of</mark> <mark>Visco</mark> <mark>incompressible Parallel Flows Using</mark> <mark>Python.</mark> _<mark>Int</mark>_ _<mark>J</mark>_ _<mark>Eng</mark>_ _<mark>Appl</mark>_ _<mark>Sci</mark>_ _<mark>Technol</mark>_ <mark>,</mark> _<mark>6</mark>_ <mark>(11), 213-217.</mark> 21. <mark>Backer, A. (2007). Computational</mark> <mark>physics</mark> <mark>education</mark> <mark>with</mark> <mark>Python.</mark> _<mark>Computing</mark>_ _<mark>in</mark>_ _<mark>Science</mark>_ _<mark>&</mark>_ _<mark>Engineering</mark>_ <mark>,</mark> _<mark>9</mark>_ <mark>(3), 30-33.</mark> 22. <mark>Ranjani, J., Sheela, A., & Meena, K.</mark> <mark>P. (2019, April). Combination of</mark> <mark>NumPy, SciPy and Matplotlib/Pylab-a</mark> <mark>good</mark> <mark>alternative</mark> <mark>methodology</mark> <mark>to</mark> <mark>MATLAB-A Comparative analysis.</mark> <mark>In</mark> _<mark>2019 1st International Conference</mark>_ _<mark>on Innovations in Information and</mark>_ _<mark>Communication</mark>_ _<mark>Technology</mark>_ _<mark>(ICIICT)</mark>_ <mark>(pp. 1-5). IEEE.</mark> 23. <mark>Bauckhage, C. (2020).</mark> _<mark>NumPy/SciPy</mark>_ _<mark>recipes for data science: subset-</mark>_ _<mark>constrained vector quantization via</mark>_ _<mark>mean discrepancy minimization</mark>_ <mark>(pp.</mark> <mark>1-6). Technical report by University of</mark> <mark>Bonn, February.</mark> g g gy Volume 6 Issue 1 24. <mark>Van Der Walt Stefan, C. S. (2011).</mark> <mark>Chris and Varoquaux Gaël.“.</mark> _<mark>The</mark>_ _<mark>NumPy</mark>_ _<mark>Array:</mark>_ _<mark>A</mark>_ _<mark>Structure</mark>_ _<mark>for</mark>_ _<mark>Efficient Numerical Computation”,</mark>_ _<mark>Computing</mark>_ _<mark>in</mark>_ _<mark>Science</mark>_ _<mark>&</mark>_ _<mark>Engineering</mark>_ <mark>,</mark> _<mark>13</mark>_ <mark>, 22-30.</mark> 25. <mark>Porcu, V., & Porcu, V. (2018).</mark> <mark>Matplotlib.</mark> _<mark>Python for Data Mining</mark>_ _<mark>Quick Syntax Reference</mark>_ <mark>, 201-234.</mark> <mark>Bisong, E., & Bisong, E. (2019).</mark> <mark>Matplotlib</mark> <mark>and</mark> <mark>seaborn.</mark> _<mark>Building</mark>_ _<mark>Machine Learning and Deep Learning</mark>_ _<mark>Models on Google Cloud Platform: A</mark>_ _<mark>Comprehensive Guide for Beginners</mark>_ <mark>,</mark> <mark>151-165.</mark> HBRP Publication Page 1-8 2023 All Rights Reserved Page 8

섹션 본문

섹션 본문이 없습니다.

참고문헌

참고문헌 정보가 없습니다.