Site hosted by Angelfire.com: Build your free website today!

Lab 05 Transient Heat Conduction with X-Dependent Source

 

Problem Statement:  Using the Lab05 matlab script as a starting point, fill in the details for transient heat conduction with an x-dependent source of s(x)=0.1*sin((x/L)*pi). For the 32 element grid and Theta=0.5, start with a time step size of 100 seconds and uniformly refine it until the midpoint solution to converges to 1e-4 at the final time of tf=2000 seconds. Repeat for both Theta=0 and Theta=1.0.
Then present a plot of the tfsolution for each value of Theta for a time step of 12.5 seconds, commenting on the accuracy of each solution.
Finally, report and discuss temporal convergence rates in Enorm at the final time for each value of Theta.

 

Solution:  Using the Transient Heat Conduction handout as a reference, the MatLab code was generated to solve the problem statement.

 

After running the code for Theta = 0 (forward TS / Explicit Euler) starting at a time step of 100, I found out that the solution diverged and did not solve.  The magnitudes for the temperature were in the order of E26.  So I didn’t get any good results for theta = 0

 

After running the code for Theta = .5 (backward TS / Implicit Euler) the following spreadsheet was recorded.

  

 

Convergence Table For Theta = .5

 

Distance

Time Step 100

Time Step 50

Time Step 25

Time Step 12.5

Time Step 6.25

 

0

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

 

0.03125

273.001806228521

273.001755400060

273.001730578203

273.001718311785

273.001712214268

 

0.0625

273.003595062074

273.003493894660

273.003444489993

273.003420075289

273.003407938977

 

0.09375

273.005349273215

273.005198741143

273.005125229460

273.005088901598

273.005070843370

 

0.125

273.007051967930

273.006853520907

273.006756610167

273.006708719003

273.006684912770

 

0.15625

273.008686748339

273.008442297519

273.008322921024

273.008263927776

273.008234602806

 

0.1875

273.010237870612

273.009949770190

273.009809077602

273.009739550407

273.009704989115

 

0.21875

273.011690396596

273.011361421135

273.011200767400

273.011121375844

273.011081911073

 

0.25

273.013030337669

273.012663655384

273.012484587685

273.012396096352

273.012352108170

 

0.28125

273.014244789467

273.013843931709

273.013648174566

273.013551435675

273.013503347713

 

0.3125

273.015322056156

273.014890883404

273.014680322066

273.014576267265

273.014524542636

 

0.34375

273.016251763068

273.015794427751

273.015571090038

273.015460721433

273.015405858273

 

0.375

273.017024956618

273.016545863125

273.016311899902

273.016196280402

273.016138807073

 

0.40625

273.017634190529

273.017137952792

273.016895617252

273.016775860337

273.016716330339

 

0.4375

273.018073597545

273.017564994605

273.017316620572

273.017193879566

273.017132866206

 

0.46875

273.018338945936

273.017822875919

273.017570855370

273.017446312336

273.017384403205

 

0.5

273.018427680254

273.017909113194

273.017655873225

273.017530727581

273.017468518898

 

0.53125

273.018338945936

273.017822875919

273.017570855370

273.017446312336

273.017384403205

 

0.5625

273.018073597545

273.017564994605

273.017316620572

273.017193879566

273.017132866206

 

0.59375

273.017634190529

273.017137952792

273.016895617252

273.016775860337

273.016716330339

 

0.625

273.017024956618

273.016545863125

273.016311899902

273.016196280402

273.016138807073

 

0.65625

273.016251763068

273.015794427751

273.015571090038

273.015460721433

273.015405858273

 

0.6875

273.015322056156

273.014890883404

273.014680322066

273.014576267265

273.014524542636

 

0.71875

273.014244789467

273.013843931709

273.013648174566

273.013551435675

273.013503347713

 

0.75

273.013030337669

273.012663655384

273.012484587685

273.012396096352

273.012352108170

 

0.78125

273.011690396596

273.011361421135

273.011200767400

273.011121375844

273.011081911073

 

0.8125

273.010237870612

273.009949770190

273.009809077602

273.009739550407

273.009704989115

 

0.84375

273.008686748339

273.008442297519

273.008322921024

273.008263927776

273.008234602806

 

0.875

273.007051967930

273.006853520907

273.006756610167

273.006708719003

273.006684912770

 

0.90625

273.005349273215

