CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problem with UDF in 2D

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2019, 07:52
Default Problem with UDF in 2D
  #1
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Dear Foamers,



I want to simulate a deforming wall in 2D. The deforming depends on the temperature gradient, and I used the macro
C_T_G(c,t)[0] for the gradient in x-direction. But when I want to use this in the deforming equation, the simulation stops and fluent window closes.

I tried a simulation in 3D and it works.

Can anybody help me?



Thank you!
ana86 is offline   Reply With Quote

Old   April 2, 2019, 12:05
Default
  #2
New Member
 
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 13
sanketdange2007 is on a distinguished road
Could you please post your UDF for 2D?
sanketdange2007 is offline   Reply With Quote

Old   April 3, 2019, 03:01
Default
  #3
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Sorry for forgetting to post the udf.



#include „udf.h“

DEFINE_GRID_MOTION(deformingmesh,domain,dt,time,dt ime)
{
Thread *tf = DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(dx);
real T, gradTx;
int n;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));


begin_f_loop(f,tf)
{
T = F_T(f,tf);
gradTx = C_T_G(F_C0(f,tf),tf->t0)[0];

f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);
dx = 0.0001 * gradTx;
NV_S(dx, *=, dtime);
NV_V(NODE_COORD(v), +=, dx);
}
}
end_f_loop(f,tf);
}

Last edited by ana86; April 4, 2019 at 02:07.
ana86 is offline   Reply With Quote

Old   April 3, 2019, 07:04
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
DEFINE_GRID_MOTION(deformingmesh,domain,dt,time,dt ime)
,dt ime) in your code has space?

best regards
AlexanderZ is offline   Reply With Quote

Old   April 4, 2019, 02:07
Default
  #5
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
Code:
DEFINE_GRID_MOTION(deformingmesh,domain,dt,time,dt ime)
,dt ime) in your code has space?

best regards



Thank you, but that is just a mistake I made, when I copied the udf to this forum.
ana86 is offline   Reply With Quote

Old   April 4, 2019, 03:34
Default
  #6
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
ansys fluent customization manual
there is a chapter: DEFINE_GRID_MOTION
with example, which maybe you use as a basis of this UDF

what is the difference between that code and yours?

Code:
gradTx = C_T_G(F_C0(f,tf),tf->t0)[0];
dx = 0.0001 * gradTx;
gradTx is a scalar
dx is a vector
this could be the problem

you've told
Quote:
I tried a simulation in 3D and it works.
that was other UDF isnt it?

best regards
AlexanderZ is offline   Reply With Quote

Old   April 4, 2019, 04:03
Default
  #7
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
ansys fluent customization manual
there is a chapter: DEFINE_GRID_MOTION
with example, which maybe you use as a basis of this UDF

what is the difference between that code and yours?

Code:
gradTx = C_T_G(F_C0(f,tf),tf->t0)[0];
dx = 0.0001 * gradTx;
gradTx is a scalar
dx is a vector
this could be the problem

you've told
that was other UDF isnt it?

best regards

Thank you, that's wrong, of course. But unfortunately this ist not the problem. I also used dx[0], and it didn't work.

In 3D i use the same udf with

gradTx = C_T_G(F_C0(f,tf),tf->t0)[0]
gradTy = C_T_G(F_C0(f,tf),tf->t0)[1]
gradTz = C_T_G(F_C0(f,tf),tf->t0)[2]
ana86 is offline   Reply With Quote

Old   April 4, 2019, 23:26
Default
  #8
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
this is a problem, fix it

best regards
AlexanderZ is offline   Reply With Quote

Old   April 5, 2019, 02:08
Default
  #9
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
this is a problem, fix it

best regards

What do you mean? dx and dx[0]? I fixed it and it does not work.
ana86 is offline   Reply With Quote

Old   April 5, 2019, 03:04
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
how did you fix it?
change x to x[0] ???
its not a solution

best regards
AlexanderZ is offline   Reply With Quote

Old   April 5, 2019, 06:27
Default
  #11
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Ok, maybe I made a mistake...



But now I tried in 3D again the following code and it doesn't work anymore...



#include "udf.h"


DEFINE_GRID_MOTION(grid_motion,domain,dt,time,dtim e)
{
Thread *tf = DT_THREAD(dt);
face_t f;

Node *v;
int n;
real NV_VEC(dx);
real NV_VEC(DX);
real NV_VEC(gradT);
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
NV_D(DX, =, 1.e-9,1.e-9,1.e-9);
NV_D(gradT, =, 0.0, 0.0, 0.0);

begin_f_loop(f,tf)
{

gradT[0] = C_T_G(F_C0(f,tf),tf->t0)[0];
gradT[1] = C_T_G(F_C0(f,tf),tf->t0)[1];
gradT[2] = C_T_G(F_C0(f,tf),tf->t0)[2];

f_node_loop(f,tf,n)
{
v = F_NODE(f,tf,n);

if(NODE_POS_NEED_UPDATE(v))
{
NODE_POS_UPDATED(v);

NV_V(DX, *=, gradT);
NV_V(dx, +=, DX);

NV_S(dx,*=,dtime);
NV_V(NODE_COORD(v), +=, dx);

}
}
}
end_f_loop(f,tf);
}



if I neglect the line NV_V(DX, *=, gradT); it works.
ana86 is offline   Reply With Quote

Old   April 5, 2019, 06:59
Default
  #12
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
try
Code:
NV_D(gradT, =, C_T_G(F_C0(f,tf),tf->t0)[0], C_T_G(F_C0(f,tf),tf->t0)[1], C_T_G(F_C0(f,tf),tf->t0)[2]);
instead of
Code:
gradT[0] = C_T_G(F_C0(f,tf),tf->t0)[0];
gradT[1] = C_T_G(F_C0(f,tf),tf->t0)[1];
gradT[2] = C_T_G(F_C0(f,tf),tf->t0)[2];
also Im not sure about tf->t0 part, try THREAD_T0(tf) if previous change is not a solution

best regards
AlexanderZ is offline   Reply With Quote

Old   April 5, 2019, 07:45
Default
  #13
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Thank you for your help. I tried both solutions, but unfortunately it still does not work :-(
ana86 is offline   Reply With Quote

Old   April 8, 2019, 01:55
Default
  #14
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
check what value C_T_G returns

best regards
AlexanderZ is offline   Reply With Quote

Old   April 8, 2019, 10:36
Default
  #15
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
I checked, or rather I tried, but fluent also breaks up the simulation. Maybe there is something wrong with my setup...
ana86 is offline   Reply With Quote

Old   April 10, 2019, 09:26
Default
  #16
New Member
 
Join Date: Apr 2019
Posts: 28
Rep Power: 7
ana86 is on a distinguished road
Hey Alexander,

I found the error. I made a mistake in the setup. Sorry for that... And thank you for your help !
ana86 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
Problem with DPM simulation with particles injection and EXECUTE_AT_THE_END UDF. Ari Fluent UDF and Scheme Programming 4 May 31, 2016 09:51
udf loading problem santu Fluent UDF and Scheme Programming 1 May 22, 2015 16:47
Vaporization pressure UDF property problem? lehoanganh07 Fluent UDF and Scheme Programming 1 September 13, 2014 11:59
Problem with my udf july Fluent UDF and Scheme Programming 3 June 20, 2010 07:56


All times are GMT -4. The time now is 18:54.