Numerical Methods for Engineers
Numerical Methods for Engineers
7th Edition
ISBN: 9780073397924
Author: Steven C. Chapra Dr., Raymond P. Canale
Publisher: McGraw-Hill Education
Question
Book Icon
Chapter 20, Problem 6P
To determine

To calculate: The thermocline depth and the flux across the interface by the use of a cubic spline fit where k=0.02cal/scm°C and heat flux from the surface can be calculated from Fourier’s law as J=kdTdzandd2Tdz2=0.The table is given as,

Depth, m 0 0.5 1.0 1.5 2.0 2.5 3.0
Temperature, Celsius 70 68 55 22 13 11 10

The provided graph shows the relationship between depth and temperature as,

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  1

Expert Solution & Answer
Check Mark

Answer to Problem 6P

Solution:

The value of thermocline depth and the flux across the interface is 72.18°C/mand0.014436cal/cm2s respectively.

Explanation of Solution

Given Information:

The table is given as,

Depth, m 0 0.5 1.0 1.5 2.0 2.5 3.0
Temperature, Celsius 70 68 55 22 13 11 10

The provided graph shows the relationship between depth and temperature as,

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  2

Calculation:

Consider the Fourier’s law,

J=kdTdz …… (1)

The value of k=0.02cal/scm°C is given. Therefore, it is required to calculate dTdz.

From the graph, this can be interpreted that curve has zero slope at z=1.2m.

Since, the cubic spline fit is required, so this problem can be solved by the Excel VBA(Visual Basic for applications). The steps are,

Step 1. Insert the data in excel as shown below,

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  3

Step 2. Press ALT+F11 and write the code as shown below,

OptionExplicit

SubSplines()

'nop and u is declared as integer type variable.

Dim u AsInteger,nopAsInteger

'arrayArr_x, Arr_y, fder, js, fder, sder and ms is declare as double type variable.

DimArr_x(100)AsDouble,Arr_y(100)AsDouble,jsAsDouble,msAsDouble

DimfderAsDouble,sderAsDouble

'rp is declared as variant.

DimrpAsVariant

'5th row is selected.

Range("a5").Select

'store the value of 5th row in nop.

nop=ActiveCell.Row

'last shell of excel is selected.

Selection.End(xlDown).Select

'store the value of last shell in nop.

nop=ActiveCell.Row-nop

'5th row is selected.

Range("a5").Select

'for loop is run uptonop.

For u =0Tonop

'store the value in array x.

Arr_x(u)=ActiveCell.Value

ActiveCell.Offset(0,1).Select

'store the value in array y.

Arr_y(u)=ActiveCell.Value

ActiveCell.Offset(1,-1).Select

'u value is increamented.

Next u

'5th row of column is selected.

Range("c5").Select

Range("c5:d1005").ClearContents

'for loop is run uptonop.

For u =0Tonop

'spline function is call.

CallSpline(Arr_x(),Arr_y(),nop,Arr_x(u),ms,fder,sder)

'first derivative value is stored.

ActiveCell.Value=fder

ActiveCell.Offset(0,1).Select

'second derivative value is stored.

ActiveCell.Value=sder

ActiveCell.Offset(1,-1).Select

'value is incremented by 1.

Next u

Do

'thismsg is asked from user.

rp=MsgBox("Do you want to interpolate?",vbYesNo)

'if condition is to check the value.

Ifrp=vbNoThenExitDo

js=InputBox("z = ")

'Spline function is called

CallSpline(Arr_x(),Arr_y(),nop,js,ms,fder,sder)

MsgBox"For z = "&js&Chr(13)&"T = "&ms&Chr(13)& _

"dT/dz = "&fder&Chr(13)&"d2T/dz2 = "&sder

'loop is ended.

Loop

'function is ended.

EndSub

'spline function is defined.

SubSpline(Arr_x,Arr_y,nop,js,ms,fder,sder)

'arraye,f,g,r and d2x is declared as double type

Dim e(100)AsDouble, f(100)AsDouble, g(100)AsDouble, r(100)AsDouble, d2x(100)AsDouble

'tridiag function is called.

CallTridiag(Arr_x,Arr_y,nop, e, f, g, r)

'decomp function is called.

CallDecomp(e(), f(), g(),nop-1)

'Substite function is called.

CallSubstit(e(), f(), g(), r(),nop-1, d2x())

'interpolation function is abbreviated as interpol.

CallInterpol(Arr_x,Arr_y,nop, d2x(),js,ms,fder,sder)

'function is ended.

EndSub

'Tridiag definition is given.

SubTridiag(Arr_x,Arr_y,nop, e, f, g, r)

'u is declare the variable as integer type.

Dim u AsInteger

