CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Does OS matters?Why? (http://www.cfd-online.com/Forums/fluent/84371-does-os-matters-why.html)

coiby January 27, 2011 08:03

Does OS matter? Why?
 
The program(UDF) is complied successfully under Windows but doesn't work under Linux(Ubuntu 10.10.64bit). Why does this happen? Thanks!
Code:

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<udf.h>
#include<math.h>
#define K 4
#define mu 2.6
#define sigma 8.0
#define PI 3.1416926
#define maxi 10000000
float gauss(void)
{
    float tmp;
    float u;
    float v;
    //float mu; // the expected value of Gauss Distrubution
    tmp=0;
    srand((unsigned)time(NULL));
   
    while(mu-2>tmp||tmp>mu+2){
        u=rand()*1.0/RAND_MAX;
        v=rand()*1.0/RAND_MAX;
        tmp=sqrt(-2*log(u))*cos(2*PI*v)*sigma+mu;
    }
    return tmp;
}
DEFINE_INIT(my_init_function, domain)
{
    cell_t c;
    Thread *t;
    int i;
    int j;
    int cnum =14160;
    float *radius[maxi][K];
    j=0;
    thread_loop_c(t,domain)
    {
        for(i=0;i<K;i++)
            *radius[j][i]=gauss();
        j++;
    }
}


DoHander January 27, 2011 16:01

Have you checked if your Linux version contains all the required compilers and files ? Like for example "gcc" ?

Do

coiby January 27, 2011 22:24

DoHander, thanks for your attention. I check the problem again and find it's the style of comment that matters. In Fluent, you should use "/* */" to comment the codes instead of "//".
The Fluent uses cc as the compiler. But cc supports "//" comment style. Then the problem is due to parameters passed to cc.
Code:

cc -fpic -shared -ansi -Wall -m32 -O    -I/opt/Fluent.Inc/fluent6.3.26/`expr \`pwd\` : '.*/\(.*\)/[23].*'`/`basename \`pwd\`` -I/opt/Fluent.Inc/fluent6.3.26/src -I/opt/Fluent.Inc/fluent6.3.26/cortex/src -I/opt/Fluent.Inc/fluent6.3.26/client/src -I/opt/Fluent.Inc/fluent6.3.26/tgrid/src -I/opt/Fluent.Inc/fluent6.3.26/multiport/src -I. -c my_init.func.c


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