2
$\begingroup$

I want to solve some heat transfer problems with Mathematica. I am trying to run the heat transfer tutorial cases but I am always getting the error "NDSolveValue: Equation or list of equations expected instead of ..." I was reading into the HeatTransferPDEComponent documentation and tried running the example case, but the same problem appears. See the code below, I tried some stuff I found on the forum in the top 3 lines.

What is causing these errors and how can I fix it?

picture of code with error

Needs["NDSolve`FEM`"]
Clear[vars, pars, \[CapitalOmega], eqn, Tfun]

ClearAll[vars, pars, \[CapitalOmega], eqn, Tfun]

vars = {\[CapitalTheta][x], {x}};

pars = <|"ThermalConductivity" -> 0.026, "HeatSource" -> 1|>;
\[CapitalOmega] = Line[{{0}, {1}}];

eqn = HeatTransferPDEComponent[vars, pars] == 0

Tfun = NDSolveValue[{eqn, 
    HeatTemperatureCondition[x == 0, vars, 
     pars, <|"SurfaceTemperature" -> 0|>]}, \[CapitalTheta], 
   x \[Element] \[CapitalOmega]];
Plot[Tfun[x], {x} \[Element] \[CapitalOmega]]

I want to add that I am new to Mathematica. Further I tried running some code snippets not using the HeatTransferPDEComponent stuff but defining the heat equation in the code, which worked just fine.

$\endgroup$
8
  • $\begingroup$ Indeed, I can't activate HeatTransferPDEComponent[{\[CapitalTheta][t, x], t, {x}}, <| "MassDensity" -> \[Rho], "SpecificHeatCapacity" -> Subscript[C, p], "ThermalConductivity" -> \[Kappa]|>] in 12.3. $\endgroup$
    – user64494
    Commented Jul 15, 2021 at 9:02
  • $\begingroup$ I am running 12.1 by the way. $\endgroup$
    – Tobias
    Commented Jul 15, 2021 at 9:13
  • $\begingroup$ @user64494, works just fine for me on 12.3 $\endgroup$
    – user21
    Commented Jul 15, 2021 at 9:22
  • $\begingroup$ @user21: I obtain "Div::sclr: The scalar expression (-[Kappa]).{([CapitalTheta]^(0,1))[t,x]} does not have a divergence." $\endgroup$
    – user64494
    Commented Jul 15, 2021 at 10:59
  • $\begingroup$ @user64494, what OS? $\endgroup$
    – user21
    Commented Jul 15, 2021 at 11:17

1 Answer 1

1
$\begingroup$

The HeatTransferPDEComponent was introduced in version 12.2 so will need at least that version to run it. See how the function name is still blue - this means that symbol is not defined in the version you run.

$\endgroup$
4
  • $\begingroup$ Thanks a lot! I was going crazy on not being able to run the tutorial cases. $\endgroup$
    – Tobias
    Commented Jul 15, 2021 at 9:26
  • $\begingroup$ @Tobias, but there is a heat transfer tutorial in 12.1, it just does not make use of the newly added functions. You could have a look at that. There are, of course, no reference pages in 12.1 as then the functions did not exist. But maybe this is an incentive to get the update. $\endgroup$
    – user21
    Commented Jul 15, 2021 at 9:28
  • $\begingroup$ I can't update unfortunately as I am adding to some existing code that requires some older stuff. Any chance you know where I can find those old tutorials? I've been googling for quite a while and couldn't find anything useful. $\endgroup$
    – Tobias
    Commented Jul 15, 2021 at 10:31
  • $\begingroup$ Paste PDEModels/tutorial/HeatTransfer/HeatTransfer into the help system $\endgroup$
    – user21
    Commented Jul 15, 2021 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.