CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   udf for repatching a temperature in a volume (http://www.cfd-online.com/Forums/fluent/31244-udf-repatching-temperature-volume.html)

McGregor April 9, 2003 05:26

udf for repatching a temperature in a volume
 
Hi, I've tried to write a UDF that will repatch the temperature in a volume thread, once the average temperature in a surface thread reaches a certain value.

I have used the DEFINE_ADJUST macro for this, along with the Lookup_Thread function for both the surface and volume threads.

My program compiles, but when i execute it in fluent, i get a segmentation vialation.

Has anyone written similar programs where values are repatch as other values change? If so please point me in the right direction as this is causing me a lot of unnecessary stress!!!

I can attatch the program that i have written if that is of any help.

Thank you in advance,

Mcgregor

McGregor April 9, 2003 08:13

Re: udf for repatching a temperature in a volume
 
Here is a copy of the program that i wrote. I am using fluent 6.0

#include "udf.h"

DEFINE_ADJUST(repatch_save,d)

{ real Ttot,Tave;

face_t f;

Thread *t = Lookup_Thread(d,7);

begin_f_loop(f,t)

Ttot += F_T(f,t);

end_f_loop(f,t);

Tave = (Ttot/54);

if (Tave>350.0)

{

cell_t c;

Thread *t2=Lookup_Thread(d,3);

begin_c_loop(c,t2)

C_T(c,t2) = 493;

end_c_loop(c,t2);

}

else return; }

Regards,

Alex Munoz April 9, 2003 12:10

Re: udf for repatching a temperature in a volume
 
Hi

I guess you save the data in a UDM but you forgot to initialize the UDM.

If that the case let me know and I will give a way to solved

Regards

Alex

Alex Munoz April 9, 2003 12:16

Re: udf for repatching a temperature in a volume
 
Hi

careful

Tave = (Ttot/54); C_T(c,t2) = 493;

you should use 54.0 and 493.0 or 493. if not the code can not make diference between int or float, and you get unusual results!

Regards

Alex Munoz

McGregor April 10, 2003 05:28

Re: udf for repatching a temperature in a volume
 
Hi Alex,

Thanks for the help that you have already given me. With regards to storing data in a UDM, is that the data obtained from the face thread? Im not sure how to go about doing that, so any help you can give would be very much appreciated. The program i wrote is as it stands on my second post.

Thanks again



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