Henrik Sönnerlind
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
2 years ago
28 nov 2022, 03:03 GMT-5
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
28 nov 2022, 15:04 GMT-5
Updated:
2 years ago
28 nov 2022, 16:17 GMT-5
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
29 nov 2022, 10:33 GMT-5
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
13 dic 2022, 05:20 GMT-5
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.