MATH-UA 251 Intro to Math Modeling Final Project A Model of Melting

Yue Sun

May 11, 2017

Abstract

This project constructs a model for one-dimensional ice melting process, and numerically simulates the melting time of certain length of ice slab under different melting temperatures. The model involves solving the with a moving boundary condition, hence we study the Stefan problem, i.e. the moving boundary condition problem. This project solves both analytically and numerically for this one-dimensional heat equation with moving bound- ary condition.

1 Introduction

The incentive of this project is to calculate the melting time of a given amount of ice, for example, how long it would take for all the ice to be melted on Gould Plaza after it snows in . However, it would require a construction of a three-dimensional model, which would be too complicated for this project. Here we simplify the project onto a one-dimensional semi-infinite plane; instead of ice cube, we consider ice slab in this project.

Since the melting process involves phase change, it is natural to consider heat equation for this model. As mentioned in lectures that heat equation is a form of partial differential equation, we would need the initial conditions and the boundary conditions to find a solution. The key thing to notice is that the boundary condition, h(t), is not fixed, but dependent with time. This particular moving boundary condition problem, also called the Stefan problem, has been studied by . The classical Stefan problem aims to describe the temperature distribution in a homoge- neous medium undergoing a phase change, for example ice passing to : this is accomplished by solving the heat equation imposing the initial temperature distribution on the whole medium, and a particular boundary condition, the Stefan condition, on the evolving boundary between its two phases.

In this paper, we examine a model of ice melting through Stefan problem. This problem is estab- lished in Section 2, analytically solved in Section 4 and numerically solved in Section 5. In Section 3 we introduce the dimensionless parameter, the .

2 The Mathematical Model of Melting Processes

Before we derive a mathematical model for the melting process, we first discuss the physical properties of phase change, and the assumptions needed to simplify this model in Section 2.1. Then we derive the heat equation, the basis of this model in Section 2.2. In Section 2.3, we explain and derive the Stefan condition.

1 2.1 Physical Properties and Assumptions

For this project, we restrict ourselves to the ice melting process only, i.e. one-phase, hence we consider a material in a liquid and solid phase separated by an interface. For simplification, we assume that the liquid phase density ρL and the solid phase density ρS to be constant, i.e. ρL = ρS = ρ. What’s more, we assume a constant atmosphere temperature u0, a constant melting temperature uB and L. For each phase, we have constant thermal conductivities kL, kS, kL 6= kS and constant specific heats cL, cS, cL 6= cS. Also, we do not consider other physical effects other than isotropic heat in this model. We restrict our domain onto the one- dimensional semi-infinite case, i.e. Ω = [0, +∞), and without any heat sink or source. We denote the interface separating the water and ice as h(t), 0 ≤ h(t) ≤ l, and we assume it to be without surface tension and of zero thickness.

2.2 The Heat Equation

We have proved in lectures that, for heat conduction in an infinite rod, we can write the heat equation, i.e. one dimensional diffusion as ∂u ∂u = α . ∂t ∂x2

Now we derive the one-dimensional heat equation in this project. The melting of ice involves phase change from solid state to liquid state. As a result, molecular movement is involved in the heat conduction, which is represented by temperature. When a change of phase takes place, a latent heat L is either absorbed or released, while the temperature of the material changing its phase remains constant.

The fundamental physical concept of the heat equation is the heat flux. In the references of this project, there are detailed derivation of the heat equation. Thus we leave out the proof and only state the heat equation. ∂u(x, t) k ∂2u(x, t) = (2.1) ∂t cρ ∂x2 Common boundary condition for the case Ω = [0, +∞) are an imposed temperature,

u(0, t) = u0(t) and lim u(x, t) = u∞(t) (2.2) x→∞

2.3 The Stefan Problem

For our melting process, we divide the domain Ω into a solid phase and a liquid phase, separated by an interface h(t), as illustrated in Figure 1.

Figure 1: Liquid and solid phases with interface h(t) and imposed boundary temperatures

2 By studying the Stefan problem, we would derive a Stefan condition, i.e. moving boundary con- dition, which is crucial in solving a Stefan problem. Here we review the derivation of the Stefan condition based on the references, but we leave out the detailed proof.

The key to derive a boundary condition is to write out the total enthalpy referred to the melting temperature uB, and here we denote the cross section of Ω as A,

h Z h(t) Z l i E(t) = A ρcL(u(x, t) − uB) + ρLdx + ρcS(u(x, t) − uB) + ρLdx (2.3) 0 h(t) with L as the latent heat of the material. We apply Leibniz’s integral, the heat equation to (2.3) imposed with u(h(t), t) = uB, and we get

