Discussion Forum

Maximum Temperature plot

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   12 Replies   Last post: May 9, 2011 10:17am UTC
Matt Determan

Matt Determan

October 6, 2009 2:17pm UTC

Maximum Temperature plot

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?.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

October 6, 2009 2:43pm UTC in response to Matt Determan

Re: Maximum Temperature plot

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Matt Determan

Matt Determan

October 6, 2009 3:07pm UTC in response to Ivar Kjelberg

Re: Maximum Temperature plot

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.



Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

October 6, 2009 3:18pm UTC in response to Matt Determan

Re: Maximum Temperature plot

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

October 7, 2009 5:53am UTC in response to Ivar Kjelberg

Re: Maximum Temperature plot

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Matt Determan

Matt Determan

October 15, 2009 1:10pm UTC in response to Ivar Kjelberg

Re: Maximum Temperature plot

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)

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jim Knox

Jim Knox

September 2, 2010 12:48pm UTC in response to Matt Determan

Re: Maximum Temperature plot

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.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

September 2, 2010 4:39pm UTC in response to Jim Knox

Re: Maximum Temperature plot

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

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Yi Zhang

Yi Zhang

September 7, 2010 1:51pm UTC in response to Ivar Kjelberg

Re: Maximum Temperature plot


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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

September 7, 2010 3:01pm UTC in response to Yi Zhang

Re: Maximum Temperature plot

Hi

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

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jim Knox

Jim Knox

September 11, 2010 6:25pm UTC in response to Ivar Kjelberg

Re: Maximum Temperature plot

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~

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jose Rey

Jose Rey

September 18, 2010 4:49pm UTC in response to Jim Knox

Re: Maximum Temperature plot

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.

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Yajuan Liu

Yajuan Liu

May 9, 2011 10:17am UTC in response to Matt Determan

Re: Maximum Temperature plot

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines