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
2010年7月21日 GMT-4 04:11
Hi
what about defining a variable (global variable in 3.5a) and use this ?
--
Good luck
Ivar
Hi
what about defining a variable (global variable in 3.5a) and use this ?
--
Good luck
Ivar
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2010年7月21日 GMT-4 05:11
Thank you. I only have version 4.0 but I tried it nevertheless. It does not seem to work. I cannot select the variable for plotting and if I write it in the expression field, it is not recognized.
What is puzzling me is I have seen on some forum discussions, that other people who are plotting field intensity are discussing about a predefined expression "normE". I have displacement intensity "normD" in my expression list but NOT normE! Is that not strange?
Thank you. I only have version 4.0 but I tried it nevertheless. It does not seem to work. I cannot select the variable for plotting and if I write it in the expression field, it is not recognized.
What is puzzling me is I have seen on some forum discussions, that other people who are plotting field intensity are discussing about a predefined expression "normE". I have displacement intensity "normD" in my expression list but NOT normE! Is that not strange?
Magnus Ringh
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2010年7月21日 GMT-4 07:05
Hi,
Regarding es.normE: It was missing as a predefined variable in 4.0 but is available in 4.0a. You should have received an upgrade to 4.0a or should get one anyday now.
In 4.0, you can define it yourself as a variable using the same expression as in 4.0a:
sqrt(realdot(es.Ex,es.Ex)+realdot(es.Ey,es.Ey)+realdot(es.Ez,es.Ez))
The variable becomes available for plotting and evaluation after re-computing or updating the solution.
You find the variable in the list of predefined expressions but under Definitions (not Electrostatics). If you provide a description, COMSOL uses that and it appears among the other expressions in alphabetical order; otherwise the variable name appears within parentheses.
For plots that take vector inputs you must use the defined variables directly in the edit fields for the vector components. There is no support for grouping user-defined variables and declare them as components of a vector quantity.
Best regards,
Magnus Ringh
COMSOL
Hi,
Regarding es.normE: It was missing as a predefined variable in 4.0 but is available in 4.0a. You should have received an upgrade to 4.0a or should get one anyday now.
In 4.0, you can define it yourself as a variable using the same expression as in 4.0a:
sqrt(realdot(es.Ex,es.Ex)+realdot(es.Ey,es.Ey)+realdot(es.Ez,es.Ez))
The variable becomes available for plotting and evaluation after re-computing or updating the solution.
You find the variable in the list of predefined expressions but under Definitions (not Electrostatics). If you provide a description, COMSOL uses that and it appears among the other expressions in alphabetical order; otherwise the variable name appears within parentheses.
For plots that take vector inputs you must use the defined variables directly in the edit fields for the vector components. There is no support for grouping user-defined variables and declare them as components of a vector quantity.
Best regards,
Magnus Ringh
COMSOL
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2010年7月22日 GMT-4 05:40
Excellent, this is exactly what I was looking for. But there is still a problem. If I use the variable (dubbed normE) as a plot expression I get an error "failed to evaluate variable" a screenshot of the error message dialog is attached. If I replace "normE" by "sqrt(realdot(es.Ex,es.Ex)+realdot(es.Ey,es.Ey)+realdot(es.Ez,es.Ez))" in the expression field the plot works without error.
Another thing is maybe unimportant but still... if I define an expression in a plot then comsol automatically computes the corresponding unity (V/m etc.). But when I define a Variable under "global definitions" it doesn't. Is this a hint that it doesn't recognize the names (es.Ez etc.) used in defining the variable?
Too bad that comsol does not allow the grouping of user-defined vector component variables. This would be a fine feature to add.
Excellent, this is exactly what I was looking for. But there is still a problem. If I use the variable (dubbed normE) as a plot expression I get an error "failed to evaluate variable" a screenshot of the error message dialog is attached. If I replace "normE" by "sqrt(realdot(es.Ex,es.Ex)+realdot(es.Ey,es.Ey)+realdot(es.Ez,es.Ez))" in the expression field the plot works without error.
Another thing is maybe unimportant but still... if I define an expression in a plot then comsol automatically computes the corresponding unity (V/m etc.). But when I define a Variable under "global definitions" it doesn't. Is this a hint that it doesn't recognize the names (es.Ez etc.) used in defining the variable?
Too bad that comsol does not allow the grouping of user-defined vector component variables. This would be a fine feature to add.
Magnus Ringh
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2010年7月22日 GMT-4 09:36
Hi,
Regarding the error, my guess is that you have defined the variable as a global variable under Global Definitions instead of a local (to the active model) variable under, for example, Model 1>Definitions. It is possible, but then you need the syntax mod1.es.Ex etc. to access these quantities.
Regarding grouping of vector components: That is something that we will look into. In the current version, you can press Ctrl+Space in the edit fields for each vector component to access user-defined variables. At least it saves some typing.
Best regards,
Magnus Ringh
COMSOL
Hi,
Regarding the error, my guess is that you have defined the variable as a global variable under Global Definitions instead of a local (to the active model) variable under, for example, Model 1>Definitions. It is possible, but then you need the syntax mod1.es.Ex etc. to access these quantities.
Regarding grouping of vector components: That is something that we will look into. In the current version, you can press Ctrl+Space in the edit fields for each vector component to access user-defined variables. At least it saves some typing.
Best regards,
Magnus Ringh
COMSOL
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2010年7月22日 GMT-4 12:11
Thank you Magnus!! If I had only known this before, it would have saved me countless hors.
Thank you Magnus!! If I had only known this before, it would have saved me countless hors.