Plot one variable without reevaluation in different plots

Please login with a confirmed email address before reporting spam

I calculate average values using several non local couplings. I use these values in different plots in different summations. Each of these plots takes quite a while to create because all of the averages are reevaluated, even if it is the same result data set and they don't change.

Can I somehow evaluate the averages once and then reuse them in the different plots to save computation time? I have tried to use derived values, but can not access the resulting table to do the necessary summations...


5 Replies Last Post Dec 10, 2024, 1:02 p.m. EST
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 4 weeks ago Nov 28, 2024, 4:13 a.m. EST

Hi Finn,

yes, post processing with nonlocal couplings can be pretty time consuming. The ordinary variables are not part of the solution and thus need to be calculated again and again whenever they are called. A method that worked for me in the past is to write the result from the nonlocal coupling into a global state variable. State variables ARE part of the solution and no recalculation is needed when they get called in the post processing. The state variables do not carry a unit, so you must take care of correct units by yourself.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Finn, yes, post processing with nonlocal couplings can be pretty time consuming. The ordinary variables are not part of the solution and thus need to be calculated again and again whenever they are called. A method that worked for me in the past is to write the result from the nonlocal coupling into a global state variable. State variables ARE part of the solution and no recalculation is needed when they get called in the post processing. The state variables do not carry a unit, so you must take care of correct units by yourself. Cheers Edgar

Please login with a confirmed email address before reporting spam

Posted: 4 weeks ago Nov 28, 2024, 4:54 p.m. EST

Thank you I will try to do that!

Thank you I will try to do that!

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago Dec 10, 2024, 7:12 a.m. EST

Hi Finn,

yes, post processing with nonlocal couplings can be pretty time consuming. The ordinary variables are not part of the solution and thus need to be calculated again and again whenever they are called. A method that worked for me in the past is to write the result from the nonlocal coupling into a global state variable. State variables ARE part of the solution and no recalculation is needed when they get called in the post processing. The state variables do not carry a unit, so you must take care of correct units by yourself.

Cheers Edgar

I tried to implement it. but it increased the solution time quiet a lot unless I select one point as geometric entity. Unfortunately I can not evaluate the state variables. When i try to evaluate a variable under derived variables, I says the variable is undefined.

>Hi Finn, > >yes, post processing with nonlocal couplings can be pretty time consuming. The ordinary variables are not part of the solution and thus need to be calculated again and again whenever they are called. >A method that worked for me in the past is to write the result from the nonlocal coupling into a global state variable. State variables ARE part of the solution and no recalculation is needed when they get called in the post processing. The state variables do not carry a unit, so you must take care of correct units by yourself. > >Cheers >Edgar I tried to implement it. but it increased the solution time quiet a lot unless I select one point as geometric entity. Unfortunately I can not evaluate the state variables. When i try to evaluate a variable under derived variables, I says the variable is undefined.


Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago Dec 10, 2024, 7:54 a.m. EST

Hi Finn,

I only used global state variables and didn't find a significant increase in computation time even in large models and extensive integrations or averages. If you need to tie the state to a geometrical entity (e.g. a point) you will need to do a respective evaluation e.g. a point evaluation. A global state will be available in a global evaluation.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Finn, I only used global state variables and didn't find a significant increase in computation time even in large models and extensive integrations or averages. If you need to tie the state to a geometrical entity (e.g. a point) you will need to do a respective evaluation e.g. a point evaluation. A global state will be available in a global evaluation. Cheers Edgar

Please login with a confirmed email address before reporting spam

Posted: 2 weeks ago Dec 10, 2024, 1:02 p.m. EST

Hello Edgar,

thanks for answering. I was a bit confused. If using state variables on component level they are bound to a geometric entity like point, boundary, domain. If instead defined globally that is not necessary and the impact on computation time is little.

I was a bit confused how to set up state variables correctly now I use:

variable_name for State

0 for initial value

if(1>0, expression, variable_name) for update expression

I have them updated at end of step.

Now the variable access is lightning fast!

Thank you!

Hello Edgar, thanks for answering. I was a bit confused. If using state variables on component level they are bound to a geometric entity like point, boundary, domain. If instead defined globally that is not necessary and the impact on computation time is little. I was a bit confused how to set up state variables correctly now I use: variable_name for State 0 for initial value if(1>0, expression, variable_name) for update expression I have them updated at end of step. Now the variable access is lightning fast! Thank you!

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

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.