1 dE ∂u(h(t), t) ∂u(0, t) dh(t) ∂u(l, t) ∂u(h(t), t) = k − k + ρL + k − k (2.4) A dt L ∂x L ∂x dt S ∂x S ∂x With rearrangement of heat fluxes and simplification, we have the one-dimensional Stefan condition

dh(t) ∂u(h(t), t) ∂u(h(t), t) ρL = k − k (2.5) dt S ∂x L ∂x

dh(t) which indicates that the velocity of the interface dt of the interface h(t) is proportional to the jump of the heat flux across the interface. This condition allows us to construct a mathematical model for a phase change process under the assumptions and simplifications in Section 2.1.

Since here we only consider one-phase, i.e. the ice slab is initially solid at melting temperature uB, we have dh(t) ∂u(h(t), t) ρL = −k (2.6) dt L ∂x where kL = k denotes the thermal conductivity of the liquid phase.

2.4 Equations Sum-up

Define u(x, t) as the temperature distribution, h(t) as the moving boundary.

• Heat equation:

∂u(x, t) k ∂2u(x, t) = , 0 ≤ x ≤ h(t), 0 ≤ h(t) ≤ l, t > 0 (2.7) ∂t cρ ∂x2 where c is the specific heat of the liquid phase, ρ is the density of the liquid, and k is the thermal conductivity of the liquid phase. • Stefan condition: dh(t) k ∂u(x, t) = − , h(0) = 0, t > 0 (2.8) dt Lρ ∂x x=h(t) where L is the latent heat of melting. • Initial boundary condition:

u(0, t) = u0

u(h(t), t) = uB

u(0, 0) = uB

where u0 is atmosphere temperature, and uB is the temperature at the interface, i.e. the melting temperature.

3 3 Nondimensionalization

To nondimensionalize the heat equation and the Stefan condition derived in Section 2, we define x k u h Xe = , τ = 2 t, Ue = , eh = l ρcl u0 l

This nondimensionalization would allow to set the problem for a finite unit ice slab 0 ≤ Xe ≤ 1, as illustrated in Figure 2.

Figure 2: Liquid and solid phases with interface eh(τ) and imposed boundary temperatures in dimensionless form

We can rewrite the equations into their nondimensionalized form, and we will be using this form for following calculation.

• Heat equation:

∂u(X,e τ) ∂2u(X,e τ) e = e , 0 ≤ Xe ≤ eh(τ), 0 ≤ eh(τ) ≤ 1, τ > 0 (3.1) ∂τ ∂Xe 2 • Stefan condition: dh(τ) ∂u(X, τ) e e e = −Ste , eh(0) = 0 (3.2) dτ ∂Xe Xe=eh(τ) c∆u where Ste = L , and ∆u as the temperature difference between two phases. • Initial boundary condition:

ue(0, τ) = ue0 ue(eh(τ), τ) = ueB ue(0, 0) = ueB

The key thing to notice is that, we have derived a dimensionless parameter, i.e. the Stefan number, in this nondimensionalization: c∆u Ste = L which is crucial in analyzing Stefan problem.

4 Analytical Solution of One Dimensional Heat Equation

After deriving the equations for this model, it is natural to find an analytical solution to it. Here, we solve for (3.1) and (3.2). However, since we have not systematically learned how to solve for

4 partial differential equation with moving boundary conditions, we only introduce the solutions learned from the references in this project.

For easy understanding, let us denote

ue(eh(τ), τ) = u(h(t), t) If the initial boundary position and the initial temperature distribution are

h(0) = h0 (4.1)

 erf( √x ) u − ∆u 2 t0 , 0 ≤ x ≤ h u(x, 0) = 0 erf(λ) 0 (4.2) uB, x > h0 where 2 Z x erf(x) = √ exp(−s2)ds, (4.3) π 0 λ is the solution of the equation c∆u Ste λexp(λ2)erf(λ) = √ = √ (4.4) L π π

2 2 and t0 = h0 /(4λ ), then the solution of the Stefan problem is: √ h(t) = 2λ t + t0 (4.5)

 erf( √x ) u − ∆u 2 t+t0 , 0 ≤ x ≤ h(t) u(x, t) = 0 erf(λ) (4.6) uB, x > h(t)

The key thing to notice for this analytical solution is that,√ given the initial boundary position and initial temperature distribution, we would√ find h(t) ∝ t. Thus if we were to plot h(t), we would find a graph with similar shape as f(t) = t.

5 Numerical Solution of One Dimensional Heat Equation

We use Matlab to numerically simulate the melting time of an ice slab. In Section 5.1 we explain the algorithm that we use for updating boundary condition and temperature distribution, in Section 5.2 we attach the Matlab code, and in Section 5.3 we solve the Stefan problem with an example.

5.1 Algorithm Setup

We solve the Stefan problem numerically using the Finite Difference Method. For each time step:

1. update the boundary state using explict scheme

