Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Need help setting up optimization objective function in V4

Please login with a confirmed email address before reporting spam

I'm trying to set up an objective function with the optimization feature in V4, and unable to find any help in the documentation, model library, or in forums.

My objective function is to minimize (u - 100)^2, where u is the integral of a variable on a given boundary.

I've added the optimization node and a boundary integral to compute u, but don't know how to set up the square of the difference.

This seems like it should be so simple, but I've gotten nowhere. Can anyone advise?

Steve Conrad

6 Replies Last Post 12 juil. 2010, 20:11 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 8 juil. 2010, 01:46 UTC−4
Hi,

Did you add the objective (global or integral) to your opt node? Seems to me just writing the (u-100)^2 in objective expression field should do the job. Can you be more specific about what is the problem.

Kind regards,
Nenad
Hi, Did you add the objective (global or integral) to your opt node? Seems to me just writing the (u-100)^2 in objective expression field should do the job. Can you be more specific about what is the problem. Kind regards, Nenad

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 8 juil. 2010, 23:37 UTC−4
Thanks Nenad, it doesn't appear to be that simple.

Putting the expression (u-100)^2 in the expression field results in the integral of the entire expression. I just want to integrate a velocity variable (yielding u), and apply the resulting integral of this variable to the above expression.

Steve
Thanks Nenad, it doesn't appear to be that simple. Putting the expression (u-100)^2 in the expression field results in the integral of the entire expression. I just want to integrate a velocity variable (yielding u), and apply the resulting integral of this variable to the above expression. Steve

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 10 juil. 2010, 11:28 UTC−4
Hi

I believe you should use a scalar variable as you have integrated your "u" before (watch out for naming conflicts COMSOL uses already "p,q,r,s,u,v,w,x,y,z", so you are in fact talking about scalars, no ?

Now, as you have a single variable, you could probably use only a "PDE constrined optimisation" without the optimisation module at all.
I usually refer to the example of the structural "Torsional moment" load application p.69 in V3.5a smeug.pdf , where you optimise the moment applied to the desired one, and the applied moment is integrated via a coupling variable

hope this helps
Ivar
Hi I believe you should use a scalar variable as you have integrated your "u" before (watch out for naming conflicts COMSOL uses already "p,q,r,s,u,v,w,x,y,z", so you are in fact talking about scalars, no ? Now, as you have a single variable, you could probably use only a "PDE constrined optimisation" without the optimisation module at all. I usually refer to the example of the structural "Torsional moment" load application p.69 in V3.5a smeug.pdf , where you optimise the moment applied to the desired one, and the applied moment is integrated via a coupling variable hope this helps Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 11 juil. 2010, 23:46 UTC−4
Thanks, Ivar

I have not integrated u outside of the optimization step, so let me explain in more detail what I want to do. Perhaps I am approaching it wrong.

I have a fluid flow problem (2D axisymmetric) in a domain. My control variable is the permeability at an inlet boundary that allows fluid to enter the domain. Obivously for a given pressure gradient, the permeability will determine the fluid flow. I want to determine the value of permeability such that the volumetric flow that leaves the domain at the outlet is equal to an experimentally determined value (a parameter estimation problem). Thus I want to set up an optimization problem where the objective function returns a minimum when the exit flow is equal to the experimental value. To this end, I chose the objective function (U-10)^2, where U represents the integral of velocity (u) across the outlet to give me flow, and 10 is the experimentally determined value. I square the difference to make sure there is a minimum when the values are equal.

My impression is that I can set up an integral objective function to calculate U, the integral of u. I just don't know how to set up the rest of the optimization interface to achieve what I want to do. If I put the entire expression (u-10)^2 into the integral objective function, then it appears to me that it will integrate the whole expression, and not just u, and that is not what I want.

If anyone has any example of using the optimization feature, please let me know. There is not a single example of using this interface in the COMSOL documentation.
Thanks, Ivar I have not integrated u outside of the optimization step, so let me explain in more detail what I want to do. Perhaps I am approaching it wrong. I have a fluid flow problem (2D axisymmetric) in a domain. My control variable is the permeability at an inlet boundary that allows fluid to enter the domain. Obivously for a given pressure gradient, the permeability will determine the fluid flow. I want to determine the value of permeability such that the volumetric flow that leaves the domain at the outlet is equal to an experimentally determined value (a parameter estimation problem). Thus I want to set up an optimization problem where the objective function returns a minimum when the exit flow is equal to the experimental value. To this end, I chose the objective function (U-10)^2, where U represents the integral of velocity (u) across the outlet to give me flow, and 10 is the experimentally determined value. I square the difference to make sure there is a minimum when the values are equal. My impression is that I can set up an integral objective function to calculate U, the integral of u. I just don't know how to set up the rest of the optimization interface to achieve what I want to do. If I put the entire expression (u-10)^2 into the integral objective function, then it appears to me that it will integrate the whole expression, and not just u, and that is not what I want. If anyone has any example of using the optimization feature, please let me know. There is not a single example of using this interface in the COMSOL documentation.

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 juil. 2010, 02:23 UTC−4

If anyone has any example of using the optimization feature, please let me know. There is not a single example of using this interface in the COMSOL documentation.


Hi,

The model libraries in COMSOL version 4.0a contain several example models using the Optimization interface:

* COMSOL Multiphysics: loaded_knee (Topology Optimization of a Loaded Knee Structure)
* Acoustics Module: horn_shape_optimization (Optimizing the Shape of a Horn)
* Chemical Reaction Engineering Module: microreactor_optimization (Optimization of a Catalytic Microreactor)
* Earth Science Module: aquifer_characterization (Aquifer Characterization)

Search tip: type

optimization

in the Search field on top of the Model Library window and click Search. That search finds all models where optimization appears in the model name or description.
[QUOTE] If anyone has any example of using the optimization feature, please let me know. There is not a single example of using this interface in the COMSOL documentation. [/QUOTE] Hi, The model libraries in COMSOL version 4.0a contain several example models using the Optimization interface: * COMSOL Multiphysics: loaded_knee (Topology Optimization of a Loaded Knee Structure) * Acoustics Module: horn_shape_optimization (Optimizing the Shape of a Horn) * Chemical Reaction Engineering Module: microreactor_optimization (Optimization of a Catalytic Microreactor) * Earth Science Module: aquifer_characterization (Aquifer Characterization) Search tip: type optimization in the Search field on top of the Model Library window and click Search. That search finds all models where optimization appears in the model name or description.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 12 juil. 2010, 20:11 UTC−4
Thanks, Magnus, for the correction. I had referred to the User Guide and Reference Manual, but failed to search the model library

This gave me some insight. It appears that I'll have to compute my error function outside of the optimization feature and refer to that result when setting up optimization, rather than trying to compute the error function within the optimization feature itself.

Steve
Thanks, Magnus, for the correction. I had referred to the User Guide and Reference Manual, but failed to search the model library This gave me some insight. It appears that I'll have to compute my error function outside of the optimization feature and refer to that result when setting up optimization, rather than trying to compute the error function within the optimization feature itself. Steve

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.