Kristian Ejlebjærg Jensen
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 year ago                            
                            
                                08.10.2024, 04:12 GMT-4                            
                        
                        Updated:
                            
                                1 year ago                            
                            
                                08.10.2024, 06:20 GMT-4                            
                        
                        
                                                    Hi Casper
It is correct that the sensitivity study step only supports computation of a single sensitivity, but you can have several inner solutions with each their sensitivity, so you might get something close to what you want, if you
- make an inner sweep with a parameter that does not affect the forward solution 
- use an iterative solver (so that the first forward computation can be somewhat recycled) 
- make the objective depend on the sweep parameter 
Oftentimes, it is significantly easier and faster to solve optimization problems using the built-in   COMSOL functionality. Is there anything preventing you from using one of the optimization study steps?
Best regards,
Kristian E. Jensen
Technical Product Manager, Optimization
                                                 
                                                
                            Hi Casper
It is correct that the sensitivity study step only supports computation of a single sensitivity, but you can have several inner solutions with each their sensitivity, so you might get something close to what you want, if you
1. make an inner sweep with a parameter that does not affect the forward solution 
2. use an iterative solver (so that the first forward computation can be somewhat recycled) 
3. make the objective depend on the sweep parameter
Oftentimes, it is significantly easier and faster to solve optimization problems using the built-in   COMSOL functionality. Is there anything preventing you from using one of the optimization study steps?
Best regards,
Kristian E. Jensen
Technical Product Manager, Optimization                        
                                                
                                                                                                            
                                             
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                1 year ago                            
                            
                                18.10.2024, 05:47 GMT-4                            
                        
                        
                                                    
  Hi Casper
  
  It is correct that the sensitivity study step only supports computation of a single sensitivity, but you can have several inner solutions with each their sensitivity, so you might get something close to what you want, if you
  
  
  - make an inner sweep with a parameter that does not affect the forward solution 
- use an iterative solver (so that the first forward computation can be somewhat recycled) 
- make the objective depend on the sweep parameter 
Oftentimes, it is significantly easier and faster to solve optimization problems using the built-in   COMSOL functionality. Is there anything preventing you from using one of the optimization study steps?
  
  Best regards,
  
  Kristian E. Jensen
  
  Technical Product Manager, Optimization
Hi Kristian,
Thanks for the reply! I have tried the parametric sweep and function sweep, and also the iterative solver. One of the objectives, f1, consist of the first 6 eigenfrequencies, and the other objective, f2, is a simple volume integral of the control variable field. I swept some parameter k over a list containing 1's and 2's, and made the overall objective f = f1(k==1) + f2(k==2), so that it effectively switches between f1 and f2
I made sure that the solver saves solutions and reuses old ones, which does improve the efficiency somewhat for 'repeated' solves. However, it appears that every iteration of the sweep takes the same amount of time, even when I completely remove f1 (solid.freq) completely from the expression. Also, the iterative solvers for eigenfrequency (BigCGstab and GMRES) are significantly slower than the direct solver somehow.
As for the volume integral f2, it should not be dependent on the state-variable. I could define some dummy study that contains 'easy' physics, but still comsol does not allow a sensitivity analysis without physics.
Why not use the optimization module? Doing this would be ideal, and I have never noticed computational redundancy here (i.e. adding a volume integral and its sensitivity resulted in no extra computational time). Using the Matlab-LiveLink is partially just what some partners want (coupling it to their own software at some point), and continuation or control over certain parameters may be easier using external optimization. Most importantly however, I need modeshape-dependent objectives and sensitivities, which comsol does not yet support. The one solution to everything would be to just export matrices and solve externally, at a significant cost of implementation ease ):
Kind regards,
Casper
                                                 
                                                
                            >Hi Casper
>
>It is correct that the sensitivity study step only supports computation of a single sensitivity, but you can have several inner solutions with each their sensitivity, so you might get something close to what you want, if you
>
>1. make an inner sweep with a parameter that does not affect the forward solution 
>
>2. use an iterative solver (so that the first forward computation can be somewhat recycled) 
>
>3. make the objective depend on the sweep parameter
>
>Oftentimes, it is significantly easier and faster to solve optimization problems using the built-in   COMSOL functionality. Is there anything preventing you from using one of the optimization study steps?
>
>Best regards,
>
>Kristian E. Jensen
>
>Technical Product Manager, Optimization
Hi Kristian,
Thanks for the reply! I have tried the parametric sweep and function sweep, and also the iterative solver. One of the objectives, f1, consist of the first 6 eigenfrequencies, and the other objective, f2, is a simple volume integral of the control variable field. I swept some parameter k over a list containing 1's and 2's, and made the overall objective f = f1*(k==1) + f2*(k==2), so that it effectively switches between f1 and f2
I made sure that the solver saves solutions and reuses old ones, which does improve the efficiency somewhat for 'repeated' solves. However, it appears that every iteration of the sweep takes the same amount of time, even when I completely remove f1 (solid.freq) completely from the expression. Also, the iterative solvers for eigenfrequency (BigCGstab and GMRES) are significantly slower than the direct solver somehow.
As for the volume integral f2, it should not be dependent on the state-variable. I could define some dummy study that contains 'easy' physics, but still comsol does not allow a sensitivity analysis without physics.
Why not use the optimization module? Doing this would be ideal, and I have never noticed computational redundancy here (i.e. adding a volume integral and its sensitivity resulted in no extra computational time). Using the Matlab-LiveLink is partially just what some partners want (coupling it to their own software at some point), and continuation or control over certain parameters may be easier using external optimization. Most importantly however, I need modeshape-dependent objectives and sensitivities, which comsol does not yet support. The one solution to everything would be to just export matrices and solve externally, at a significant cost of implementation ease ):
Kind regards,
Casper