kill(all)$

heat :boundary conditions (convection:h1,Tinf1,convection:h2,Tinf2),example2, final,version 1.0
peter.vlasschaert@gmail.com,10/07/2019

example : flow heat x-direction

When T must be function of x : T(x)
-----------------------------------------------
steady state : independent of time.

depends(T,x);

dependencies;

p1:ev(1/r^n*diff(r^n*diff(T,r),r) +g(r)/k= 0,r=x,n=0);

example 2
given : volumetric heat generation g(x) = a*x+b,
in a wall with tickness L
lhs wall: h1, Tinf1 : ambient air (outside building)
rhs wall:h2,  Tinf2 : ambient air (inside building)
k,a,b = constant
=====================================
rem :  + direction flow (ic,bc)
flow : lhs inside    the wall
          rhs outside the wall

solution:

mathematical formulation of the problem.

1e) boundary condition : lhs   (x=0)
------------------------------------------------

p2a:-k*diff(T,x) = h1*(Tinf1-T);

p2a1:-1*p2a/k;

2e) boundary condition : rhs   (x=L)
------------------------------------------------

bc:rhs: h: heat transfer coef,given T ambient air = Tinf

p2b:-k*diff(T,x) = h2*(T-Tinf2);

p2b1:-1*p2b/k;

3e) heat generation in the wall g(x)
-----------------------------------------------

g(x) = a*x+b

p1a:subst([g(x) =a*x+b],p1);

4e)  use ode2 to solve  ode
--------------------------------------

p3:ode2(p1a,T,x);

find : %k1,%k2
===========

dT/dx : ?
------------

p3a:diff(p3,x);

d(dT/dx)/dx : ?
==========

p3a1:diff(p3a,x);

d(dT/dx)/dx+g(x)/k : ? check
==============

p3a2:lhs(p3a1)+g(x)/k = rhs(p3a1) + (a*x+b)/k;

p3a3:ratsimp(p3a2);

p3a4:expand(p3a3);

?  p3a4 ,p1
=========

is(lhs(p3a4) = lhs(p1));

use :1e :  x=0, -k*dT/dx=h1(Tinf1 - T)
--------------------------------------------------

p3b:subst([x=0],p3);

p3b1:rhs(p2a1)= rhs(p3a);

p3b2:subst([p3b,x=0],p3b1);

use :1e :  x=L, -k*dT/dx= h2*(T-Tinf2)
---------------------------------------------------

p4b::subst([x=L],p3);

p4b1:rhs(p2b1)= rhs(p3a);

p4b2:subst([p4b,x=L],p4b1);

find : %k1,%k2
============

p5:solve([p3b2,p4b2],[%k1,%k2]);

p5a:flatten(p5);

temperature distribution (use 'p4') , T = T(x)
==================

p5b:subst(p5a,p3);

ode : (a*x+b)/k+'diff(T,x,2)=0       0 < x < L

BC :
===========================
-k*diff(T,x) = h1*(T-Tinf1)       T@x=0
-k*diff(T,x) = h2*(Tinf2-T)       T@x=L
===========================

p5c:ratsimp(p5b);

rate change internal energy = rate of heat entering (lhs) +rate heat generation-rate of heat leaving(rhs)
=============================================================================
rem : g(x) = volumetric heat generation =>  Qg = ( a*x+b) *Area*L (= Watt= Joule/s)
q= -k*dT/dx   (x=0)     =>  q0                          Q0 = Area*q0
q= -k*dT/dx   (x=L)     =>  qL                          QL=  Area*qL
=============================================================================
rate internal energy  = Qg+Q0-QL (Watt)
=============================================================================