Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Plotting time-dependent heat source

Please login with a confirmed email address before reporting spam

Hi,

in my model, an externally defined heat source (defined in a Matlab .m file) is a function of x, y, z, t. How can I create a volume plot of the heat source values for a particular time step after the whole simulation is finished?

5 Replies Last Post Feb 15, 2012, 3:11 p.m. EST
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 14, 2012, 2:54 p.m. EST
Hi

normally you can call from the GUI an external matlab function check the Definition sub nodes. Then once solved you add a 3D plot for T and you select the appropriate time step when to plot for, in the main plot node (or have I muisunderstood something ? ;)

--
Good luck
Ivar
Hi normally you can call from the GUI an external matlab function check the Definition sub nodes. Then once solved you add a 3D plot for T and you select the appropriate time step when to plot for, in the main plot node (or have I muisunderstood something ? ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 15, 2012, 6:02 a.m. EST
Hi Ivar,

thank you for your reply!

I think you misunderstood me - but that's my fault, I guess I should write less cryptically.. :-)

In hindsight I realize that my question is as simple as: How can I plot the heat source values (not the temperature)?

What I've got so far: the heat source variable seems to be root.mod1.ht.Q. I can plot it, but then it shows all values as zero. So I suppose that the values of Q are not stored and that I need to specify somewhere that I would like them to be stored. Any idea how to do that?
Hi Ivar, thank you for your reply! I think you misunderstood me - but that's my fault, I guess I should write less cryptically.. :-) In hindsight I realize that my question is as simple as: How can I plot the heat source values (not the temperature)? What I've got so far: the heat source variable seems to be root.mod1.ht.Q. I can plot it, but then it shows all values as zero. So I suppose that the values of Q are not stored and that I need to specify somewhere that I would like them to be stored. Any idea how to do that?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 15, 2012, 7:19 a.m. EST
Hi

Check the COMSOL variables available, there is more than "Q", you have specific ones for convective, heat source, normal, magnitude etc. The best is to add the "preferences Equation View" and catch the variable name in the new (lowest level) subnode, then plot that. Or just plot your input function on the input BC

--
Good luck
Ivar
Hi Check the COMSOL variables available, there is more than "Q", you have specific ones for convective, heat source, normal, magnitude etc. The best is to add the "preferences Equation View" and catch the variable name in the new (lowest level) subnode, then plot that. Or just plot your input function on the input BC -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 15, 2012, 1:13 p.m. EST
The equation view is a really good tip to explore all available variables. Thanks!

Other than that, my problem is now: Whenever you try to plot a heat source that is defined by an external Matlab function, COMSOL reevaluates this function again. The heat source values are not stored in the solution set; COMSOL recomputes them when you create the plot. This is very unfortunate, because in my case the external function is *very* time-intensive. Do you happen to know if there is any way to circumvent this behaviour( maybe by storing the heat source values in the solution set)?
The equation view is a really good tip to explore all available variables. Thanks! Other than that, my problem is now: Whenever you try to plot a heat source that is defined by an external Matlab function, COMSOL reevaluates this function again. The heat source values are not stored in the solution set; COMSOL recomputes them when you create the plot. This is very unfortunate, because in my case the external function is *very* time-intensive. Do you happen to know if there is any way to circumvent this behaviour( maybe by storing the heat source values in the solution set)?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Feb 15, 2012, 3:11 p.m. EST
Hi

Interesting remark, but it could be that COMSOL reevaluates the function at intermediate points to provide an interpolation, one way would be to generate a piecevise function once from the time steps of your function, and load it in once.

worth to try support, or to suggest a read once option.

Now I havnt really played with external functions in malab, as with v4 I mostly manage to keep within the GUI, which is often faster, but there must be others out here that can come with better suggestions

--
Good luck
Ivar
Hi Interesting remark, but it could be that COMSOL reevaluates the function at intermediate points to provide an interpolation, one way would be to generate a piecevise function once from the time steps of your function, and load it in once. worth to try support, or to suggest a read once option. Now I havnt really played with external functions in malab, as with v4 I mostly manage to keep within the GUI, which is often faster, but there must be others out here that can come with better suggestions -- Good luck Ivar

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.