273.005198741143

273.005125229460

273.005088901598

273.005070843370

 

0.9375

273.003595062074

273.003493894660

273.003444489993

273.003420075289

273.003407938977

 

0.96875

273.001806228521

273.001755400060

273.001730578203

273.001718311785

273.001712214268

 

1

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

 

 

 

 

 

 

 

 

 

Change in T @ x = .5

0.000518567060

0.000253239969

0.000125145644

0.000062208683

 

 

 

 

 

 

 

 

 

 

After running the code for Theta = 1 (Trapezoid Rule / Crank - Nicholson) the following spreadsheet was recorded.

 

  

 

Convergence Table For Theta =1

 

Time Step 100

Time Step 50

Time Step 25

Time Step 12.5

Time Step 6.25

Time Step 3.125

0

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

0.03125

273.001888913675

273.001795617964

273.001750409661

273.001728158603

273.001717120507

273.001711623213

0.0625

273.003759636080

273.003573943145

273.003483961921

273.003439674095

273.003417704205

273.003406762559

0.09375

273.005594151134

273.005317849301

273.005183961723

273.005118063644

273.005085373544

273.005069092919

0.125

273.007374791454

273.007010541660

273.006834037140

273.006747163443

273.006704067955

273.006682605144

0.15625

273.009084408501

273.008635718672

273.008418297043

273.008311284370

273.008258198527

273.008231760228

0.1875

273.010706537729

273.010177728991

273.009921484144

273.009795363085

273.009732798133

273.009701638961

0.21875

273.012225557145

273.011621722217

273.011329121929

273.011185107098

273.011113665573

273.011078085607

0.25

273.013626837763

273.012953791904

273.012627654076

273.012467132416

273.012387502337

273.012347844233

0.28125

273.014896884483

273.014161109495

273.013804575012

273.013629092433

273.013542040683

273.013498686369

0.3125

273.016023466063

273.015232047859

273.014848550344

273.014659796840

273.014566161773

273.014519528776

0.34375

273.016995732906

273.016156293276

273.015749526020

273.015549319389

273.015450002764

273.015400540184

0.375

273.017804321549

273.016924944757

273.016498825150

273.016289093493

273.016185051781

273.016133235971

0.40625

273.018441444843

273.017530599768

273.017089231575

273.016871994721

273.016764229903

273.016710559876

0.4375

273.018900966943

273.017967425519

273.017515059357

273.017292409418

273.017181959326

273.017126951955

0.46875

273.019178462398

273.018231215141

273.017772207544

273.017546288758

273.017434217088

273.017378402124

0.5

273.019271258776

273.018319428195

273.017858199656

273.017631187746

273.017518573810

273.017462488780

0.53125

273.019178462398

273.018231215141

273.017772207544

273.017546288758

273.017434217088

273.017378402124

0.5625

273.018900966943

273.017967425519

273.017515059357

273.017292409418

273.017181959326

273.017126951955

0.59375

273.018441444843

273.017530599768

273.017089231575

273.016871994721

273.016764229903

273.016710559876

0.625

273.017804321549

273.016924944757

273.016498825150

273.016289093493

273.016185051781

273.016133235971

0.65625

273.016995732906

273.016156293276

273.015749526020

273.015549319389

273.015450002764

273.015400540184

0.6875

273.016023466063

273.015232047859

273.014848550344

273.014659796840

273.014566161773

273.014519528776

0.71875

273.014896884483

273.014161109495

273.013804575012

273.013629092433

273.013542040683

273.013498686369

0.75

273.013626837763

273.012953791904

273.012627654076

273.012467132416

273.012387502337

273.012347844233

0.78125

273.012225557145

273.011621722217

273.011329121929

273.011185107098

273.011113665573

273.011078085607

0.8125

273.010706537729

273.010177728991

273.009921484144

273.009795363085

273.009732798133

273.009701638961

0.84375

273.009084408501

273.008635718672

273.008418297043

273.008311284370

273.008258198527

273.008231760228

0.875

273.007374791454

273.007010541660

273.006834037140

273.006747163443

273.006704067955

273.006682605144

0.90625

273.005594151134

273.005317849301

273.005183961723

273.005118063644

273.005085373544

273.005069092919

0.9375

273.003759636080

273.003573943145

273.003483961921

273.003439674095

273.003417704205

273.003406762559

0.96875

273.001888913675

