CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   UDF for 3d boundary conditions problem in fluent (

pawanh July 15, 2013 11:14

UDF for 3d boundary conditions problem in fluent
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);

F_PROFILE(f,thread,index) =(F_T(f,t0)+3);

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

blackmask July 15, 2013 20:11

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.

pawanh July 15, 2013 23:22

Yeah I want the temp jump to be 3k. What's a thread mapping and how do I do it?

pawanh July 16, 2013 09:00

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/ [0x2b435edf9ca0]
1000000: libudf/lnamd64/3ddp/ [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/ [0x2b435edf9ca0]
999999: libudf/lnamd64/3ddp/ [0x2b4363f4c3c9]

billwangard July 16, 2013 14:29

UDF for boundary condition
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 July 16, 2013 14:54

Will this resolve the segmentation violation issue as well?

billwangard July 16, 2013 16:27

The threads are different sizes (probably) thus the face loop will access bogus data.

pawanh July 17, 2013 10:31

Do you think i can use the F_PROFILE macro in conjunction within with DEFINE_ADJUST instead of DEFINE_PROFILE

billwangard July 19, 2013 14:27

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

    int ID = <some number>

    val = integrate_something_on_another_thread(ID);

      F_PROFILE(f,t,i) = val;


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

  #if !RP_NODE

  do stuff

    do more stuff

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.

All times are GMT -4. The time now is 05:12.