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

Does OS matters?Why?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2011, 08:03
Default Does OS matter? Why?
  #1
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
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++;
    }
}

Last edited by coiby; January 27, 2011 at 10:27.
coiby is offline   Reply With Quote

Old   January 27, 2011, 16:01
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 20
DoHander is on a distinguished road
Have you checked if your Linux version contains all the required compilers and files ? Like for example "gcc" ?

Do
DoHander is offline   Reply With Quote

Old   January 27, 2011, 22:24
Default
  #3
New Member
 
Coiby Xu
Join Date: Jan 2011
Posts: 7
Rep Power: 15
coiby is on a distinguished road
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
coiby is offline   Reply With Quote

Reply

Tags
fluent, linux, udf


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



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