Solution of the Stefan Problem with General Time-Dependent Boundary Conditions Using a Random Walk Method
Total Page:16
File Type:pdf, Size:1020Kb
TVE-F 19007 Examensarbete 15 hp Juni 2019 Solution of the Stefan problem with general time-dependent boundary conditions using a random walk method Daniel Stoor Abstract Solution of the Stefan problem with general time-dependent boundary conditions using a random walk method Daniel Stoor Teknisk- naturvetenskaplig fakultet UTH-enheten This work deals with the one-dimensional Stefan problem with a general time- dependent boundary condition at the fixed boundary. The solution will be obtained Besöksadress: using a discrete random walk method and the results will be compared qualitatively Ångströmlaboratoriet Lägerhyddsvägen 1 with analytical- and finite difference method solutions. A critical part has been to Hus 4, Plan 0 model the moving boundary with the random walk method. The results show that the random walk method is competitive in relation to the finite difference method Postadress: and has its advantages in generality and low effort to implement. The finite Box 536 751 21 Uppsala difference method has, on the other hand, higher accuracy for the same computational time with the here chosen step lengths. For the random walk Telefon: method to increase the accuracy, longer execution times are required, but since 018 – 471 30 03 the method is generally easily adapted for parallel computing, it is possible to Telefax: speed up. Regarding applications for the Stefan problem, there are a large range of 018 – 471 30 00 examples such as climate models, the diffusion of lithium-ions in lithium-ion batteries and modelling steam chambers for oil extraction using steam assisted Hemsida: gravity drainage. http://www.teknat.uu.se/student Handledare: Magnus Ögren Ämnesgranskare: Maria Strömme Examinator: Martin Sjödin ISSN: 1401-5757, TVE-F 19007 Populärvetenskaplig sammanfattning Ett Stefanproblem är ett värmeledningsproblem med en rörlig rand, vilket betyder att domänen där temperaturfördelningen utvärderas förändras med tiden. Som exempel på tillämpning av problemet kan tänkas ett smältande isblock där man önskar bestämma smältvattnets och/eller isens temperatur samt hur mycket is som smält efter en viss tid. Problemet är uppkallat efter Josef Stefan som formulerade problemet i en artikel 1891 och har idag flera tillämpningsområden, såsom klimatmodeller, modellering av hur litiumjoner diffunderar i litiumjonbatterier och vid användning av metoder för oljeutvin- ning där ånga injiceras i marken. I Stefans originalartikel presenterades ex- akta lösningar för problemet förutsatt att temperaturen på domänens yta inte förändrades, men i många tillämpningar är det intressant att ta fram lösningar då temperaturen på domänens yta istället är tidsberoende. En naturlig tillämpning för detta kan tänkas vara smältande is där ytans tem- peratur förändras efter dygnstemperaturen. För att hitta lösningar i dessa fall är det nödvändigt att använda numeriska metoder. Den numeriska metod som här undersöks är en slumpvandringsmetod och bygger på kopplingen mellan sannolikhetsteori och värmeledningsekvationen. Värmeledning som fysikalisk process uppkommer genom termisk rörelse hos små partiklar i ett medium. Genom att modellera detta matematiskt med slumppartiklar som vandrar i olika riktingar med vissa sannolikheter kan man under vissa villkor få fram ekvationer som uppfyller värmeledningsek- vationen. Målsättningen med detta projekt har varit att anpassa en så- dan slumpvandringsmetod till Stefanproblemet för godtyckliga tidsberoende temperaturer på domänens yta. En viktig del har handlat om att modellera hur gränsen mellan fast- och flytande fas förändras med hjälp av slumpvan- dringsmetoden. Resultaten har sedan jämförts med resultat från finita differensmetoden, som är en annan numerisk metod, och exakta lösningar. Här visar sig slumpvan- dringsmetoden ge goda resultat med rätt val av parametrar och i jämförelse med finita differensmetoden är den fördelaktig när det gäller flexibilitet och enkelhet att implementera. I detta arbete har endast ett endimensionellt fall studerats, men fördelarna för slumpvandringsmetoden gäller i ännu högre grad i högre dimensioner. 3 Contents 1 Introduction 5 1.1 Objectives . .5 1.2 Background . .6 1.3 Classic heat conduction problem . .6 2 The Stefan problem in one dimension 7 2.1 The Stefan condition . .8 3 Random walk modelling 10 3.1 Brownian motion as the limit of random walks . 12 3.2 Random walk and the heat equation . 14 3.3 A random walk model with boundary conditions . 16 3.4 Modelling the moving boundary . 17 4 Results 19 4.1 Heat equation with fixed boundary . 19 4.2 Stefan problem with constant boundary condition . 20 4.3 Stefan problem with boundary condition f(t) = et 1 .... 21 − 4.4 Stefan problem with oscillating boundary condition . 22 4.5 Stefan problem with boundary condition according to daytime temperature variations . 23 5 Discussion 24 5.1 Applications . 24 6 Conclusion 25 References 26 Appendix 28 4 1 Introduction In many applications in science and technology there are complicated par- tial differential equations (PDE:s) that need to be solved. Since analytical solutions may not always exist, different types of numerical methods are necessary. One of these methods is the random walk method (from here ab- breviated RWM), which has seen an increase in physical applications since probabilistic methods have been extended to fit a larger number of physical problems [1]. Among the strengths of the RWM is that it is very suitable for programming since it is easy to implement and does not create any large linear system to be solved. It often also supports parallel computing well. Another benefit is that the RWM is a local method, i.e. a solution can be carried out at specific points without having to obtain a solution for the whole domain [1] [2]. At last the RWM is also suitable for higher dimensions since complicated geometries are not as hard to model and memory usage is lower than with e.g. the finite difference method. In this work though, we will be restricted to the one-dimensional case. We will here use a discrete RWM to examine solutions to the Stefan problem, which is a PDE consisting of the heat equation defined in a phase changing medium. There are different types of formulations of this problem, but one of the characteristics is that it has a free or moving boundary governed by the Stefan condition, which describes the position of the interface between the phases. Beyond the moving boundary, the general formulation of the problem usually also includes a fixed boundary with a boundary condition different from the moving one. For physical reasons the boundary condition at the moving boundary is set to the melting point TM , but at the fixed boundary the conditions may be set to an arbitrary function f(t). For the case where we have a constant temperature at the fixed boundary f(t) = T0 and for one other particular form of f(t), there are analytical solutions to the Stefan problem. Otherwise, in most cases we need numerical approximations to evaluate a solution. As an example of such a case, it would be meaningful to model the melting of a medium where the surface temperature is an oscillating function according to the variations in day temperature. 1.1 Objectives The aim of this thesis is to solve the Stefan problem for arbitrary functions f(t) using the RWM. Moreover, we want to do a qualitative comparison analysis between the RWM, the exact solutions (when they exist) and finite difference method solutions made by Jonsson [3]. To make the choice of method comprehensible, we also want to present some theory about the connection between the RWM and the heat equation. 5 1.2 Background The RWM has it roots in probabilistic problems such as "Gambler’s ruin" described by e.g. Pascal [4]. An important contribution for the modern applications of the RWM was the formulation of Brownian motion that sat- isfies the diffusion equation in an article by Einstein in 1905 [5]. As we will see in section 3.1, random walk is closely associated with Brownian motion. From 1920s RWM:s have been used for analyzing PDE:s including diffusion processes and equilibrium states and since probability theory and computer science have developed, RWM:s have been used in a broader range of ap- plications [1]. Among these are population genetics, description of financial markets and polymer chains. A recent study shows that diffusion patterns and RWM:s also can be applied when analyzing network structures, such as the internet [4]. The Stefan Problem has its name from Josef Stefan (1835-1893) who was first to describe problems including a moving boundary in detail. This was investigated in his report on ice formation in polar seas [6], where he also presents the analytical solution (2.8) to the problem where the fixed bound- ary has constant temperature. Although, for the general case where f(t) is an arbitrary function, Stefan could not give an explicit solution except for some ideas and approximations. An explicit solution for this case has not been obtained yet, though there are some attempts to formulations, e.g. [7], which may require effort to implement. Except for the ice formation prob- lem examined by Stefan, moving boundary problems have many applications which will be mentioned later in the discussion section 5.1. Since the mod- elling of moving boundary problems in these applications plays an important role and has not yet been evaluated with a RWM, this will be the subject of this thesis. 1.3 Classic heat conduction problem As a starting problem, the classic heat equation with fixed boundary and homogenous Dirichlet conditions is considered. @T @2T = α ; 0 < x < L ; t > 0 ; (1.1) @t @x2 T (0; t) = T (L; t) = 0 ; t > 0 ; (1.2) T (x; 0) = g(x) : (1.3) Using separation of variables, the general solution to this problem is [8] 6 1 X −α( nπ )2t nπx T (x; t) = cne L sin : (1.4) L n=1 We write the initial condition as 1 X nπx g(x) = cn sin : (1.5) L n=1 By recognizing this as the Fourier series expansion of g(x) on 0 < x < L, cn can be determined.