'f(1),g(1) and r(1)value is calculated.

f(1)=2*(Arr_x(2)-Arr_x(0))

g(1)=Arr_x(2)-Arr_x(1)

r(1)=6/(Arr_x(2)-Arr_x(1))*(Arr_y(2)-Arr_y(1))

r(1)= r(1)+6/(Arr_x(1)-Arr_x(0))*(Arr_y(0)-Arr_y(1))

'for loop is run upto nop-2.

For u =2Tonop-2

e(u)=Arr_x(u)-Arr_x(u -1)

f(u)=2*(Arr_x(u +1)-Arr_x(u -1))

g(u)=Arr_x(u +1)-Arr_x(u)

r(u)=6/(Arr_x(u +1)-Arr_x(u))*(Arr_y(u +1)-Arr_y(u))

r(u)= r(u)+6/(Arr_x(u)-Arr_x(u -1))*(Arr_y(u -1)-Arr_y(u))

'value is incremented by 1.

Next u

'e(nop-1)value is calculated.

e(nop-1)=Arr_x(nop-1)-Arr_x(nop-2)

'f(nop-1)value is calculated.

f(nop-1)=2*(Arr_x(nop)-Arr_x(nop-2))

'r(nop-1)value is calculated.

r(nop-1)=6/(Arr_x(nop)-Arr_x(nop-1))*(Arr_y(nop)-Arr_y(nop-1))

r(nop-1)= r(nop-1)+6/(Arr_x(nop-1)-Arr_x(nop-2))*(Arr_y(nop-2)-Arr_y(nop-1))

'function is ended.

EndSub

'Interpol is defined.

SubInterpol(Arr_x,Arr_y,nop, d2x,js,ms,fder,sder)

'u and flag is declared the variable as integer type

Dim u AsInteger, flag AsInteger

'variable C1,C2,C3 and C4 is declared as double type

Dim C1 AsDouble, C2 AsDouble, C3 AsDouble, C4 AsDouble

'variable T1,T2,T3 and T4 is declared as double type

Dim T1 AsDouble, T2 AsDouble, T3 AsDouble, T4 AsDouble

'flag and u is initialised as 0.

flag=0

u =1

Do

'if statement is to check the condition.

Ifjs>=Arr_x(u -1)Andjs<=Arr_x(u)Then

'C1 is calculated.

C1 =d2x(u -1)/6/(Arr_x(u)-Arr_x(u -1))

'C2 is calculated.

C2 =d2x(u)/6/(Arr_x(u)-Arr_x(u -1))

'C3 is calculated.

C3 =Arr_y(u -1)/(Arr_x(u)-Arr_x(u -1))- d2x(u -1)*(Arr_x(u)-Arr_x(u -1))/6

'C4 is calculated.

C4 =Arr_y(u)/(Arr_x(u)-Arr_x(u -1))- d2x(u)*(Arr_x(u)-Arr_x(u -1))/6

'T1 is calculated.

T1 = C1 *(Arr_x(u)-js)^3

'T2 is calculated.

T2 = C2 *(js-Arr_x(u -1))^3

'T3 is calculated.

T3 = C3 *(Arr_x(u)-js)

'T4 is calculated.

T4 = C4 *(js-Arr_x(u -1))

'ms is calculated.

ms= T1 + T2 + T3 + T4

'T1 is calculated.

T1 =-3* C1 *(Arr_x(u)-js)^2

'T2 is calculated.

T2 =3* C2 *(js-Arr_x(u -1))^2

'T3 is calculated.

T3 =-C3

'T4 is calculated.

T4 = C4

'fder value is calculated.

fder= T1 + T2 + T3 + T4

'T1 and T2 is calculated.

T1 =6* C1 *(Arr_x(u)-js)

T2 =6* C2 *(js-Arr_x(u -1))

'second derivative sder is calculated.

sder= T1 + T2

'flag is equal to 1

flag=1

Else

u = u +1

EndIf

'if statement is to check the calculated value.

If u =nop+1Or flag =1ThenExitDo

Loop

'flag is checked

If flag =0Then

'if condition is fulfil then output the msg.

MsgBox"outside range"

'loop is ended.

End

'end statement.

EndIf

'function is ended.

EndSub

'Decomp function definition is given.

SubDecomp(e, f, g,nop)

'k is declared as integer

Dim k AsInteger

'for loop is run uptonop.

For k =2Tonop

e(k)= e(k)/ f(k -1)

f(k)= f(k)- e(k)* g(k -1)

'k is increased by 1.

Next k

'function is ended.

EndSub

'substit definition is given.

SubSubstit(e, f, g, r,nop,Arr_x)

'k is declared as integer type.

Dim k AsInteger

