EES Integration Example 3.2-1a

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10
At a glance
Powered by AI
The document discusses modeling the temperature of bronze pieces during an oven brazing process using lumped capacitance analysis and numerical methods.

The lumped capacitance assumption ignores internal temperature variations and is appropriate when the Biot number is small (<0.1). It was shown to be valid for this problem with a maximum Biot number of 0.004.

Temperature can be modeled using numerical methods like Heun's method or by solving the governing differential equation with MATLAB's ode45 solver function.

EXAMPLE 3.

2-1(a): Oven Brazing (EES)


A brazing operation is carried out in an oven. The metal pieces to be brazed have a complex geometry; they are made of bronze (with k = 50 W/m-K, c = 500 J/kg-K, and = 8700 kg/m3) and have a total volume V = 10 cm3 and total surface area As = 35 cm2. The pieces are heated by radiation heat transfer from the walls of the oven. A detailed presentation of radiation heat transfer is presented in Chapter 10. For this problem, assume that the emissivity of the surface of the piece is = 0.8 and that the wall of the oven is black. In this limit, the radiation heat transfer rad ) may be written as: from the wall to the piece ( q

rad = As (Tw4 T 4 ) q
where Tw is the temperature of the wall, T is the temperature of the surface of the piece, and is Stefan-Boltzmans constant. The temperature of the oven wall is increased at a constant rate = 1 K/s from its initial temperature Tini = 20C to its final temperature Tf = 470C which is held for thold = 1000 s before the temperature of the wall is reduced at the same constant rate back to its initial temperature. The pieces and the oven are initially in thermal equilibrium at Tt=0 = Tini. a.) Is the lumped capacitance assumption appropriate for this problem? The inputs are entered in EES.
"EXAMPLE 3.2-1(a): Oven Brazing (EES)" $UnitSystem SI MASS RAD PA K J $TABSTOPS 0.2 0.4 0.6 0.8 3.5 in "Inputs" V=10 [cm^3]*convert(cm^3,m^3) A_s=35 [cm^2]*convert(cm^2,m^2) e=0.8 [-] T_ini=converttemp(C,K,20 [C]) T_f=converttemp(C,K,470 [C]) t_hold=1000 [s] beta=1 [K/s] c=500 [J/kg-K] k=50 [W/m-K] rho=8700 [kg/m^3]

"volume" "surface area" "emissivity of surface" "initial temperature" "final oven temperature" "oven hold time" "oven ramp rate" "specific heat capacity" "conductivity" "density"

The lumped capacitance assumption ignores the internal resistance to conduction as being small relative to the resistance to heat transfer from the surface of the object. The radiation heat transfer coefficient, defined in Section 1.2.6, is:

hrad = (Ts2 + Tw2 )(Ts + Tw )


where Ts is the surface temperature of the object. The Biot number defined based on this radiation heat transfer coefficient is:

Bi =
where

hrad Lcond k

Lcond =

V As

The Biot number is largest (and therefore the lumped capacitance model is least justified) when the value of hrad is largest which occurs if both Ts and Tw achieve their maximum possible value (Tf).
h_rad_max=sigma#*e*(T_f^2+T_f^2)*(T_f+T_f) L_cond=V/A_s Bi=h_rad_max*L_cond/k "maximum radiation coefficient" "characteristic length for conduction" "maximum Biot number"

The Biot number is calculated to be 0.004 at this upper limit, which indicates that the lumped capacitance assumption is valid. b.) Calculate a lumped capacitance time constant that characterizes the brazing process. It is useful to calculate a time constant even when the problem is solved numerically. The value of the time constant provides guidance relative to the time step that will be required and it also allows a sanity check on your results. The time constant, discussed in Section 3.1.4, is the product of the thermal capacitance of the object and the net resistance from the surface. Using the concept of the radiation coefficient allows the time constant to be written as:

lumped =

V c hrad As

The minimum value of the time-constant (again, corresponding to the object and the oven wall being at their maximum temperature) is computed in EES:
tau=rho*c*V/(h_rad_max*A_s) "time constant"

