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

What changes required to use 2d program for 3d geometry

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 15, 2018, 01:01
Default What changes required to use 2d program for 3d geometry
  #1
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
For analysis of synthetic jet. to give the motion to vibrating membrane(diaphragm,diameter:50mm) for 2d geometry i used these logarithmic c program. now i wants to do same for 3g geometry.
Is this program work for it. Please give me suggestion if any modification is required.
C program:
#include "udf.h"
DEFINE_GRID_MOTION(logarithmic, domain, dt, time, dtime)
{ Thread *tf=DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(velocity),NV_VEC(axis);
real NV_VEC(origin),NV_VEC(rvec);
real loco;
real freq;
real amp;
real diam;
int n;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
freq=200;
amp=0.0002;
diam=0.050;
loco=2*3.141592654*amp*freq*cos(2*3.141592654*freq *time);
Message("time=%f,omeg=%f\n",time,loco);
NV_S(velocity,=,0.0);
NV_D(axis,=,0.0,1.0,0.0);
NV_D(origin,=,0.0,0.0,0.0);
begin_f_loop(f, tf)
{ f_node_loop(f, tf, n)
{ v=F_NODE (f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{ NODE_POS_UPDATED(v);
velocity[0]=loco*(1-(4*NODE_Y(v)*NODE_Y(v))/(diam*diam)+((8*NODE_Y(v)*NODE_Y(v))/(diam*diam))*(log((2*NODE_Y(v)+0.000000000001)/diam)));
NV_V_VS(rvec,=,NODE_COORD(v),+,velocity,*,dtime);
NV_V(NODE_COORD(v),=,rvec); } } }
end_f_loop (f, tf); }
tadevilas is offline   Reply With Quote

Old   October 15, 2018, 02:33
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
If you want to know if the program works, then try it...


Why ask us?
pakk is offline   Reply With Quote

Old   October 15, 2018, 03:04
Default
  #3
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
sir,
same program not work for 3d.
so what should changes required for 3d
tadevilas is offline   Reply With Quote

Old   October 15, 2018, 03:07
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Can you be more specific than "not work"?

- Does it compile? If not, what happens instead?
- Does it give warnings? If so, when and which?
- Does it give errors? If so, when and which?
- Does it run?
- Does it crash? If so, when does it crash?
- Does it give wrong results? If so, which? And which results did you expect?

If you describe your problem in more details, you will get an answer sooner.
pakk is offline   Reply With Quote

Old   October 15, 2018, 04:35
Default
  #5
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
sir
it give error after pressing RUN
divergence detected in AMG solver :x momentum
and in second try its show :negative cell volume detected
tadevilas is offline   Reply With Quote

Old   October 15, 2018, 04:41
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Is the orientation in your 3D-model the same as in your 2D-model?


As in: should the membrane vibrate into the X-direction in both models?
pakk is offline   Reply With Quote

Old   October 15, 2018, 05:34
Default
  #7
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road



sir
please refer the link.
tadevilas is offline   Reply With Quote

Old   October 15, 2018, 05:44
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
No, but thanks.
I am sorry, I was under the false impression that you wanted to get help in solving your problem. I would have been happy to do that.

But I now understand that you want somebody else to solve your problem. That is not what I want to do. I am deeply sorry for the confusion.
pakk is offline   Reply With Quote

Old   October 15, 2018, 05:52
Default
  #9
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
thanks sir
tadevilas is offline   Reply With Quote

Old   October 21, 2018, 11:12
Default 3d synthetic jet
  #10
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
I change the program for 3d.
But it's show the error msg that is udf library trying to load is not compiled for current platform.
I used visual Studio 2017 for as compiler. And some time it's give error fatal error C1189.
This is code. Please tell me how to avoid this error..


#include "udf.h"
DEFINE_GRID_MOTION(logarithmic, domain, dt, time, dtime)
{ Thread *tf=DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(velocity),NV_VEC(axis);
real NV_VEC(origin),NV_VEC(rvec);
real loco;
real freq;
real amp;
real diam;
int n;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
freq=200;
amp=0.00152;
diam=0.050;
loco=2*3.141592654*amp*freq*cos(2*3.141592654*freq *time);
Message("time=%f,omeg=%f\n",time,loco);
NV_S(velocity,=,0.0);
NV_D(axis,=,1.0,1.0,1.0);
NV_D(origin,=,0.0,0.0,0.0);
begin_f_loop(f, tf)
{ f_node_loop(f, tf, n)
{ v=F_NODE (f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{ NODE_POS_UPDATED(v);
velocity[2]=loco*(1-(4*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y(v ))))*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y (v)))))/(diam*diam)+((8*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_ Y(v)*NODE_Y(v))))*(sqrt((NODE_X(v)*NODE_X(v))+(NOD E_Y(v)*NODE_Y(v)))))/(diam*diam))*(log((2*(sqrt((NODE_X(v)*NODE_X(v))+( NODE_Y(v)*NODE_Y(v))))+0.000000000001)/diam)));
NV_V_VS(rvec,=,NODE_COORD(v),+,velocity,*,dtime);
NV_V(NODE_COORD(v),=,rvec); } } }
end_f_loop (f, tf); }
tadevilas is offline   Reply With Quote

