CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   how to convert c file into udf (https://www.cfd-online.com/Forums/fluent/133150-how-convert-c-file-into-udf.html)

ramchander April 11, 2014 03:11

how to convert c file into udf
 
hi,
i have a C file and want to change into udf file,so that i want to use it in fluent .please give some suggestions how to change it.

C file:

#include<stdio.h>
#include<conio.h>
int main()
{
int x=0,temp=0,t;
printf("enter t value");
scanf("%d",t);
if(t>=90 && t<=180);
{
x=t-90;
temp=1533-x*7;
printf("temperature %d",temp);
}
else
{
printf("tempearture you given not satisfy %d",temp);
}
getch();
}

ghost82 April 11, 2014 08:23

Be more specific; is it to apply as a profile?
your program requests input values given by user..
What is t?time, space??

ramchander April 11, 2014 10:14

convert c file to udf
 
"t" represents angle
as the t value changing from 90 to 180, temperature varies as mathematical form like (1533-x*7),
when t=90 then x=0,
when t=91 then x=1, and so on.......
here as the t (angle) changes from 90 to 180 the temperature decreases from 1533 to 903. :):)

ghost82 April 11, 2014 10:19

post a picture of your domain with sizes, describe your case problem and if you want to use the udf as a boundary condition.

reformat April 17, 2014 04:06

If your question is how you can convert the c file into udf for fluent, you can either interpret or compiled it. For me, i personally prefer the latter.

Go to Define-->Function-->Compiled
Add the c file into the box on the left, highlight it and click "build".
A list of information will start loading at the bottom screen of your mesh.
Look out for words with "error" or "warning", there are lines stated where the error occurs. Do correct them and "build" the c file again. Once all the errors have been cleared, load the ::libudf file


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