and found to be 167 s. c.) Develop a numerical solution based on Heuns method that predicts the temperature of the object for 3000 s after the oven is activated. A function T_w is defined which returns the wall temperature as a function of time; the function is placed at the top of the EES file.
"Oven temperature function" function T_w(time,T_ini,T_f,beta,t_hold) "INPUTS:

time - time relative to initiation of process (s) T_ini - initial temperature (K) T_f - final temperature (K) beta - ramp rate (K/s) t_hold - hold time (s) OUTPUTS T_w - wall temperature (K)" T_w=T_ini+beta*time t_ramp=(T_f-T_ini)/beta if (time>t_ramp) then T_w=T_f endif if (time>(t_ramp+t_hold)) then T_w=T_f-beta*(time-t_ramp-t_hold) endif if (time>(2*t_ramp+t_hold)) then T_w=T_ini endif end "temperature of wall during ramp up period" "duration of ramp period" "temperature of wall during hold period"

"temperature during ramp down period"

"temperature after ramp down period"

Note the use of the if-then-endif statements to activate different functions for the wall temperature based on the time of the simulation. The function T_w be called from the Equation Window:
T_w=T_w(time,T_i,T_f,beta,tau_hold)

It is wise to check that the function is working correctly by setting up a parametric table that includes time and the wall temperature; the result is shown in Figure 1.
800 700 Wall temperature (K) 600 500 400 300 200 0

500

1000

1500 Time (s)

2000

2500

3000

Figure 1: Oven wall temperature as a function of time.

The simulation time and number of time steps are defined and used to compute the time and wall temperature at each time step:
t_sim=3000 [s] M=101 [-] DELTAt=t_sim/(M-1) duplicate j=1,M time[j]=(j-1)*t_sim/(M-1) T_w[j]=T_w(time[j],T_ini,T_f,beta,t_hold) "simulation time" "number of time-steps" "time-step duration" "time" "wall temperature"

end

The governing equation is obtained from an energy balance on the piece:

rad = q
or

dU dt

As (Tw4 T 4 ) = V c

dT dt

(1)

Rearranging Eq. (1) leads to the state equation that provides the time rate of change of the temperature:
4 4 dT As (Tw T ) = dt V c

(2)

The temperature at the beginning of the first time step is the initial condition:

T1 = Tini
T[1]=T_ini "initial temperature"

Heun's method consists of an initial, predictor step:

= T + dT T j +1 j dt

t
T =T j ,t =t j

(3)

Substituting the state equation, Eq. (2), into Eq. (3) leads to:

dT dt
The corrector step is:

=
T =T j ,t = t j

As Tw4,t =t j T j4 V c

dT T j +1 = T j + dt

+
T =T j ,t = t j

dT dt

t ,t =t 2 T =T j +1 j +1

where

dT dt

=
,t = t T =T j +1 j +1

4 As Tw4,t =t j+1 T j +1

V c

Heuns method is implemented in EES:


T[1]=T_ini "initial temperature" duplicate j=1,(M-1) dTdt[j]=e*A_s*sigma#*(T_w[j]^4-T[j]^4)/(rho*V*c) "Temperature rate of change at the beginning of the time-step" T_hat[j+1]=T[j]+dTdt[j]*DELTAt "Predictor step" dTdt_hat[j+1]=e*A_s*sigma#*(T_w[j+1]^4-T_hat[j+1]^4)/(rho*V*c) "Temp. rate of change at the end of the time-step" T[j+1]=T[j]+(dTdt[j]+dTdt_hat[j+1])*DELTAt/2 "Corrector step" end

The solution for 100 time steps is shown in Figure 2.


800 700 Temperature (K) 600 500 400 300 200 0 Heun's method EES Integral function th (every 10 point)

Oven wall temperature 500 1000 1500 Time (s) 2000 2500 3000

Figure 2: Oven wall and piece temperature as a function of time, predicted by Heuns method with 100 time steps and using EES built-in Integral function.