Old   February 23, 2019, 14:12
Default
  #11
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
Hello sir.
I'm trying to do simulation with serial processor and it take to much time for this. So now I'm trying with parallel process (6 core) is there code previous upload code is same apply or any changes required for it to run with parallel processer
tadevilas is offline   Reply With Quote

Old   February 24, 2019, 15:13
Default
  #12
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
According to you, the previous code gave fatal error C1189 in serial mode.

It would be very strange if it would suddenly work in parallel mode.


So: please talk to the tadevilas from October 2018.
pakk is offline   Reply With Quote

Old   February 25, 2019, 02:46
Default
  #13
New Member
 
Vilas
Join Date: Oct 2018
Location: Pune maharashtra,india
Posts: 13
Rep Power: 7
tadevilas is on a distinguished road
Hello sir..
Now the code are run smoothly. I resolve this problem hence now I want to do it by parallel mod
tadevilas is offline   Reply With Quote

Old   February 25, 2019, 03:13
Default
  #14
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Then... Try it!


If you want help, then give information. What you tried, what went wrong, and so on.


We can not look on your screen!
pakk is offline   Reply With Quote

Old   October 16, 2022, 04:33
Default 2d analysis of synthetic jet using udf
  #15
New Member
 
Prasidh shetty
Join Date: Oct 2022
Posts: 10
Rep Power: 3
Spicy is on a distinguished road
I searched in the learning forum of Ansys and tried to find the course on 2d analysis using UDF, but I did not find a single piece of information related to it [specifically explaining everything related to the moving of the diaphragm using UDF]. Can you please help me with this, my group project is related to the 2d analysis using UDF [Synthetic Jet]. I even searched it on youtube but did not find information in which I would know how to move the diaphragm. this analysis is related to the first case that is quiescent flow.
Your help would be greatly appreciated.
Spicy is offline   Reply With Quote

Old   October 23, 2022, 03:46
Default
  #16
New Member
 
Prasidh shetty
Join Date: Oct 2022
Posts: 10
Rep Power: 3
Spicy is on a distinguished road
Quote:
Originally Posted by tadevilas View Post
I change the program for 3d.
But it's show the error msg that is udf library trying to load is not compiled for current platform.
I used visual Studio 2017 for as compiler. And some time it's give error fatal error C1189.
This is code. Please tell me how to avoid this error..


#include "udf.h"
DEFINE_GRID_MOTION(logarithmic, domain, dt, time, dtime)
{ Thread *tf=DT_THREAD(dt);
face_t f;
Node *v;
real NV_VEC(velocity),NV_VEC(axis);
real NV_VEC(origin),NV_VEC(rvec);
real loco;
real freq;
real amp;
real diam;
int n;
SET_DEFORMING_THREAD_FLAG(THREAD_T0(tf));
freq=200;
amp=0.00152;
diam=0.050;
loco=2*3.141592654*amp*freq*cos(2*3.141592654*freq *time);
Message("time=%f,omeg=%f\n",time,loco);
NV_S(velocity,=,0.0);
NV_D(axis,=,1.0,1.0,1.0);
NV_D(origin,=,0.0,0.0,0.0);
begin_f_loop(f, tf)
{ f_node_loop(f, tf, n)
{ v=F_NODE (f, tf, n);
if (NODE_POS_NEED_UPDATE(v))
{ NODE_POS_UPDATED(v);
velocity[2]=loco*(1-(4*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y(v ))))*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_Y(v)*NODE_Y (v)))))/(diam*diam)+((8*(sqrt((NODE_X(v)*NODE_X(v))+(NODE_ Y(v)*NODE_Y(v))))*(sqrt((NODE_X(v)*NODE_X(v))+(NOD E_Y(v)*NODE_Y(v)))))/(diam*diam))*(log((2*(sqrt((NODE_X(v)*NODE_X(v))+( NODE_Y(v)*NODE_Y(v))))+0.000000000001)/diam)));
NV_V_VS(rvec,=,NODE_COORD(v),+,velocity,*,dtime);
NV_V(NODE_COORD(v),=,rvec); } } }
end_f_loop (f, tf); }
i am using same code for 2d analysis in visual studio but it is showing many error like-
1] cannot find open source fie.
2] identifier logarithmic undefined; identifier domain undefined; identifier dt undefined etc
3]expected an expression
and there some more ... can help me solve this issue as I am not good at coding
Spicy 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
[DesignModeler] Fill tool - grouping the faces of a complicated geometry? HeikkiT ANSYS Meshing & Geometry 8 July 20, 2016 07:37
Problem Importing Geometry ProE to CFX fatb0y CFX 3 January 14, 2012 19:42
Update boundary conditions calculated by an external program CedricVH OpenFOAM 2 January 15, 2010 11:55
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
paraFoam reader for OpenFOAM 1.6 smart OpenFOAM Installation 13 November 16, 2009 21:41


All times are GMT -4. The time now is 17:34.