Solving a second-order differential equation with both Dirichlet and Neumann boundary conditions

Viewed 94

I want to solve the Fourier’s law for the heat equation

               

of an isolated electrically heated rod:

               

with a Dirichlet boundary condition of

               

and a Neumann boundary condition of

               

where

  • x is the length coordinate
  • L is the length of the rod
  • K is the thermal conductivity of the material (assumed constant)
  • Q is the internal heat generation per unit length
  • q heat load from the left side
  • TL is the ambient temperature on the right side

To solve the differential equation I used the

eqn : 'diff(T, x, 2) + Q / k = 0;
sol : ode2(eqn, T, x);

giving the correct general form of

               

however when applying the boundary conditions using:

bc2(sol, x=0, 'diff(T, x)=-q/k, x=L, T=TL);

I get the wrong answer of

               

while what I expected to see was

               

I would appreciate it if you could help me know what is the problem and how I can resolve it.

1 Answers

In this specific case, because the Neumann boundary condition happened in the x = 0 I could use the

ic2(sol, x=L, T=TL, 'diff(T, x)=-q/k);

to get the correct result:

               
Related