h(t + ∆t) − h(t) u(h(t), t) − u(h(t) − ∆x, t) = −Ste (5.1) ∆t ∆t

2. update the temperature distribution using implicit scheme

u(x, t + ∆t) − u(x, t) u(x − ∆x, t + ∆t) − 2u(x, t + ∆t) + u(x + ∆x, t + ∆t) = (5.2) ∆t (∆x)2

5 n n+1 Denote ui = u(xi, tn), ui = u(xi, tn + ∆t), we have

un+1 − un un+1 − 2un+1 + un+1 i i = i−1 i i+1 (5.3) ∆t (∆x)2 ∆t un+1 − c(un+1 − 2un+1 + un+1) = un, c = (5.4) i i−1 i i+1 i (∆x)2

Define

 n+1  n    u1 u1 uA n+1 n n u2  u2  u2         .   .   .   .   .   .  x =  n+1 , b =  n  =   (5.5) u  u  uB  i   k     .   .   .   .   .   .  n+1 n uN uN uB

 1 0 0 0 0 ········· −c (2c + 1) −c 0 0 ·········    0 −c (2c + 1) −c 0 ·········    ......   ......  A =   (5.6)  . . . .   0 . . . 0 1 0 .     ......   ......  0 ············ 0 0 1

x = A\b

At each tn,

n+1 n Ste n n 1. Solve h = h − ∆x ∆t(ui + 1 − ui ) n+1 2. Find xk closest to h 3. Make matrix A

n+1 4. Solve for ui

5.2 Matlab Code

1 f u n c t i o n[u,h,t] = stefan(u0,h0,stef,a,Tmax)

2

3 % u_t= u_xx foru(x,t) on0 <=x <=h(t),u(x>h(t),t)=a

4 % BC:u(0,t)=1 andu(h(t),t)=a

5 %IC:u(x,0)= u0 andh(0)= h0

6

7 i f(h0<=0|h0>1), error(’moving boundary is outside domain’), end

8

9 c f l = 10;

10

11 nx= length(u0);

12 x= linspace(0,1,nx);

13 dx=x(2) −x(1);

14

15 dt= cfl ∗dx^2;

16 t=0:dt:Tmax;

17 nt= length(t);

6 18

19 c= dt/dx^2;

20

21 % Initialize moving boundary position

22 h= zeros(1,nt);

23 h(1) = h0;

24 ih= floor(h0/dx)+1;

25

26 % Initialize temperature

27 u= zeros(nx,nt);

28 u(:,1) = u0;

29

30 f o rj=2:nt

31

32 % Updateh and find lower bound on grid

33 h(j)=h(j −1) − dt ∗ s t e f/dx ∗ (u(ih+1,j −1)−u(ih,j −1) ) ;

34 ih= floor(h(j)/dx)+1;

35

36 % If ih<1, all the ice is melted; if ih>=nx, everything is

37 % frozen

38 i f(ih<1|ih>nx −1) ,

39 d i s p l a y(’Everything is frozen or melted − stopping’)

40 break

41 end

42

43 % MakeA for implicit euler+diffusion step

44 Ad= ones(1,nx);

45 Ad(2:ih)=2 ∗ c+1;

46 Asub= zeros(1,nx −1) ;

47 Asub(1:ih −1) = −c;

48 Asup= zeros(1,nx −1) ;

49 Asup(2:ih) = −c;

50 A= diag(Ad) + diag(Asub, −1) + diag(Asup,+1);

51

52 % Make right hand side

53 b= ones(nx,1);

54 b(2:ih) =u(2:ih,j −1) ;% maybe edge of ice at ih+1?

55 b(ih+1:end) =a;

56

57 % solve foru at current time

58 u(:,j)=A\b;

59

60 end

61

62 f i g u r e

63 subplot(2,1,1)

64 p c o l o r(t,x,u), shading interp

65 c o l o r b a r

66 x l a b e l(’t’)

67 y l a b e l(’x’)

68 s e t(gca,’fontsize’ ,14)

69 t i t l e(’u(x,t)’)

70

71 subplot(2,1,2)

72 p l o t(t,h)

73 g r i d

74 a x i s([0 10 0 1])

75 x l a b e l(’t’)

7 76 y l a b e l(’h’)

77 t i t l e(’h(t)’)

78 s e t(gca,’fontsize’ ,14)

5.3 Simulation of Melting Time in Matlab

We simulate the melting time for solutions to the Stefan problem for 0.4 m of ice slab with the same initial water layer h0 = 0.1 m in the beginning and at the same air temperature u0 = 293 K, but with three different melting temperature uB. For each case, we first find the temperature difference between two phases ∆u, then we calculate the Stefan number Ste with respect to ∆u, and finally we solve for λ using Ste. Note that the commands we input are in dimensionless form, so the actual melting time tm should be

