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.

Maximum Temperature plot

Please login with a confirmed email address before reporting spam

I'm trying to plot the value of the maximum Temperature in a subdomain during a transient event.

Any suggestions on how to do this?.

12 Replies Last Post 9 mai 2011, 06:17 UTC−4
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 6 oct. 2009, 10:43 UTC−4
Hi

I would try to make an Options Expressions Sub-domain Expression" with a name like "Tmax" with the expression "max(T)" over the specific subdomain, and then plot this value for all times, once solved.

You should also check when the time step result are stored in your solver settings so you do not skip the maximum if it's very "waivy" with the time variable.

Havnt tried though, and my COMSOL is currently running full speed on another calculation, still 4 iterations left and 30 minutes I expect.

Pls report back when you find/check the solution

Good luck
Ivar
Hi I would try to make an Options Expressions Sub-domain Expression" with a name like "Tmax" with the expression "max(T)" over the specific subdomain, and then plot this value for all times, once solved. You should also check when the time step result are stored in your solver settings so you do not skip the maximum if it's very "waivy" with the time variable. Havnt tried though, and my COMSOL is currently running full speed on another calculation, still 4 iterations left and 30 minutes I expect. Pls report back when you find/check the solution Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 6 oct. 2009, 11:07 UTC−4
I tried that with no success. As far as I can tell from comsol documentation the max() function only returns the maximum value of a list of arguments i.e. max(0,2) returns 2.

It does not evaluate the maximum value over the subdoamain.

The post processing mode Plot parameters has a Max/min marker that does what I want but I cant find a simple way to extract that value for every time step.



I tried that with no success. As far as I can tell from comsol documentation the max() function only returns the maximum value of a list of arguments i.e. max(0,2) returns 2. It does not evaluate the maximum value over the subdoamain. The post processing mode Plot parameters has a Max/min marker that does what I want but I cant find a simple way to extract that value for every time step.

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 6 oct. 2009, 11:18 UTC−4
Hi

It's correcct, tried it too, sorry for giving wrong ideas.
I tried a min/max plot, and looked into the "history file, but COMSOL is using a special feature of postplot: 'maxminsub',{'T','recover','off','unit','K'} no chance their either.

One way which does work: try to ask COMSOL support

"là, je donne ma langue au chat" as they say herearound ;)

And pls report back, it's of general interest
Good luck
Ivar
Hi It's correcct, tried it too, sorry for giving wrong ideas. I tried a min/max plot, and looked into the "history file, but COMSOL is using a special feature of postplot: 'maxminsub',{'T','recover','off','unit','K'} no chance their either. One way which does work: try to ask COMSOL support "là, je donne ma langue au chat" as they say herearound ;) And pls report back, it's of general interest Good luck Ivar

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 7 oct. 2009, 01:53 UTC−4
Hi

I did sleep over the challenge, but havnt found any better idea. Now there is one trick I use to highlight extrema on a surface plots, I use the expression T*((Tx^2+Ty^2)<Tlim) where Tx and Ty are the derivatives (or gradient components) of the temperature field (in 2D x,y). Then by setting the plot "RANGE" to manual and seeting a minimum value larger than 0 you get a white plot with only the extrema appearing as small points (depends on the size of Tlim). If you want just the maxima, you add the conditional test *(T>0)

Now, if you have only one extrema you can imagine to make a boundary integration variable first of the logical function to get the avraging area, then of the full formula divided by the previously calculated area, this gives you an averaged maxima, complex but its working (provided Tlim is large enough to define an area >0).

But their must be an easier way inside the GUI's ?, with matlab the "max()" will in any case work out

Good luck
Ivar
Hi I did sleep over the challenge, but havnt found any better idea. Now there is one trick I use to highlight extrema on a surface plots, I use the expression T*((Tx^2+Ty^2)0) Now, if you have only one extrema you can imagine to make a boundary integration variable first of the logical function to get the avraging area, then of the full formula divided by the previously calculated area, this gives you an averaged maxima, complex but its working (provided Tlim is large enough to define an area >0). But their must be an easier way inside the GUI's ?, with matlab the "max()" will in any case work out Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 15 oct. 2009, 09:10 UTC−4
Response from COMSOL support:

This is unfortunatley not possible in the current release. It will be included in the coming release, COMSOL Multiphysics 4.0, where a coupling variable, similar to the Integration Coupling Variable present in the current
release, can be defined that returns the *maximum* value instead of the *integrated* value.

The workaround in the current release is to use the MATLAB interface, where only a few scripting commands are necessary to be able to achieve this plot.

File > Client/Server/MATLAB > Connect To MATLAB

Once connected to MATLAB, select File > Export > FEM-structure as 'fem', which will create the variable
'fem' in the MATLAB workspace. This is the command-line representation of your model.

Now, use the command postmax to get the maximum value of a certain expression for all time-steps. If the
variable name for the temperature is T, use:

maxT = postmax(fem,'T','solnum','all');

The time-steps are present in fem.sol.tlist, so to plot the maximum temperature vs. the time, use

