Henrik Sönnerlind
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
2 years ago
Nov 28, 2022, 3:03 a.m. EST
1) I understand this as max and average over the domain. You can create variables for this under Definition->Variables, and then just create another variable for the ratio. However, note that p^2 is in general a complex number. Also, since the scale of an eigenmode is arbitrary, taking the ratio of something that has a linear dependence on the amplitude and something that has a quadratic dependence seems suspect.
2) Since eigenmodes have an arbitrary scaling, comparing values between modes is in general not a meaningful operation.
-------------------
Henrik Sönnerlind
COMSOL
1) I understand this as max and average over the domain. You can create variables for this under Definition->Variables, and then just create another variable for the ratio. However, note that p^2 is in general a complex number. Also, since the scale of an eigenmode is arbitrary, taking the ratio of something that has a linear dependence on the amplitude and something that has a quadratic dependence seems suspect.
2) Since eigenmodes have an arbitrary scaling, comparing values between modes is in general not a meaningful operation.
Please login with a confirmed email address before reporting spam
Posted:
2 years ago
Nov 28, 2022, 3:04 p.m. EST
Updated:
2 years ago
Nov 28, 2022, 4:17 p.m. EST
Thank you for your quick reply.
1) I understand this as max and average over the domain. You can create variables for this under Definition->Variables, and then just create another variable for the ratio. However, note that p^2 is in general a complex number. Also, since the scale of an eigenmode is arbitrary, taking the ratio of something that has a linear dependence on the amplitude and something that has a quadratic dependence seems suspect.
Thanks for the clarification, I managed to implement it. For the problem I am considering the solution has no imaginary part. The ratio
(I forgot the square root) is used to find out if a mode is located in a zone of the domain, if the ratio is big then the mode is mostly located. Divided by
amounts to normalizing the mode by its L2-norm.
2) Since eigenmodes have an arbitrary scaling, comparing values between modes is in general not a meaningful operation.
In fact, it is not directly on the modes that I want to carry out this operation but on a slightly different problem where scaling has a precise meaning. I used the example of the modes to make it clearer. So, is it possible to plot such a function
based on a frequency array in COMSOL ?
Thank you for your quick reply.
>1) I understand this as max and average over the domain. You can create variables for this under Definition->Variables, and then just create another variable for the ratio. However, note that p^2 is in general a complex number. Also, since the scale of an eigenmode is arbitrary, taking the ratio of something that has a linear dependence on the amplitude and something that has a quadratic dependence seems suspect.
Thanks for the clarification, I managed to implement it. For the problem I am considering the solution has no imaginary part. The ratio \text{max}(|p|) / \sqrt{\text{avg}(p^2)} (I forgot the square root) is used to find out if a mode is located in a zone of the domain, if the ratio is big then the mode is mostly located. Divided by \sqrt{\text{avg}(p^2)} amounts to normalizing the mode by its L2-norm.
>2) Since eigenmodes have an arbitrary scaling, comparing values between modes is in general not a meaningful operation.
In fact, it is not directly on the modes that I want to carry out this operation but on a slightly different problem where scaling has a precise meaning. I used the example of the modes to make it clearer. So, is it possible to plot such a function f(\bm{x})=\underset{\omega}{\text{max}} |p(\bm{x},\omega)| based on a frequency array in COMSOL ?
Henrik Sönnerlind
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
2 years ago
Nov 29, 2022, 10:33 a.m. EST
Assuming that you do not have too many modes, you can plot an expression like (using 4 modes here)
max(with(4,pa),max(with(3,pa),max(with(2,pa),with(1,pa))))
where pa is a variable containing abs(p).
If you have hundreds of modes, it may become a bit boring to write the expression, though. Then you may want to resort to scripting, using model methods or Matlab. You can even use a script just to create the very long expression.
For time-domain analysis there is an operator called timemax() doing this type of max value search, but there is nothing similar built in for eigenmodes.
-------------------
Henrik Sönnerlind
COMSOL
Assuming that you do not have too many modes, you can plot an expression like (using 4 modes here)
*max(with(4,pa),max(with(3,pa),max(with(2,pa),with(1,pa))))*
where *pa* is a variable containing *abs(p)*.
If you have hundreds of modes, it may become a bit boring to write the expression, though. Then you may want to resort to scripting, using model methods or Matlab. You can even use a script just to create the very long expression.
For time-domain analysis there is an operator called *timemax()* doing this type of max value search, but there is nothing similar built in for eigenmodes.
Please login with a confirmed email address before reporting spam
Posted:
2 years ago
Dec 13, 2022, 5:20 a.m. EST
Thank you very much Henrik, indeed this way of doing things works well. I used a Python script to express the forumula which can, indeed, become long.
Thank you very much Henrik, indeed this way of doing things works well. I used a Python script to express the forumula which can, indeed, become long.