'for loop is run uptonop.

For k =2Tonop

r(k)= r(k)- e(k)* r(k -1)

'k is increased.

Next k

'Arr_x(nop)value is calculated.

Arr_x(nop)= r(nop)/ f(nop)

'for loop is run uptoArr_x(k)

For k =nop-1To1Step-1

Arr_x(k)=(r(k)- g(k)*Arr_x(k +1))/ f(k)

' k is increased by 1

Next k

' function is ended.

EndSub

PrivateSubWorksheet_SelectionChange(ByVal Target As Range)

EndSub

Step 3. Press RUN then this dialog box appears.

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  4

Step 4. Enter the value of z.

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  5

Step 5. This output will appear.

Numerical Methods for Engineers, Chapter 20, Problem 6P , additional homework tip  6

Thus, the value of dTdz is 72.18. Substitute this value in equation (1),

J=0.02(72.18)100=0.014436cal/cm2s

Hence, the value of thermocline depth and the flux across the interface is 72.18°C/mand0.014436cal/cm2s respectively.

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!

Chapter 20 Solutions

Numerical Methods for Engineers

Ch. 20 - Prob. 11PCh. 20 - The molecular weight of a polymer can be...Ch. 20 - 20.13 On average, the surface area A of human...Ch. 20 - 20.14 Determine an equation to predict metabolism...Ch. 20 - 20.15 Human blood behaves as a Newtonian fluid...Ch. 20 - 20.16 Soft tissue follows an exponential...Ch. 20 - 20.17 The thickness of the retina changes during...Ch. 20 - 20.18 The data tabulated below were generated from...Ch. 20 - The shear stresses, in kilopascals (kPa), of nine...Ch. 20 - 20.20 A transportation engineering study was...Ch. 20 - The saturation concentration of dissolved oxygen...Ch. 20 - For the data in Table P20.21, use polynomial...Ch. 20 - 20.23 Use multiple linear regression to derive a...Ch. 20 - 20.24 As compared to the models from Probs. 20.22...Ch. 20 - 20.25 In water-resources engineering, the sizing...Ch. 20 - 20.26 The concentration of total phosphorus and...Ch. 20 - 20.27 The vertical stress under the corner of a...Ch. 20 - Three disease-carrying organisms decay...Ch. 20 - 20.29 The mast of a sailboat has a cross-sectional...Ch. 20 - 20.30 Enzymatic reactions are used extensively to...Ch. 20 - 20.31 Environmental engineers dealing with the...Ch. 20 - An environmental engineer has reported the data...Ch. 20 - The following model is frequently used in...Ch. 20 - 20.34 As a member of Engineers Without Borders,...Ch. 20 - 20.35 Perform the same computations as in Sec....Ch. 20 - 20.36 You measure the voltage drop V across a...Ch. 20 - Duplicate the computation for Prob. 20.36, but use...Ch. 20 - The current in a wire is measured with great...Ch. 20 - 20.39 The following data was taken from an...Ch. 20 - It is known that the voltage drop across an...Ch. 20 - Ohms law states that the voltage drop V across an...Ch. 20 - 20.42 Repeat Prob. 20.41 but determine the...Ch. 20 - 20.43 An experiment is performed to determine the...Ch. 20 - Bessel functions often arise in advanced...Ch. 20 - 20.45 The population of a small community on the...Ch. 20 - Based on Table 20.4, use linear and quadratic...Ch. 20 - 20.47 Reproduce Sec. 20.4, but develop an equation...Ch. 20 - 20.48 Dynamic viscosity of water is related to...Ch. 20 - 20.49 Hooke’s law, which holds when a spring is...Ch. 20 - 20.50 Repeat Prob. 20.49 but fit a power curve to...Ch. 20 - The distance required to stop an automobile...Ch. 20 - An experiment is performed to define the...Ch. 20 - The acceleration due to gravity at an altitude y...Ch. 20 - The creep rate is the time rate at which strain...Ch. 20 - 20.55 It is a common practice when examining a...Ch. 20 - The relationship between stress and the shear...Ch. 20 - The velocity u of air flowing past a flat surface...Ch. 20 - 20.58 Andrade’s equation has been proposed as a...Ch. 20 - Develop equations to fit the ideal specific heats...Ch. 20 - 20.60 Temperatures are measured at various points...Ch. 20 - 20.61 The data below were obtained from a creep...
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Functions and Change: A Modeling Approach to Coll...
Algebra
ISBN:9781337111348
Author:Bruce Crauder, Benny Evans, Alan Noell
Publisher:Cengage Learning
Text book image
Mathematics For Machine Technology
Advanced Math
ISBN:9781337798310
Author:Peterson, John.
Publisher:Cengage Learning,