It’s not clear to me what the intended behavior of the program is, but the direct cause of the error is that f_heat
involves a TrialFunction
. When using the a == L
syntax for the first argument of solve
, a
should be linear in each of a TestFunction
and a TrialFunction
, and L
should be linear in a TestFunction
(and not include a TrialFunction
). In the given code, L
not only includes the TrialFunction
component u_2
(through f_heat
), but is nonlinear in it. (With the given code, I first get a different error due to temp=u_n
in the arguments passed while defining sigma
, because u_n
is not scalar, which I resolved by passing u_n1
instead.)
P.S. Note that you can format multi-line code blocks by including three backticks before and after (and, optionally, specify the programming language after the first triple backtick), e.g.,
```python
line 1
line 2
line 3
```
You can learn more about formatting your posts here by Googling “markdown”, which is the mark-up language used by Discourse.