Note that the piece temperature lags the oven wall temperature by 100s of seconds, which is consistent with the time constant calculated in (b). d.) Develop a numerical solution using EES Integral function that predicts the temperature of the object for 3000 s after the oven is activated. The adaptive time step algorithm is used within EES Integral function and an integral table is created that holds the results of the integration:
"EES' Integral function" dTdt=e*A_s*sigma#*(T_w(time,T_ini,T_f,beta,t_hold)^4-T^4)/(rho*V*c) T=T_ini+INTEGRAL(dTdt,time,0,t_sim) "Call EES' Integral function" $IntegralTable time, T

The results are included in Figure 2 and agree with Heuns method; note that only 1 out of every 10 points are included in the EES solution in order to show the results of the adaptive step-size.

EXAMPLE 3.2-1(b): Oven Brazing (MATLAB)


Repeat EXAMPLE 3.2-1 using MATLAB rather than EES to do the calculations. a.) Develop a numerical solution that is based on Heuns method and implemented in MATLAB that predicts the temperature of the object for 3000 s after the oven is activated. The solution will be obtained in a function Oven_brazing that can be called from the command space. The function will accept the number of time steps (M) and the total simulation time (tsim) and return three arrays that are the values of time, and the wall and surface temperatures at each time step.
function [time, T_w, T]=Oven_Brazing(M, t_sim) % EXAMPLE 3.2-1(b) Oven Brazing % INPUTS % M - number of time steps (-) % t_sim - duration of simulation (s) % OUTPUTS % time - array with the values of time for each time step (s) % T_w - array containing values of the wall temperature at each time (K) % T - array containing values of the surface temperature at each time (K)

Next, the known information from the problem statement is entered into the function.
%Known information V=10/100000; A_s=35/1000; e=0.8; T_ini=293.15; T_f=743.15; t_hold=1000; beta=1; c=500; k=50; rho=8700; sigma=5.67e-8; % volume (m^3) % surface area (m^2) % emissivity of surface (-) % initial temperature (K) % final oven temperature (K) % oven hold temperature (s) % oven ramp rate (K/s) % specific heat capacity (J/kg-K) % conductivity (W/m-K) % density (kg/m^3) % Stefan-Boltzmann constant (W/m^2-K^4)

A function is needed to return the wall temperature as a function of time. The following code implements this function. Place this function at the bottom of the file, after an end statement that terminates the function Oven_Brazing.
function[T_w]=T_wf(time, T_ini, T_f, beta, t_hold) % Oven temperature function % Inputs % time - current time value (s) % T_ini - initial value of the wall (K) % T_f - final value of the wall (K)

% beta - rate of increase in temperature of the wall (K/s) % t_hold - time period in which the wall temperature is held constant (s) % Output % T_w - wall temperature at specfied time (K) T_w=T_ini+beta*time; t_ramp=(T_f-T_ini)/beta; if (time>t_ramp) T_w=T_f; end if (time>(t_ramp+t_hold)) T_w=T_f-beta*(time-t_ramp-t_hold); end if (time>(2*t_ramp+t_hold)) T_w=T_ini; end end

Note the use of the if-end clauses to activate different functions for the wall temperature based on the time of the simulation. The temperature of the wall at any time can be evaluated by a call to the function T_w. The following lines fill the time and T_w vectors with the values of time and the wall temperature at each time step.
DELTAt=t_sim/(M-1); % time step duration for j=1:M time(j)=(j-1)*t_sim/(M-1); % value of time for each step T_w(j)=T_wf(time(j),T_ini,T_f,beta,t_hold); % value of the wall temperature at each step end

The last task is to enter the equations that implement Heuns method for solving the differential equation. The governing equation is obtained from an energy balance on the piece:

rad = As (Tw4 T 4 ) = V c q
or
4 4 dT As (Tw T ) = dt V c

dT dt

(1)

Heuns method consists of an initial, predictor step:


= T + dT T j +1 j dt

T =T j ,t =t j

where:

dT dt
The corrector step is:

=
T =T j ,t = t j

As Tw4,t =t j T j4 V c

dT T j +1 = T j + dt

