CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   Doubt about real x[ND_ND] declaration in FLUENT udf (http://www.cfd-online.com/Forums/fluent-udf/114903-doubt-about-real-x-nd_nd-declaration-fluent-udf.html)

Abhya March 19, 2013 14:45

Doubt about real x[ND_ND] declaration in FLUENT udf
 
Hi,
we declare the position vector in a udf as
x[ND_ND];
my doubt is what is the data type (double? float?)of this x[0] variable .. if I'm using double precision solver??
and in single precision solver?

This seems to cause certain weird unexpected random kindoff results in the conditions of "IF else" statements in my udfs..plz replyy !
thnx in advance

flotus1 March 19, 2013 17:49

I think the UDF manual covers this topic.

Variables declared as real are double if you are using the double precision solver.
If you dont trust the manual, declare x as double.

Zheng March 20, 2013 08:03

u define it as real and fluent udf will automatically convert it to float in the single precison solver and double in double precision solver.

flotus1 March 20, 2013 09:38

Zheng, why do you keep repeating my answers?

Zheng March 20, 2013 18:19

Quote:

Originally Posted by flotus1 (Post 415269)
Zheng, why do you keep repeating my answers?

O I just noticed. I did not pay attention to ur answers at all.

Abhya March 21, 2013 01:21

Quote:

Originally Posted by flotus1 (Post 415101)
I think the UDF manual covers this topic.

Variables declared as real are double if you are using the double precision solver.
If you don't trust the manual, declare x as double.

Hi thanks ..
I tried it .. but it gives an error "Segmentation Violation" in the "EXECUTE_ON_DEMAND" udf im using .. it involves the comparison of 2-different array elements at a time .. i tried declaring on array as a double and other as a real(double precision solver) .. however if i declare both as real it runs successfully..isn't this weird?


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