CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   mesh morpher/optimizer (https://www.cfd-online.com/Forums/fluent-udf/94858-mesh-morpher-optimizer.html)

scsasha November 28, 2011 11:08

mesh morpher/optimizer
 
Hi every body.
I have a problem with my UDF for defining the objective function for design optimization of an airfoil. Here is my UDF:

#include"udf.h"
#include"dynamesh_tools.h"
#include"morpher.h"
# define ZONEID 3
DEFINE_ON_DEMAND(objective_function)
{
real x_cg[2];
real f_glob[2];
real m_glob[2];
real drag=0.0;
Domain *domain;
Thread *thread;
domain=Get_Domain(1);
thread = Lookup_Thread(domain,ZONEID);
x_cg[0] = 0;
Compute_Force_And_Moment(domain,thread,x_cg,f_glob ,m_glob,TRUE);
drag=f_glob[0]*0.9962+f_glob[1]*0.08716;
RP_Set_Real(
"morpher/objective_function",drag);
}

It is compiled successfully but when I check it through execute on demand or when I use it in the optimization, I receive this error message:

Error: rp-var-value-local-set!: undefined variable
Error Object: morpher/objective_function

I use win 64 bit and Visual Stodio 2010 and Fluent 13. I would be happy if anybody can help me with this problem.

fox000002 November 29, 2011 10:42

http://www.cfd-online.com/Forums/newreply.php?do=newreply&noquote=1&p=333824#
 
Execute following command before loading your own UDF.

Code:

/define/enable-mesh-morpher-optimizer? yes

scsasha December 1, 2011 10:51

Quote:

Originally Posted by fox000002 (Post 333976)
Execute following command before loading your own UDF.

Code:

/define/enable-mesh-morpher-optimizer? yes


Thank you so much but it still doesnt work!:confused:

scsasha December 1, 2011 11:02

Thank you so much but it still doesnt work!:confused:

fox000002 December 2, 2011 05:52

The rpvar name is wrong.

Code:

RP_Set_Real("morpher/objective-function",drag);

scsasha December 5, 2011 05:33

Thank you so much for your help. It is working now!;)

Ibrar January 11, 2013 11:01

Hi all
I think you people are very good with optimization
I am also trying to optimize the shape of chemical reactor. I have some basic questions
1) what is the meaning of parameters in the optimizer windows??
2) how can we set their max and minimum values?
3) I am solving 2D axisymmetic flow through a pipe" with a chemical reaction taking place inside it" and i want to optimize the shape of that pipe"optimized shape would be something like combination of nozzle diffuser type" should I define the optimization region over the whole axisymmetric domain or just on the area close to the wall.
4) i leant from the blog that people are interfacing matlab with fluent to do geometric optimization, I want to know why they are not using these biult in optimizer. of course there are certain limitation can you please give a take of that??
5) finally some idea of how to link matlab with fluent
Thanks in advance for your rime and concern
Ibrar

syavash August 31, 2014 18:23

Quote:

Originally Posted by scsasha (Post 333824)
Hi every body.
I have a problem with my UDF for defining the objective function for design optimization of an airfoil. Here is my UDF:

#include"udf.h"
#include"dynamesh_tools.h"
#include"morpher.h"
# define ZONEID 3
DEFINE_ON_DEMAND(objective_function)
{
real x_cg[2];
real f_glob[2];
real m_glob[2];
real drag=0.0;
Domain *domain;
Thread *thread;
domain=Get_Domain(1);
thread = Lookup_Thread(domain,ZONEID);
x_cg[0] = 0;
Compute_Force_And_Moment(domain,thread,x_cg,f_glob ,m_glob,TRUE);
drag=f_glob[0]*0.9962+f_glob[1]*0.08716;
RP_Set_Real(
"morpher/objective_function",drag);
}

It is compiled successfully but when I check it through execute on demand or when I use it in the optimization, I receive this error message:

Error: rp-var-value-local-set!: undefined variable
Error Object: morpher/objective_function

I use win 64 bit and Visual Stodio 2010 and Fluent 13. I would be happy if anybody can help me with this problem.

Dear scsasha

Could you tell us How many control points you have considered around the airfoil?

Thanks


All times are GMT -4. The time now is 06:04.