+
T =T j ,t = t j

dT dt

t ,t =t 2 T =T j +1 j +1

where, from Eq. (1),

dT dt

=
T =T j*+1 ,t = t j +1

4 As Tw4,t =t j+1 T j +1

V c

The following equations implement Heuns method in MATLAB:


T(1)=T_ini; for j=1:(M-1) dTdt=e*A_s*sigma*(T_w(j)^4-T(j)^4)/(rho*V*c); T_hat=T(j)+dTdt*DELTAt; dTdt_hat=e*A_s*sigma*(T_w(j+1)^4-T_hat^4)/(rho*V*c); T(j+1)=T(j)+(dTdt+dTdt_hat)*DELTAt/2; end

%Temp deriv. at the start of the time step %Predictor step %deriv. at end of time step %Corrector step"

The Oven_Brazing function is terminated with an end statement and saved.


end

The function can now be called from the command window


>> [time, T_w, T]=Oven_Brazing(101, 3000);

The temperature of the wall and the piece is shown in Figure 1.


800 700 Temperature (K) 600 500 400 300 200 0 piece
Heun's method ode45 solver oven wall temp.

oven wall 500 1000 1500 2000 Time (s) 2500 3000

Figure 1: Temperature of the wall and work piece, predicted using Heun's method and the ode45 solver, as a function of time

b.) Develop a numerical solution using MATLABs ode45 function that predicts the temperature of the object for 3000 s after the oven is activated. The ode solvers are designed to call a function the returns the derivative of dependent variable with respect to the independent variable. In our case, the dependent variable is the temperature of the work piece and time is the independent variable. A function must be provided that returns the time derivative of the temperature at a specified time and temperature. The MATLAB function dTdt_f accepts all of the input parameters that are needed to determine the derivative; according to Eq. (1), these include As, , , V, , and c as well as parameters needed determine the wall temperature at any time. Place the function dTdt_f below the function T_wf. Note that the function dTdt_f calls the function T_wf in order to determine the wall temperature at a specified time.
function[dTdt]=dTdt_f(time,T,e,A_s,rho,V,c,T_f,T_ini,beta,t_hold) % dTdt is called by the ode45 solver to evaluate the derivative dTdt % INPUTS % time - time relative to start of process (s) % T - temperature of piece (K) % e - emissivity of piece (-) % A_s - surface area of piece (m^2) % rho - density (kg/m^3) % V - volume of piece (m^3) % c - specific heat capacity of piece (J/kg-K) % T_f - final oven temperature (K) % T_ini - initial oven temperature (K) % beta - oven ramp rate (K/s) % t_hold - oven hold time (s) % OUTPUTS % dTdt - rate of change of temperature of the piece (K/s) sigma=5.67e-8; % Stefan-Boltzmann constant (W/m^2-K^4) T_w=T_wf(time, T_ini, T_f, beta, t_hold); % wall temperature dTdt=e*A_s*sigma*(T_w^4-T^4)/(rho*V*c); % energy balance end

Now, all that is necessary is to comment out the code in the function Oven_brazing from part (a) and instead call the MATLAB ode45 solver function to determine the temperatures as a function of time.
% T(1)=T_ini; % for j=1:(M-1) % dTdt=e*A_s*sigma*(T_w(j)^4-T(j)^4)/(rho*V*c); % T_hat=T(j)+dTdt*DELTAt; % dTdt_hat=e*A_s*sigma*(T_w(j+1)^4-T_hat^4)/(rho*V*c); % T(j+1)=T(j)+(dTdt+dTdt_hat)*DELTAt/2; % end %Solution determined by ode solver [time, T]=ode45(@(time,T) dTdt_f(time,T,e,A_s,rho,V,c,T_f,T_ini,beta,t_hold),time,T_ini);

The time span for the integration is provided by supplying the time array to the ode45 function. As a result, MATLAB will evaluate the temperatures at the same times as were used with Heuns method. A plot of the ode solver results (identified with circles) is superimposed onto the results obtained using Heun's method in Figure 1.

You might also like