Kristian Ejlebjærg Jensen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
1 year ago
Aug 17, 2023, 3:28 a.m. EDT
Updated:
1 year ago
Aug 17, 2023, 7:01 a.m. EDT
Dear Hidde de Wit
The Frequency Domain and Wavelength Domain study step create a solution for every frequency/wavelength. The "solution" option in the Objective Function section of the (Shape/Topology) Optimization study step determines how the objectives for the different solutions are combined. By default the objectives are summed, but you can also choose to minimize the maximum if you use the MMA optimization method. You cannot make an objective function that combines global variables evaluated at different solutions arbitrarily.
A consequence of this is that the last objective you mention is easy to express in the COMSOL GUI , while the variance minimization is more difficult. You will essentially have to avoid creating different solutions. This is possible by repeating the geometry and/or having several physics interfaces. Ref 1. demonstrates the latter, but in practice you probably also care about the mean value and therefore the objective with a fixed target (instead of the mean) is probably a better choice for most engineering applications.
Ref 1: https://www.comsol.com/model/14513
Best regards,
Kristian E. Jensen
Technical Product Manager, Optimization
Dear Hidde de Wit
The Frequency Domain and Wavelength Domain study step create a solution for every frequency/wavelength. The "solution" option in the Objective Function section of the (Shape/Topology) Optimization study step determines how the objectives for the different solutions are combined. By default the objectives are summed, but you can also choose to minimize the maximum if you use the MMA optimization method. You cannot make an objective function that combines global variables evaluated at different solutions arbitrarily.
A consequence of this is that the last objective you mention is easy to express in the COMSOL GUI , while the variance minimization is more difficult. You will essentially have to avoid creating different solutions. This is possible by repeating the geometry and/or having several physics interfaces. Ref 1. demonstrates the latter, but in practice you probably also care about the mean value and therefore the objective with a fixed target (instead of the mean) is probably a better choice for most engineering applications.
Ref 1:
Best regards,
Kristian E. Jensen
Technical Product Manager, Optimization
Please login with a confirmed email address before reporting spam
Posted:
12 months ago
Aug 18, 2023, 6:39 a.m. EDT
Hi Kristian E. Jensen,
Thank you for your elaborate response. It saddens me that operations w.r.t. a set of solutions is not possible. However it is nice to know that I no longer need to search for solutions in this area I guess.
The issue now changes however from not being able able to use operations over various solutions to defining smoothness of the curve w.r.t. a solution set. The cost function (SPL_measured - SPL_target)^2 would essentially be a scaled mean deviation. However this could lead to a result that is really close on many frequencies and has very large deviation at one frequency ( a very spikey frequency response) or it could result in a frequency response that smoothly deviates from the target frequency response. It is perfectly fine if the loudspeaker deviates from the target SPL, provided that it does so smoothly.
The SPL is only part of the entire cost function. The other parameters would be the directivity index and beamwidth. However the same issues arise there that I can't optimize frequency dependant behaviour.
Thanks in advance!
Hidde
Hi Kristian E. Jensen,
Thank you for your elaborate response. It saddens me that operations w.r.t. a set of solutions is not possible. However it is nice to know that I no longer need to search for solutions in this area I guess.
The issue now changes however from not being able able to use operations over various solutions to defining smoothness of the curve w.r.t. a solution set. The cost function (SPL_measured - SPL_target)^2 would essentially be a scaled mean deviation. However this could lead to a result that is really close on many frequencies and has very large deviation at one frequency ( a very spikey frequency response) or it could result in a frequency response that smoothly deviates from the target frequency response. It is perfectly fine if the loudspeaker deviates from the target SPL, provided that it does so smoothly.
The SPL is only part of the entire cost function. The other parameters would be the directivity index and beamwidth. However the same issues arise there that I can't optimize frequency dependant behaviour.
Thanks in advance!
Hidde
Acculution ApS
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
12 months ago
Aug 22, 2023, 3:45 a.m. EDT
Updated:
12 months ago
Aug 22, 2023, 3:46 a.m. EDT
"Then I can define my optimization criteria as (SPL_measured - SPL_target)^2, but the SPL_measured is frequency dependant."
It seems that you think that the SPL_target has to a constant, but that is not the case, it too will be frequency dependent, or at least can be. Or am I misunderstanding you problem? This does not seem as a COMSOL issue, but a general issue about how to define targets across a frequency range, and no matter how you define them, you always risk getting a result that fits with the mathematical targets, but is still not what you really wanted if you just put the target down in words. So yes, you can get dips or peaks in the final response, but there are typically ways to avoid that, or at least lessen the problem.
The other link you have to a question seems different from what you are looking for. They want to optimize for the actual average value across all frequencies as a single number, whereas you want smoothness across the frequency response. Looking only at the average like that would not guarantee smoothness at all.
-------------------
René Christensen, PhD
Acculution ApS
www.acculution.com
info@acculution.com
"Then I can define my optimization criteria as (SPL_measured - SPL_target)^2, but the SPL_measured is frequency dependant."
It seems that you think that the SPL_target has to a constant, but that is not the case, it too will be frequency dependent, or at least can be. Or am I misunderstanding you problem? This does not seem as a COMSOL issue, but a general issue about how to define targets across a frequency range, and no matter how you define them, you always risk getting a result that fits with the mathematical targets, but is still not what you really wanted if you just put the target down in words. So yes, you can get dips or peaks in the final response, but there are typically ways to avoid that, or at least lessen the problem.
The other link you have to a question seems different from what you are looking for. They want to optimize for the actual average value across all frequencies as a single number, whereas you want smoothness across the frequency response. Looking only at the average like that would not guarantee smoothness at all.
Please login with a confirmed email address before reporting spam
Posted:
12 months ago
Aug 22, 2023, 5:13 a.m. EDT
It seems that you think that the SPL_target has to a constant, but that is not the case, it too will be frequency dependent, or at least can be. Or am I misunderstanding you problem?
I understand that I can define an arbitrary frequency response in the objective (I refer to it as SPL_target in my previous comment). Similar to how we define the transfer function of a linear system, say 1/(s+1) we can very simply define such a curve in COMSOL by substituting s = j* omega). While the target is then clear it, like you said, doesn't guarantee smoothness of the curve.
Preferably we want to objective function to punish the behaviour that we do not want and reward the behaviour that we do want. Intuitively this would suggest that we want to minimize the variance (perhaps even convolute with a high pass filter and then minimize the variance). Kristian Ejlebjærg Jensen's comment suggests that it is difficult to compute the variance of frequency response in the objective function. Then the question arises, if we can't use operators in a loss function w.r.t. the simulation data, then how can we define a function that constraints our optimization problem such that only smooth solutions are considered?
The other link you have to a question seems different from what you are looking for. They want to optimize for the actual average value across all frequencies as a single number, whereas you want smoothness across the frequency response. Looking only at the average like that would not guarantee smoothness at all.
It is true that the question only considers the mean. However since Var(X) = E( (X-mean(X))^2), it seems fairly simple to compute the variance once you have the mean.
>It seems that you think that the SPL_target has to a constant, but that is not the case, it too will be frequency dependent, or at least can be. Or am I misunderstanding you problem?
I understand that I can define an arbitrary frequency response in the objective (I refer to it as SPL_target in my previous comment). Similar to how we define the transfer function of a linear system, say 1/(s+1) we can very simply define such a curve in COMSOL by substituting s = j* omega). While the target is then clear it, like you said, doesn't guarantee smoothness of the curve.
Preferably we want to objective function to punish the behaviour that we do not want and reward the behaviour that we do want. Intuitively this would suggest that we want to minimize the variance (perhaps even convolute with a high pass filter and then minimize the variance). Kristian Ejlebjærg Jensen's comment suggests that it is difficult to compute the variance of frequency response in the objective function. Then the question arises, if we can't use operators in a loss function w.r.t. the simulation data, then how can we define a function that constraints our optimization problem such that only smooth solutions are considered?
>The other link you have to a question seems different from what you are looking for. They want to optimize for the actual average value across all frequencies as a single number, whereas you want smoothness across the frequency response. Looking only at the average like that would not guarantee smoothness at all.
It is true that the question only considers the mean. However since Var(X) = E( (X-mean(X))^2), it seems fairly simple to compute the variance once you have the mean.
Acculution ApS
Certified Consultant
Please login with a confirmed email address before reporting spam
Posted:
12 months ago
Aug 22, 2023, 7:46 a.m. EDT
I have had similar challenges, only with topology optimization. I have some work-arounds that are proprietary for now involving dynamically changing targets, but for now I think you should try with the standard approach first just with some target 'filter' function and see if the issues mentioned occur or not. It becomes particular problematic when both on-axis and off-axis is desired smooth but with no particular target curves easily defined, so I fully understand what you are trying to achieve.
-------------------
René Christensen, PhD
Acculution ApS
www.acculution.com
info@acculution.com
I have had similar challenges, only with topology optimization. I have some work-arounds that are proprietary for now involving dynamically changing targets, but for now I think you should try with the standard approach first just with some target 'filter' function and see if the issues mentioned occur or not. It becomes particular problematic when both on-axis and off-axis is desired smooth but with no particular target curves easily defined, so I fully understand what you are trying to achieve.