273.001795617964

273.001750409661

273.001728158603

273.001717120507

273.001711623213

1

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

273.000000000000

 

 

 

 

 

 

 

 

Change in T @ x = .5

0.000951830581

0.000461228539

0.000227011910

0.000112613936

0.000056085030

 

 

 

 

 

 

 

 

For Theta = 0, which is the Implicit Euler, the code had to be changed.  The max iterations was set to 1 and the time step had to be reduced really really small before it would converge.  It finally converged at 3.125.  The following table was recorded.

 

  

Convergence Table For Theta = 0

 

 

Distance

Time Step 100

Time Step 50

Time Step 25

Time Step 12.5

Time Step 6.25

Time Step 3.125

Time Step 1.5625

0

273.00000

2.7300E+02

2.7300E+02

2.7300E+02

273.0000000

273.0000000

273.0000000

0.03125

-6198398394.20106

-1.2022E+23

-3.9058E+34

-4.0965E+20

273.0069157

273.0069126

273.0069110

0.0625

12341295187.67570

2.3246E+23

7.7103E+34

8.1535E+20

273.0137648

273.0137586

273.0137555

0.09375

-18276259565.34410

-3.2931E+23

-1.1319E+35

-1.2132E+21

273.0204813

273.0204721

273.0204675

0.125

23689031515.28790

4.0444E+23

1.4649E+35

1.5994E+21

273.0270006

273.0269885

273.0269824

0.15625

-28094620911.05710

-4.5314E+23

-1.7636E+35

-1.9701E+21

273.0332599

273.0332449

273.0332374

0.1875

30894016750.94040

4.7266E+23

2.0234E+35

2.3219E+21

273.0391988

273.0391812

273.0391723

0.21875

-31488395907.33360

-4.6254E+23

-2.2423E+35

-2.6513E+21

273.0447603

273.0447401

273.0447300

0.25

29426149966.82190

4.2474E+23

2.4203E+35

2.9552E+21

273.0498907

273.0498682

273.0498569

0.28125

-24546813242.01570

-3.6353E+23

-2.5595E+35

-3.2307E+21

273.0545406

273.0545160

273.0545037

0.3125

17083750199.97740

2.8524E+23

2.6636E+35

3.4750E+21

273.0586652

273.0586388

273.0586255

0.34375

-7695079322.53958

-1.9772E+23

-2.7379E+35

-3.6858E+21

273.0622249

273.0621968

273.0621828

0.375

-2591699479.52627

1.0970E+23

2.7879E+35

3.8612E+21

273.0651853

273.0651559

273.0651412

0.40625

12516002791.10110

-2.9971E+22

-2.8195E+35

-3.9993E+21

273.0675179

273.0674875

273.0674723

0.4375

-20777166320.20460

-3.3500E+22

2.8378E+35

4.0990E+21

273.0692003

273.0691691

273.0691535

0.46875

26247038577.11340

7.4335E+22

-2.8470E+35

-4.1592E+21

273.0702163

273.0701846

273.0701688

0.5

-28160536780.63160

-8.8421E+22

2.8497E+35

4.1793E+21

273.0705561

273.0705242

273.0705083

0.53125

26247038577.11340

7.4335E+22

-2.8470E+35

-4.1592E+21

273.0702163

273.0701846

273.0701688

0.5625

-20777166320.20460

-3.3500E+22

2.8378E+35

4.0990E+21

273.0692003

273.0691691

273.0691535

0.59375

12516002791.10110

-2.9971E+22

-2.8195E+35

-3.9993E+21

273.0675179

273.0674875

273.0674723

0.625

-2591699479.52627

1.0970E+23

2.7879E+35

3.8612E+21

273.0651853

273.0651559

273.0651412

0.65625

-7695079322.53958

-1.9772E+23

-2.7379E+35

-3.6858E+21

273.0622249

273.0621968

273.0621828

0.6875

17083750199.97740

2.8524E+23

2.6636E+35

3.4750E+21

273.0586652

273.0586388

273.0586255

0.71875

-24546813242.01570

-3.6353E+23

-2.5595E+35

-3.2307E+21

273.0545406

273.0545160

273.0545037

0.75

29426149966.82200

4.2474E+23

2.4203E+35

2.9552E+21

273.0498907

273.0498682

273.0498569

0.78125

-31488395907.33370

-4.6254E+23

-2.2423E+35

