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

UDF for 3d boundary conditions problem in fluent

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

Like Tree1Likes
  • 1 Post By billwangard

Reply
 
LinkBack Thread Tools Display Modes
Old   July 15, 2013, 11:14
Default UDF for 3d boundary conditions problem in fluent
  #1
New Member
 
Pawan Hurnath
Join Date: Jun 2013
Posts: 5
Rep Power: 4
pawanh is on a distinguished road
Hi, I am trying to use a udf to model the temperature jump across a data center rack. I TRIED IN 2D successfully and now I am trying to extend the result to 3d but to no avail.

The udf which worked for the 2d is shown below. I trid using the same of 3d


/* udf for temperature jump across rack one*/
#include "udf.h"

DEFINE_PROFILE(temperature, thread, index)
{
Domain *domain= Get_Domain(1);
real x[ND_ND];
face_t f;
int Zone_ID=8;
Thread *t0=Lookup_Thread(domain,Zone_ID);

begin_f_loop(f,thread)
{
F_CENTROID(x,f,thread);
F_PROFILE(f,thread,index) =(F_T(f,t0)+3);
}
end_f_loop(f,thread)
}


I do not kno what changes do I need to bring to the udf to change in th 3d.
Initially I though that I should try looping over cells instead of looping over faces?

Any help ? what do you think?

quite urgent! please some one help me out
pawanh is offline   Reply With Quote

Old   July 15, 2013, 20:11
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 315
Rep Power: 12
blackmask will become famous soon enough
I do not know why this code works for 2D. Do the threads "t0" and "thread" have the same shape and same number of faces? You want the temperature jump between those two threads be 3K? You need to build a mapping between those two threads.
blackmask is offline   Reply With Quote

Old   July 15, 2013, 23:22
Default
  #3
New Member
 
Pawan Hurnath
Join Date: Jun 2013
Posts: 5
Rep Power: 4
pawanh is on a distinguished road
Yeah I want the temp jump to be 3k. What's a thread mapping and how do I do it?
pawanh is offline   Reply With Quote

Old   July 16, 2013, 09:00
Default
  #4
New Member
 
Pawan Hurnath
Join Date: Jun 2013
Posts: 5
Rep Power: 4
pawanh is on a distinguished road
This is sthe error I receive:

Received signal 1 [time 7/16/13 13:6:29]
1000000: /opt/ansys/v140/fluent/fluent14.0.0/lnamd64/3ddp/fluent.14.0.0 [0x14f6c44]
1000000: /opt/ansys/v140/fluent/fluent14.0.0/lnamd64/3ddp/fluent.14.0.0 [0x14f72e3]
1000000: /lib64/libpthread.so.0 [0x2b435edf9ca0]
1000000: libudf/lnamd64/3ddp/libudf.so(temperature+0x55) [0x2b4363f4c3c9]

Error [client] [time 7/16/13 13:6:29] fluent.14.0.0 received a fatal signal (SEGMENTATION VIOLATION).
999999: /opt/ansys/v140/fluent/fluent14.0.0/lnamd64/3ddp/fluent.14.0.0(CX_Primitive_Error+0x1f7) [0x14f7117]
999999: /opt/ansys/v140/fluent/fluent14.0.0/lnamd64/3ddp/fluent.14.0.0 [0x14f732f]
999999: /lib64/libpthread.so.0 [0x2b435edf9ca0]
999999: libudf/lnamd64/3ddp/libudf.so(temperature+0x55) [0x2b4363f4c3c9]
pawanh is offline   Reply With Quote

Old   July 16, 2013, 14:29
Default UDF for boundary condition
  #5
New Member
 
Bill Wangard
Join Date: Jan 2011
Posts: 21
Rep Power: 6
billwangard is on a distinguished road
This will most likely NOT work.

Why? because the face thread passed TO the DEFINE_PROFILE, "thread", is not the same thread as "t0". Thus, they will have different face counts. And, since fluent meshes are unstructured, there is no way to correspond the faces on Thread "t0" with Thread "thread".

A better way to do this is to perform a DEFINE_ADJUST to compute the face average of "t0", then to apply the average to "thread" in the profile.
pawanh likes this.
billwangard is offline   Reply With Quote

Old   July 16, 2013, 14:54
Default
  #6
New Member
 
Pawan Hurnath
Join Date: Jun 2013
Posts: 5
Rep Power: 4
pawanh is on a distinguished road
Will this resolve the segmentation violation issue as well?
pawanh is offline   Reply With Quote

Old   July 16, 2013, 16:27
Default
  #7
New Member
 
Bill Wangard
Join Date: Jan 2011
Posts: 21
Rep Power: 6
billwangard is on a distinguished road
The threads are different sizes (probably) thus the face loop will access bogus data.
billwangard is offline   Reply With Quote

Old   July 17, 2013, 10:31
Default
  #8
New Member
 
Pawan Hurnath
Join Date: Jun 2013
Posts: 5
Rep Power: 4
pawanh is on a distinguished road
Do you think i can use the F_PROFILE macro in conjunction within with DEFINE_ADJUST instead of DEFINE_PROFILE
pawanh is offline   Reply With Quote

Old   July 19, 2013, 14:27
Default
  #9
New Member
 
Bill Wangard
Join Date: Jan 2011
Posts: 21
Rep Power: 6
billwangard is on a distinguished road
Exactly! And just in case you were going to parallelize your code, remember DEFINE_PROFILE is NEVER called from the HOST node. It is only called from the compute nodes.

Thus, it is a bad idea to have something like this
Code:
DEFINE_PROFILE(myprofile,t,i)
{
    int ID = <some number>

    val = integrate_something_on_another_thread(ID);

     begin_f_loop(f,t)
       F_PROFILE(f,t,i) = val;
     end_f_loop(f,t);

}

real integrate_something_on_another_thread(int id)
{
   Thread*t = Lookup_Thread(Get_Domain(1), id);

   #if !RP_NODE

   do stuff 
   #else

    do more stuff
   #endif
}
because the !RP_NODE code will never get processed from the DEFINE_PROFILE.

Again what you said is correct, you want to embed the call to "do stuff on the other thread" within a DEFINE_ADJUST function.

Hope this helps.
billwangard is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 34 October 16, 2014 05:27
Boundary Conditions problem o_mars_2010 Main CFD Forum 2 July 8, 2013 02:10
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 06:28
Problem with periodic boundary conditions jm_ngs FLUENT 7 April 27, 2012 02:32
Import problem ARC Open Source Meshers: Gmsh, Netgen, CGNS, ... 0 February 27, 2010 11:56


All times are GMT -4. The time now is 07:26.