Hi,
I’m trying to solve for the steady state solution of a one-dimensional heat equation describing a nonlinear heat conduction in a finite domain [0,1] using ApproxFun.jl:
T_{xx} = 0
subject to a Dirichlet boundary conditions at the left end
T(0,t) = T_0 \quad \text{at} \;\; x=0
and a nonlinear power law boundary condition at the right end
T_x(1, t) = \beta(T^4 - T_0^4) \qquad \text{at}\;\; x=1.
Here, T = T(x, t) is the temperature variable, \beta and T_0 are some constant parameters.
I’m having trouble dealing with the nonlinearity in the right boundary condition. The numerical result I got from the plot does not agree with the analytical one, so I wonder how to fix this?
Here’s my code:
using ApproxFun, Plots, LinearAlgebra
T₀ = 2.0
β = 2.0
d = Interval(0,1)
S = Chebyshev(d)
x = Fun(S)
D = Derivative(S)
BC1 = Evaluation(S, 0) # T(0) = T₀ at x=0
BC2 = Evaluation(S, 1, 1) - β*Evaluation(S, 1)^4 # T'(1) = β(T(1)^4 - T₀^4) at x=1
L = D^2 # differential operator: T'' = 0
sol = [BC1; BC2; L] \ [T₀; -β*T₀^4; 0*x]
# analytical solution: T(x) = Ax + B, where B = T₀ and A = β((A+T₀)^4 - T₀^4) -> A ≈ -3.93545
T_analytical = -3.93545*x
print(sol)
plot(sol, label="numerical")
plot!(T_analytical, label="analytical", lw=2, linestyle=:dash)
and the plot I got:
Any help would be much appreciated!