-2.6513E+21

273.0447603

273.0447401

273.0447300

0.8125

30894016750.94050

4.7266E+23

2.0234E+35

2.3219E+21

273.0391988

273.0391812

273.0391723

0.84375

-28094620911.05710

-4.5314E+23

-1.7636E+35

-1.9701E+21

273.0332599

273.0332449

273.0332374

0.875

23689031515.28790

4.0444E+23

1.4649E+35

1.5994E+21

273.0270006

273.0269885

273.0269824

0.90625

-18276259565.34410

-3.2931E+23

-1.1319E+35

-1.2132E+21

273.0204813

273.0204721

273.0204675

0.9375

12341295187.67570

2.3246E+23

7.7103E+34

8.1535E+20

273.0137648

273.0137586

273.0137555

0.96875

-6198398394.20107

-1.2022E+23

-3.9058E+34

-4.0965E+20

273.0069157

273.0069126

273.0069110

1

273.00000

2.7300E+02

2.7300E+02

2.7300E+02

273.0000000

273.0000000

273.0000000

 

 

 

 

 

 

 

 

 

Change in T @ x = .5

8.8421E+22

-2.8497E+35

2.8497E+35

4.1793E+21

0.0000318

0.0000159

 

 

 

 

 

 

 

 

 

 

 

To see a plot of the tf solution for each value of Theta for a time step of 12.5 click here.  Note:  Since the Theta = 0 solution didn’t converge at T.S 12.5 it wasn’t added to the graph.

 

The temporal convergence rates for all three methods are tabulated in the tables below.  The slope for the temporal convergence is related to

the equation Ct Dtf(o).  Where f(Q) is 1 for Implicit and Explicit Euler and 2 for Crank Nicholson.  So the slope for Implicit and Explicit Euler should be equal to one in the adequate mesh region and Crank Nicholson should be equal to 2 in the adequate mesh region.  One can see this in the results below.

 

                                                                                   

                                                                                 Temporal Convergence Rates For Theta = 0, .5, 1

  

 

 

 

 

 

 

 

 

 

 

 

 

Explicit Euler Theta = 0 Convergence Table

 

 

Time Step

Qh

eh/2

mh/4

 

th  

100

-2.816054E+10

 

 

 

th/2

50

-8.8421E+22

-8.8421E+22

 

 

th/4

25

2.8497E+35

2.8497E+35

#NUM!

 

th/8

12.5

4.1793E+21

-2.8497E+35

#NUM!

 

th/16

6.25

273.0705561

-4.1793E+21

4.5955E+01

 

th/32

3.125

273.0705242

-3.1826E-05

8.6763E+01

 

th/64

1.5625

273.0705083

-1.5902E-05

1.0010E+00

 

 

 

 

 

 

 

 

 

 

 

 

 

Crank - Nicholson Theta = .5 Convergence Table

 

 

 

Qh

eh/2

mh/4

 

th  

100

273.01842768

 

 

 

th/2

50

273.01790911

-0.00051857

 

 

th/4

25

273.01765587

-0.00025324

2.068050887

 

th/8

12.5

273.01753073

-0.00012515

2.033794097

 

th/16

6.25

273.01746852

-0.00006221

2.016840413

 

 

 

 

 

 

 

Implicit Euler Theta = 1 Convergence Table

 

 

 

Qh

eh/2

mh/4

 

th  

100

273.019271258776

 

 

 

th/2

50

273.018319428195

-0.000951830581

 

 

th/4

25

273.017858199656

-0.000461228539

1.045223023

 

th/8

12.5

273.017631187746

-0.000227011910

1.022713795

 

th/16

6.25

273.017518573810

-0.000112613936

1.011382617

 

th/32

3.125

273.017462488780

-0.000056085030

1.005697724

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Conclusion:  From the temporal convergence results you can see that the Explicit and Implicit Euler had a slope of 1 where as the Crank – Nicholson had a slope of 2.  The Explicit Euler didn’t require any iteration, which is good but it took a very very small time step for it to converge.  From the comparison graph at a time step of 12.5 both the Crank Nicholson and Implicit Euler converged very nicely.  They converged to almost exactly the same answer but depending on if you want time accurate results or steady state results their accuracies are different.  If you want a time accurate solution Crank – Nicholson will give you the most time accurate results where as the Implicit Euler will give you the most accurate Steady State Results.