1D heat equation with RK4 method

544 Views Asked by At

I know that the Runge-Kutta method is a powerful method for ODE. So far I would like to solve 1D heat equation with Matlab. My problem is that $k$ (thermal conductivity) depends on temperature: $k=k(T)$.

1D heat equation: $$A \frac{d}{dx} \left( k(T) \frac{dT}{dx} \right)+g(T)=0$$

(where $g(T)$ is the heat generation and depends on temperature)

Usually, we asuume $k$ as constant (we take the average value for $k$). I can solve 1D heat equation with Runge kutta if $k$ is constant,

but If $k$ is not constant, I don't know how to do that.

I have thermal conductivity data about temperature.

Please help me to solve this equation. I want to know the algorithm.

1

There are 1 best solutions below

0
On

So the first thing you usually do is that you transform the second order differential equation into a first order. For $k=K(T) \neq k(x)$ you obtain

$$A k(T) \frac{d^2T}{dx^2} +g(T)=0.$$ Define $T_1(x) = T(x), T_2(x) = T'(x)$.

Then, you can set up the system of first order ODEs as

\begin{align} \begin{pmatrix} T_1(x) \\ T_2(x) \end{pmatrix}' = \begin{pmatrix} T_2(x) \\ -\frac{g(T_1)}{Ak(T_1)}\end{pmatrix} \end{align}

Note that you need 2 boundary conditions to be able to uniquely solve the ODE. Then, assuming known $g(T), k(T)$ you can thus just hand over things to the ODE solver.