|
[Sponsors] |
April 2, 2019, 07:52 |
Problem with UDF in 2D
|
#1 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
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! |
|
April 2, 2019, 12:05 |
|
#2 |
New Member
Sanket Dange
Join Date: Jul 2013
Posts: 9
Rep Power: 13 |
Could you please post your UDF for 2D?
|
|
April 3, 2019, 03:01 |
|
#3 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
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. |
|
April 3, 2019, 07:04 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
DEFINE_GRID_MOTION(deformingmesh,domain,dt,time,dt ime) best regards |
|
April 4, 2019, 02:07 |
|
#5 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
||
April 4, 2019, 03:34 |
|
#6 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; dx is a vector this could be the problem you've told Quote:
best regards |
||
April 4, 2019, 04:03 |
|
#7 | |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Quote:
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] |
||
April 4, 2019, 23:26 |
|
#8 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
this is a problem, fix it
best regards |
|
April 5, 2019, 02:08 |
|
#9 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
||
April 5, 2019, 03:04 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
how did you fix it?
change x to x[0] ??? its not a solution best regards |
|
April 5, 2019, 06:27 |
|
#11 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
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. |
|
April 5, 2019, 06:59 |
|
#12 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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]); 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]; best regards |
|
April 5, 2019, 07:45 |
|
#13 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Thank you for your help. I tried both solutions, but unfortunately it still does not work :-(
|
|
April 8, 2019, 01:55 |
|
#14 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
check what value C_T_G returns
best regards |
|
April 8, 2019, 10:36 |
|
#15 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
I checked, or rather I tried, but fluent also breaks up the simulation. Maybe there is something wrong with my setup...
|
|
April 10, 2019, 09:26 |
|
#16 |
New Member
Join Date: Apr 2019
Posts: 28
Rep Power: 7 |
Hey Alexander,
I found the error. I made a mistake in the setup. Sorry for that... And thank you for your help ! |
|
|
|
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 |