Solving a Heat Equation with Neumann Boundary Conditions and an initial condition

331 Views Asked by At

i have this partial equation (heat equation) with the initial condition and the Neumann boundary conditions

Consider the heat equation: $$ u_t(x, t)=u_{x x}(x, t) $$ where $$ 0<x<1, \quad t>0 $$ Neumann Boundary condition: \begin{array}{ll} u_x(0, t)=u, & t>0 \end{array} \begin{array}{ll} u_x(1, t)=-u, & t>0 \end{array} Initial condition: $$u(x, 0)=1, \quad 0<x<1$$ To solve the heat equation analytically with Neumann boundary conditions and an initial condition, we can use separation of variables. I got this result

$u(x,t)=4 \sum_{n=1}^{\infty}\left[\frac{\sec \alpha_n}{\left(3+4 \alpha_n^2\right)} e^ {-\alpha_n^2 t} \cos 2 \alpha_n(x-0.5)\right], \quad(0<x<1)$

and I would like to implement this analytical solution with Excel-VBA, but the results are still different and the values are different, i.e.

my analytical solution is not correct, can someone help me to find the right analytical solution?

thanks in advance

the correct values with the analytical solution should look like in the table shown correct values

1

There are 1 best solutions below

0
On

can anyone check if my analytical solution is right and correct? $$ u_t(x, t)=u_{x x}(x, t) $$ The general solution of the heat equation is given by $$ u(x, t)=\frac{1}{\sqrt{4 \pi t}} \int_{-\infty}^{\infty} e^{-\frac{(x-y)^2}{4 t}} u(y, 0) d y $$ where $ u(y, 0) $ is the initial condition. Now, let's substitute the given initial condition into the general solution $$ u(x, t)=\frac{1}{\sqrt{4 \pi t}} \int_{-\infty}^{\infty} e^{-\frac{(x-y)^2}{4 t}} d y $$ We can simplify the integral by using the change of variable $ z=\frac{(x-y)^2}{4 t}$ $$ u(x, t)=\frac{1}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-z^2} d z=1 $$ Thus, the solution to the heat equation with the given initial condition is $u(x,t) = 1$. Now, let's apply the given Neumann boundary conditions to find the final solution. We start with the solution we derived earlier, $$ u(x, t)=1 $$ and differentiate it with respect to $x$ to obtain $$ u_x(x, t)=0 $$ Using the first Neumann boundary condition $u_x(0, t) = u$, we have $$ u=u_x(0, t)=0 $$ which implies that the constant $u$ is zero. Similarly, using the second Neumann boundary condition $u_x(1, t) = -u$, we get $$ -u=u_x(1, t)=0 $$ which again implies that the constant $u$ is zero. Therefore, the final solution to the heat equation with the given Neumann boundary conditions and initial condition is $$ u(x, t)=1 $$

This means that the temperature in the interval $0<x<1$ does not change with time and remains at a constant value of 1. Yes, that's correct. The Neumann boundary conditions specify the normal derivative of the solution at the boundaries of the domain. In the case of the given Neumann boundary conditions, the normal derivative of the solution at $x=0$ is a constant $u$ and the normal derivative of the solution at $x=1$ is the negative of that constant $u$. This means that the solution changes linearly along the boundaries, with a slope of $u$ at $x=0$ and a slope of $-u$ at $x=1$.
On the other hand, the initial condition specifies the value of the solution at the initial time $t=0$ for all points in the domain $0<x<1$. In this case, the initial condition is a constant function equal to 1. Therefore, the solution remains constant at 1 for all times $t>0$, independent of $x$. You're also correct that the left-hand side of the heat equation is independent of $x$, while the right-hand side is dependent on $x$. This reflects the fact that the heat equation describes the diffusion of heat in a one-dimensional medium, with heat flowing from regions of higher temperature to regions of lower temperature. The diffusion process depends on the temperature gradient, which is described by the second derivative of the solution with respect to $x$.