1
$\begingroup$

I have implemented a finite element method to solve the 1D heat conduction equation:

$$ \frac{\partial T(x,t)}{\partial t} = k\frac{\partial^2T(x,t)}{\partial x^2} $$

This is done using an implicit method by solving the set of equations:

$$ -sT^{n+1}_{i+1} -(1+2s)T^{n+1}_{i} -sT^{n+1}_{i-1} = T^n_i $$

with $n$ the steps in time and $i$ the steps in the $x$ direction.

This can be represented by the following matrix equation: $$ Ax=b $$

with (with a simple system of 4 steps in length): $$ A= \begin{bmatrix} 1 & 0& 0 & 0 \\ -s & (1+2s) & -s & 0 \\ 0 & -s & (1+2s) & -s \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

$$ x= \begin{bmatrix} T^{n+1}_1 \\ T^{n+1}_2 \\ T^{n+1}_3 \\ T^{n+1}_4 \end{bmatrix} $$ $$ B= \begin{bmatrix} T^{n}_1 \\ T^{n}_2 \\ T^{n}_3 \\ T^{n}_4 \end{bmatrix} $$

If I want fixed temperature on the surface all I have to do is set $T^{n}_1 = T_{surf}$.

Now the question is what if I want to not have a fixed temperature but a heat flux into the surface:

$$ \frac{\partial T(x=0,t)}{\partial x} = c1 $$

Is it simply changing my vector $b$ by setting $T^{n}_1 = T^{n-1}_1+c1$ and not changing the matrix $A$?

Thanks for your help,

$\endgroup$
  • $\begingroup$ I think your system matrix also needs to be changed as well - I would double check but I don't have my class notes with me now. $\endgroup$ – Sean Roberson Jun 15 '17 at 20:41
  • $\begingroup$ Its what I thought initially, from what I gather it changes the first equation of the set to $(1+2s) T^{n+1}_1-2s T^{n+1}_2 = T^{n}_1-2s\Delta xc_1$. This would then change $A[1,1] = 1+2s $ and $A[0,1] = -s $ but If I do this python tells me I am trying to solve a singular matrix> $\endgroup$ – Anthony Lethuillier Jun 15 '17 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.