Edgar J. Kaiser
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
4 years ago
18 mai 2021, 00:54 UTC−4
Updated:
4 years ago
18 mai 2021, 03:26 UTC−4
Hi Felipe,
you can try to do that with state variables. They indeed are stored in the solution.
Cheers
Edgar
-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi Felipe,
you can try to do that with state variables. They indeed are stored in the solution.
Cheers
Edgar
Please login with a confirmed email address before reporting spam
Posted:
4 years ago
18 mai 2021, 09:35 UTC−4
Hi Edgar,
Are states variables available in comsol 5.4? I found this instructive https://www.comsol.com/blogs/how-to-use-state-variables-in-comsol-multiphysics/. But t refers to 5.5 version and i can't find them in 5.4.
Or, is there a way around it on 5.4?
Thanks for your help
Felipe.
Hi Edgar,
Are states variables available in comsol 5.4? I found this instructive https://www.comsol.com/blogs/how-to-use-state-variables-in-comsol-multiphysics/. But t refers to 5.5 version and i can't find them in 5.4.
Or, is there a way around it on 5.4?
Thanks for your help
Felipe.
Edgar J. Kaiser
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
4 years ago
18 mai 2021, 12:27 UTC−4
Yes, this is not yet available in 5.4. Another option that I sometimes used was an extra equation.
If the variable you want to store is var1, you would set up a global or domain equation var2 - nojac(var1) = 0.
var2 is then a solution variable and fast in post processing. However, you need to take care of solver convergence and accuracy. This approach actually generates the state variable var2.
It is a bit cumbersome, but worked for me in most cases.
The state variable approach in 5.5 / 5.6 is better.
-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Yes, this is not yet available in 5.4. Another option that I sometimes used was an extra equation.
If the variable you want to store is var1, you would set up a global or domain equation var2 - nojac(var1) = 0.
var2 is then a solution variable and fast in post processing. However, you need to take care of solver convergence and accuracy. This approach actually generates the state variable var2.
It is a bit cumbersome, but worked for me in most cases.
The state variable approach in 5.5 / 5.6 is better.
Please login with a confirmed email address before reporting spam
Posted:
4 years ago
20 mai 2021, 09:11 UTC−4
Thank you very much Edgar, i tried with domain ODEs with no luck.
I'll be upgrading to 5.6 soon
Cheers
Felipe
Thank you very much Edgar, i tried with domain ODEs with no luck.
I'll be upgrading to 5.6 soon
Cheers
Felipe
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
27 mai 2021, 21:00 UTC−4
Hi again to any one interested in this topic. I wanted to give an update on my experience with state variables so this thread can be helpful to future readers.
Although this solved my problem, it also incresed the solving time from 1 minut to 15 minuts.
I guess its because it evaluates those variables in every step, but i need them to be evaluated only at the end of the study. So to avoid this it is posible to run the study with state variables disable, and put a short step in the study to rerun later with state variables activated.
If anyone knows a way to aviod computing state variables in every step i'll apreciate your advice.
Also this kind of variable seems to be adimensional, even though the variable inputs are not.
Hi again to any one interested in this topic. I wanted to give an update on my experience with state variables so this thread can be helpful to future readers.
Although this solved my problem, it also incresed the solving time from 1 minut to 15 minuts.
I guess its because it evaluates those variables in every step, but i need them to be evaluated only at the end of the study. So to avoid this it is posible to run the study with state variables disable, and put a short step in the study to rerun later with state variables activated.
If anyone knows a way to aviod computing state variables in every step i'll apreciate your advice.
Also this kind of variable seems to be adimensional, even though the variable inputs are not.
Edgar J. Kaiser
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
28 mai 2021, 04:34 UTC−4
Felipe,
just a wild idea. I am wondering if it might help to put the variable definition inside an if() statement that branches to 0 for all times smaller than the final time and to the complex expression for the last time step.
For example in C the complex code would really only be executed in the final step, but I am not sure which way Comsol handles it.
Cheers
Edgar
-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Felipe,
just a wild idea. I am wondering if it might help to put the variable definition inside an if() statement that branches to 0 for all times smaller than the final time and to the complex expression for the last time step.
For example in C the complex code would really only be executed in the final step, but I am not sure which way Comsol handles it.
Cheers
Edgar
Henrik Sönnerlind
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
28 mai 2021, 06:46 UTC−4
Another solution could be to run a separate study (or study step) where you just do the variable mapping.
-------------------
Henrik Sönnerlind
COMSOL
Another solution could be to run a separate study (or study step) where you just do the variable mapping.
Please login with a confirmed email address before reporting spam
Posted:
3 years ago
28 mai 2021, 14:34 UTC−4
Edgar,
Wild in deed, but I'm working with stationary steps, so i would need to link the if statement with internal iterations. I don't know if that can be done
Right now i have 3 physics nodes wich are solved in 3 different stationary steps, 1 to solve the velocity and pressure field. And the others to solve 2 different Temperature fields. The last one is solved realy fast in few iterations , so this one is the reruned one
Henrik,
I thought of that, but i would need to disable the state variables from the dependent variable node in each stationary step, and add a last step with al dependent varaibles disabled. I haven't foud a way to disble variables this way.
What i found is in the "Physics and Variables Selection" section in the "settings" window of each step you can choose wich modules are calculated during the step. If you chek the "Modify model configuration for study step" box you can also modify other definitions nodes like the traditional variables node, but not the state variables node.
Edgar,
Wild in deed, but I'm working with stationary steps, so i would need to link the if statement with internal iterations. I don't know if that can be done
Right now i have 3 physics nodes wich are solved in 3 different stationary steps, 1 to solve the velocity and pressure field. And the others to solve 2 different Temperature fields. The last one is solved realy fast in few iterations , so this one is the reruned one
Henrik,
I thought of that, but i would need to disable the state variables from the dependent variable node in each stationary step, and add a last step with al dependent varaibles disabled. I haven't foud a way to disble variables this way.
What i found is in the "Physics and Variables Selection" section in the "settings" window of each step you can choose wich modules are calculated during the step. If you chek the "Modify model configuration for study step" box you can also modify other definitions nodes like the traditional variables node, but not the state variables node.