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

write a UDF to give a velocity boundary condition at an interior face

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 2 Post By upeksa
  • 1 Post By macfly

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 21, 2014, 19:08
Default write a UDF to give a velocity boundary condition at an interior face
  #1
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
I'm trying to write a UDF to give a velocity boundary condition at an interior face. The velocity condition is U.n=alpa*(C_P(c0,t0)-C_P(c1,t1)). When I'm trying to get velocity condition for C1 cells, error msg is coming. Can anyone advice me on this? Thank you.
udf
#include "udf.h"
DEFINE_PROFILE(edge_Velo,t,i)
{
real xf[ND_ND];
real xc[ND_ND];
real xe[ND_ND];
face_t f;
cell_t c1 ;
Thread*t1 ;
cell_t c0 ;
Thread*t0 ;
double _D=0;
begin_f_loop(f,t)
{
F_CENTROID(xf,f,t);
c1=F_C1(f,t) ;
t1=THREAD_T1(t);
C_CENTROID(xc,c1,t1);
c0=F_C0(f,t) ;
t0=THREAD_T0(t) ;
C_CENTROID(xe,c0,t0);

F_PROFILE(f,t,i) = -(0.000025*((C_P(c0,t0)-C_P(c1,t1)));
}
end_f_loop(f,thread)
}
Tharanga is offline   Reply With Quote

Old   December 26, 2014, 08:28
Default
  #2
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
What is your error message?


Quote:
Originally Posted by Tharanga View Post
I'm trying to write a UDF to give a velocity boundary condition at an interior face. The velocity condition is U.n=alpa*(C_P(c0,t0)-C_P(c1,t1)). When I'm trying to get velocity condition for C1 cells, error msg is coming. Can anyone advice me on this? Thank you.
udf
#include "udf.h"
DEFINE_PROFILE(edge_Velo,t,i)
{
real xf[ND_ND];
real xc[ND_ND];
real xe[ND_ND];
face_t f;
cell_t c1 ;
Thread*t1 ;
cell_t c0 ;
Thread*t0 ;
double _D=0;
begin_f_loop(f,t)
{
F_CENTROID(xf,f,t);
c1=F_C1(f,t) ;
t1=THREAD_T1(t);
C_CENTROID(xc,c1,t1);
c0=F_C0(f,t) ;
t0=THREAD_T0(t) ;
C_CENTROID(xe,c0,t0);

F_PROFILE(f,t,i) = -(0.000025*((C_P(c0,t0)-C_P(c1,t1)));
}
end_f_loop(f,thread)
}
behest is offline   Reply With Quote

Old   December 27, 2014, 20:45
Default
  #3
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
Quote:
Originally Posted by behest View Post
What is your error message?
This is the error massage and please help
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor
Tharanga is offline   Reply With Quote

Old   December 30, 2014, 07:18
Default
  #4
Member
 
Ali.E
Join Date: Sep 2010
Location: Lisboa
Posts: 83
Rep Power: 15
behest is on a distinguished road
I compiled the UDF, it works very well.
You recieved an access violation error, and this error means that UDF can not access a defined value in UDF. I do not have your Fluent file to check the UDF. If it is possible share your file you check the UDF.


Quote:
Originally Posted by Tharanga View Post
This is the error massage and please help
C:\PROGRA~1\ANSYSI~1\v145\fluent\fluent14.5.0\win6 4\3ddp\fl1450s.exe received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor
behest is offline   Reply With Quote

Old   December 30, 2014, 10:15
Default
  #5
Member
 
Join Date: Jul 2013
Posts: 80
Rep Power: 12
upeksa is on a distinguished road
You can not set any kind of define-profile in an interior boundary. I think that you have a boundary which happens to be interior and you set it as velocity-inlet.
I have not checked it, but I guess that both THREAD_T1 and F_C1 can only be used if that cell or thread exists, and I think that is not your case.
Anyway, if for some reason you want to set a velocity inlet boundary condition in an interior boundary, I would leave that boundary as interior and I would use a momentum source instead, but that still sounds weird to me.
Tharanga and iteration like this.
upeksa is offline   Reply With Quote

Old   December 30, 2014, 12:05
Default
  #6
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
Indeed, a boundary condition on an interior face sounds weird. I think you should redo the geometry/mesh, make a small zone where you want to fix the velocities, e.g. a zone with only 1 cell layer, and then in Fluent: Cell Zone Conditions => Edit... => Fixed Values...
Tharanga likes this.
macfly is offline   Reply With Quote

Old   January 5, 2015, 20:09
Default
  #7
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
Hi, there are two regions larger one is porous. I wanted to make velocity v=const.*P at the interface. P is the pressure difference taking from the nearest cell values. Can anyone suggest something pls? Thank you very much for the replies.
Attached Images
File Type: png fd.png (20.6 KB, 117 views)
Tharanga is offline   Reply With Quote

Old   January 6, 2015, 01:25
Default
  #8
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
I have no idea how you can achieve that, all kind of questions are popping in my head:
- 2D or 3D? steady or transient?
- you want to define velocity vectors that are normal to the interface? the interface is the yellow circle?
- it looks like a little coding nightmare: trying to retrieve pressure on both sides of the interface, calculate some angles, calculate x-y-z velocity components, ...
macfly is offline   Reply With Quote

Old   January 6, 2015, 03:32
Default
  #9
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
It is 3D and Steady state simulation. Yes, I want to define normal velocity (radial). Yellow circle is a non porous region (Cylinder) and cube is porous (hollow). Interface or interior lies between these two regions and want to access pressure values in order to give velocity. This is actually trying to implement a permeable BC at the interface. Indeed, it is a nightmare.. big time . Really appreciate your suggestions. Thank you
Tharanga is offline   Reply With Quote

Old   February 3, 2015, 17:36
Default
  #10
New Member
 
Xu Su
Join Date: Jul 2014
Posts: 3
Rep Power: 11
sxdl92victor is on a distinguished road
Quote:
Originally Posted by Tharanga View Post
It is 3D and Steady state simulation. Yes, I want to define normal velocity (radial). Yellow circle is a non porous region (Cylinder) and cube is porous (hollow). Interface or interior lies between these two regions and want to access pressure values in order to give velocity. This is actually trying to implement a permeable BC at the interface. Indeed, it is a nightmare.. big time . Really appreciate your suggestions. Thank you
Hello,
How about your simulation now? I met the same problems defining permeable membrane wall in FLUENT. It is pretty difficult to define the velocity.
sxdl92victor is offline   Reply With Quote

Old   February 3, 2015, 18:19
Default
  #11
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
Hi,
I couldn't do it and I just gave up. Specially, I was trying to give it at the interface and that was the difficult part. No success. What kind of problem are you dealing with? cheers!!
Tharanga is offline   Reply With Quote

Old   February 3, 2015, 22:47
Default
  #12
New Member
 
Xu Su
Join Date: Jul 2014
Posts: 3
Rep Power: 11
sxdl92victor is on a distinguished road
Quote:
Originally Posted by Tharanga View Post
Hi,
I couldn't do it and I just gave up. Specially, I was trying to give it at the interface and that was the difficult part. No success. What kind of problem are you dealing with? cheers!!
I'm sorry to hear that you gave up. Have you ever tried to use other CFD software such as CFX?
My project is simulating membrane desalination process which is pretty similar with your problem. I also need to define velocity at the membrane side(interior or interface) to obey the mass conservation law.
Now, I'm trying to learn how to use mass source and wish it can solve this problem.
sxdl92victor is offline   Reply With Quote

Old   February 3, 2015, 23:22
Default
  #13
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
In order to implement condition (above) at the interface, needs to change the interpolation scheme or the pressure velocity coupling method (I think). I'm trying few things at the moment lets see and Hope for the best. Good luck with you work. cheers
Tharanga is offline   Reply With Quote

Old   February 3, 2015, 23:25
Default
  #14
New Member
 
Xu Su
Join Date: Jul 2014
Posts: 3
Rep Power: 11
sxdl92victor is on a distinguished road
Quote:
Originally Posted by Tharanga View Post
In order to implement condition (above) at the interface, needs to change the interpolation scheme or the pressure velocity coupling method (I think). I'm trying few things at the moment lets see and Hope for the best. Good luck with you work. cheers
Good luck. Keep in touch.
sxdl92victor is offline   Reply With Quote

Old   June 4, 2015, 16:40
Default
  #15
New Member
 
Join Date: Jun 2015
Posts: 1
Rep Power: 0
Aerathon is on a distinguished road
Out of curiosity, have you figured out how to do it with UDF? I'm trying to model a cylinder with porous wall.
Aerathon is offline   Reply With Quote

Old   June 17, 2015, 23:02
Default
  #16
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
Quote:
Originally Posted by Aerathon View Post
Out of curiosity, have you figured out how to do it with UDF? I'm trying to model a cylinder with porous wall.
Sad to say It didn't work. cheers
Tharanga is offline   Reply With Quote

Old   January 5, 2018, 08:14
Default velocity and pressure on interior face
  #17
New Member
 
Prabhu R
Join Date: Nov 2017
Posts: 13
Rep Power: 8
Prabhumsrit is on a distinguished road
I want to measure the velocity and pressure on interior face in Nozzle design and also required further thrust calculation. Please share any details with u and it is useful for my project and
Prabhumsrit is offline   Reply With Quote

Old   January 6, 2018, 18:20
Default
  #18
New Member
 
Tharanga Jayathungage Don
Join Date: Sep 2014
Location: Auckland
Posts: 25
Rep Power: 11
Tharanga is on a distinguished road
Send a message via Skype™ to Tharanga
Hi,
Can you explain bit more? I manage to create a one cell thickness layer and implement my BCs in there. I think specifying a BC at an interior surface does not work as we dealing with the cell-based calculations. Thanks
Tharanga is offline   Reply With Quote

Old   May 23, 2018, 11:08
Default
  #19
New Member
 
Jianan Zhao
Join Date: Nov 2017
Posts: 1
Rep Power: 0
crotchet is on a distinguished road
Quote:
Originally Posted by Tharanga View Post
Hi,
Can you explain bit more? I manage to create a one cell thickness layer and implement my BCs in there. I think specifying a BC at an interior surface does not work as we dealing with the cell-based calculations. Thanks
Hi

I had the similar problem as you, which was defining a velocity profile on an interior face or wall. This link might be useful for you

http://cape-forum.com/index.php?topic=1248.0

However, after following the steps mentioned in above link, you need to define a opposite velocity profile on the other slit wall. This method works for my case, and hope it can help.

Jianan
crotchet is offline   Reply With Quote

Old   August 5, 2018, 04:29
Default Problem in temperature calculation using udf
  #20
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 8
gouravjee is on a distinguished road
Quote:
Originally Posted by upeksa View Post
You can not set any kind of define-profile in an interior boundary. I think that you have a boundary which happens to be interior and you set it as velocity-inlet.
I have not checked it, but I guess that both THREAD_T1 and F_C1 can only be used if that cell or thread exists, and I think that is not your case.
Anyway, if for some reason you want to set a velocity inlet boundary condition in an interior boundary, I would leave that boundary as interior and I would use a momentum source instead, but that still sounds weird to me.
I have to calculate heat transfer losses from radial surface of the cylinder.
I have written a udf for this but it is showing "segmentation fault".
can you tell me where might be the problem ?
Code:
#include "udf.h"


DEFINE_PROFILE(fluxloss,thread,position)
{
real h;
real T_ext;
face_t f;
begin_f_loop(f,thread)
{
h = 10;
T_ext = 300;
F_PROFILE(f,thread,position) =-10*(WALL_TEMP_INNER(f,thread)-T_ext);
}
end_f_loop(f,thread)

}
gouravjee is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Wind turbine simulation Saturn CFX 58 July 3, 2020 01:13
UDF setting wall boundary condition with a DEFINE_PROFILE NLao FLUENT 3 September 2, 2019 00:33
map outlet boundary profile as an inlet condition using UDF Daniel_Khazaei Fluent UDF and Scheme Programming 2 June 20, 2016 11:53
Time dependant pressure boundary condition yosuke1984 OpenFOAM Verification & Validation 3 May 6, 2015 06:16
UDF Boundary Condition Victor FLUENT 2 November 6, 2003 11:37


All times are GMT -4. The time now is 09:19.