ρcl2 t = t m k where t is the melting time of a given length of ice slab we read from the plot directly.

For the melting process from ice to water, we have the density of water is ρ = 1000 kg/m3, the specific heat of water is c = 4.184 KJ/(kg · K), the thermal conductivity of water at 293 K is k = 0.6 W/(m · K), and the latent heat of water is L = 334 KJ/kg.

4.184×(273−270) Case I: uB = 270 K, Ste = 334 ≈ 0.2881, λ ≈ 0.3631

Figure 3: Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 270 K

When h(tm) = 0.5 m, t < 6 s, we have the actual melting time of 0.4 m of ice slab is

1000 × 4184 × 12 t < × 6 s ≈ 41840000 s m 0.6

4.184×(293−271) Case II: uB = 271 K, Ste = 334 ≈ 0.2756, λ ≈ 0.3558

8 Figure 4: Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 271 K

When h(tm) = 0.5 m, t < 6 s, we have the actual melting time of 0.4 m of ice slab is 1000 × 4184 × 12 t ≈ × 6 s ≈ 41840000 s m 0.6

4.184×(293−272) Case III: uB = 272 K, Ste = 334 ≈ 0.2631, λ ≈ 0.3482

Figure 5: Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 272 K

When h(tm) = 0.5 m, t < 6 s, we have the actual melting time of 0.4 m of ice slab is 1000 × 4184 × 12 t > × 6 s ≈ 41840000 s m 0.6

9 6 Conclusion

We have derived the Stefan problem for a model of ice melting, with simplification onto a one-phase problem on a one-dimensional semi-infinite plane, i.e. only irreversible melting process from ice to water. In addition to analytical solution, we have constructed a numerical model for the simplified problem and solved in Matlab. The main results are discussed in Section 5.3 with Figure 3, Figure 4 and Figure 5.

As illustrated in Figure 3, Figure 4 and Figure 5 respectively,√ the of phase boundary position as a function of time h(t) resembles that of h(t) ∝ t. And if we take a layer of ice with thickness 0.4 m, then it would take much longer time to melt if the given melting temperature is higher.

The reason why we only derive qualitative conclusions, not quantitative ones with respect to the melting time is that the calculated actual melting time tm beyond empirical experience, i.e. too long. Reasons for this mis-simulation may be caused by scaling problem, or by unit conversion. In future study of this project, we will solve quantitatively for the actual melting time. Still, this model is adequate in learning the Stefan problem and deriving a qualitative conclusion about melting process.

10 References

[1] "Stefan problem." Wikipedia. Wikimedia Foundation, 10 May 2017. Web. March 10, 2017. [2] Kurschner, Patrick, et al. "Modelling and Simulation of Ice/Snow Melting". The 22nd ECMI Modelling Week 2008 in Eindhoven (2008). Web. March 10, 2017.

[3] Marek B?asik. Numerical scheme for the one-phase 1D Stefan problem using curvilinear coor- dinates. Scientific Research of the Institute of and Computer Science. pages 9-14, Issue 3, Volume 11, 2012. Web. April 20, 2017. [4] Vasilios Alexiades and Alan D. Solomon. Mathematical modeling of melting and freezing pro- cesses: Basic Concepts & Applications. Taylor & Francis, 1992.

[5] Jonsson, Tobias . "On the one dimensional Stefan problem with some numerical analysis." Thesis. UMEA University, Spring 2013. Web. April 20, 2017. [6] J. Caldwell and Y. Y. Kwan. On the perturbation method for the Stefan problem with time- dependent boundary conditions. International Journal of Heat and Mass Transfer, 46. 2003.

[7] S.C. Gupta. The Classical Stefan Problem - Basic Concepts, Modelling and Analysis, volume 45 of North-Holland Series in Applied Mathematics and Mechanics. Elsevier Science B.V., Amsterdam, 2003. [8] James M. Hill. One-dimensional Stefan Problems: an Introduction, volume 31 of Pitman Mono- graphs and Surveys in Pure and Applied Mathematics Longman Scientic & Technical, Essex, 1987. [9] E. Javierre, C. Vuik, F. J. Vermolen, and S. van der Zwaag. A comparison of numerical models for one-dimensional Stefan problems. J. Comput. Appl. Math. , 192(2):445-459, 2006. [10] Anvarbek M. Meirmanov. The Stefan Problem. De Gruyter expositions in mathematics , 1992.

11 List of Figures

1 Liquid and solid phases with interface h(t) and imposed boundary temperatures.2

2 Liquid and solid phases with interface eh(τ) and imposed boundary temperatures in dimensionless form...... 4

3 Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 270 K ...... 8

4 Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 271 K ...... 9

5 Temperature distribution and phase boundary position as a function of time in dimensionless with melting temperature uB = 272 K ...... 9

12