t = fem.sol.tlist;
plot(t,maxT)
Response from COMSOL support: This is unfortunatley not possible in the current release. It will be included in the coming release, COMSOL Multiphysics 4.0, where a coupling variable, similar to the Integration Coupling Variable present in the current release, can be defined that returns the *maximum* value instead of the *integrated* value. The workaround in the current release is to use the MATLAB interface, where only a few scripting commands are necessary to be able to achieve this plot. File > Client/Server/MATLAB > Connect To MATLAB Once connected to MATLAB, select File > Export > FEM-structure as 'fem', which will create the variable 'fem' in the MATLAB workspace. This is the command-line representation of your model. Now, use the command postmax to get the maximum value of a certain expression for all time-steps. If the variable name for the temperature is T, use: maxT = postmax(fem,'T','solnum','all'); The time-steps are present in fem.sol.tlist, so to plot the maximum temperature vs. the time, use t = fem.sol.tlist; plot(t,maxT)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 sept. 2010, 08:48 UTC−4
Can you provide a little more detail on how to get the temporal maximum in 4.0a? I have been playing with this but can only get spatial maximum with the coupling variable so far.
Can you provide a little more detail on how to get the temporal maximum in 4.0a? I have been playing with this but can only get spatial maximum with the coupling variable so far.

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 2 sept. 2010, 12:39 UTC−4
Hi
you have specific min max operators in V4 check with a right click two levels below under "Definitions ..."

--
Good luck
Ivar
Hi you have specific min max operators in V4 check with a right click two levels below under "Definitions ..." -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 7 sept. 2010, 09:51 UTC−4

Hi
you have specific min max operators in V4 check with a right click two levels below under "Definitions ..."

--
Good luck
Ivar


Hi Ivar,

But how can we get the spatial positions (x,y) of these max or min values, since sometime it may be useful when we want to cite the (x,y )s in other fuctions
[QUOTE] Hi you have specific min max operators in V4 check with a right click two levels below under "Definitions ..." -- Good luck Ivar [/QUOTE] Hi Ivar, But how can we get the spatial positions (x,y) of these max or min values, since sometime it may be useful when we want to cite the (x,y )s in other fuctions

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 7 sept. 2010, 11:01 UTC−4
Hi

my first reply would be: use matlab, but check the doc, not sure how it is in V4

--
Good luck
Ivar
Hi my first reply would be: use matlab, but check the doc, not sure how it is in V4 -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11 sept. 2010, 14:25 UTC−4
Worked on this some more today. It appears that the maximum coupling operator and the maximum evaluation are both used for resolving the maximum over a spatial or geometric domain. This is clear in the docs for the maximum coupling operator. Regarding the maximum evaluation approach, I have created a point probe of a transient solution and applied the maximum evaluation operator to the resulting data set. However, it simply echoes the entire transient data set for that point, instead of finding the maximum value over the transient solution.

My short answer: dump the data via Report and find the maximum externally, or use Matlab on the solution set. Unfortunately this is a bad answer if you just want to pluck the transient maximum at some point in your geometry, and otherwise are happy with staying inside COMSOL.

I may try the same approach with a cut point, but am not hopeful as the data set from my Point Probe is actually a Cut Point.

~jim~

Worked on this some more today. It appears that the maximum coupling operator and the maximum evaluation are both used for resolving the maximum over a spatial or geometric domain. This is clear in the docs for the maximum coupling operator. Regarding the maximum evaluation approach, I have created a point probe of a transient solution and applied the maximum evaluation operator to the resulting data set. However, it simply echoes the entire transient data set for that point, instead of finding the maximum value over the transient solution. My short answer: dump the data via Report and find the maximum externally, or use Matlab on the solution set. Unfortunately this is a bad answer if you just want to pluck the transient maximum at some point in your geometry, and otherwise are happy with staying inside COMSOL. I may try the same approach with a cut point, but am not hopeful as the data set from my Point Probe is actually a Cut Point. ~jim~

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18 sept. 2010, 12:49 UTC−4
I have no idea why the functions max() and min() would have to disappear. I am working on Comsol 3.5a, and remember that I used it in most previous versions with satisfaction. This time around lost a bunch of hours just trying to figure out what I had done wrong...

I wonder what is happening under the hood that so many functions/commands have disappeared. Hopefully it is all for the better...

Thanks for this thread, it was helpful.
I have no idea why the functions max() and min() would have to disappear. I am working on Comsol 3.5a, and remember that I used it in most previous versions with satisfaction. This time around lost a bunch of hours just trying to figure out what I had done wrong... I wonder what is happening under the hood that so many functions/commands have disappeared. Hopefully it is all for the better... Thanks for this thread, it was helpful.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 9 mai 2011, 06:17 UTC−4
Hello!

I don't know if you have several subdomains.

My model have 6 subdomains and I want to get the Tmax value and its coordinate of each subdomain.

But when I use [Tmax P]=postmax(fem,'T','subdomain',[1]) and [Tmax P]=postmax(fem,'T','subdomain',[2]) ...

The result are the same when I use diferent suddomain.

I don't where I have the error?

Can you give me some hints?

Thanks in advance!

Best wish!

Yajuan
Hello! I don't know if you have several subdomains. My model have 6 subdomains and I want to get the Tmax value and its coordinate of each subdomain. But when I use [Tmax P]=postmax(fem,'T','subdomain',[1]) and [Tmax P]=postmax(fem,'T','subdomain',[2]) ... The result are the same when I use diferent suddomain. I don't where I have the error? Can you give me some hints? Thanks in advance! Best wish! Yajuan

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.