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

udfs'

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2005, 05:51
Default udfs'
  #1
Benny
Guest
 
Posts: n/a
Hi all,

I wrote an udf: # include "udf.h" DEFINE_ADJUST(adjust_temp2, domain) {

Thread *f_thread;

face_t f; thread_loop_f(f_thread, domain) {

Thread *t;

begin_f_loop(f,t)

{

F_UDMI(f,t,0) = F_T(f,t);

}

end_f_loop(f,t) } } It was compiled and run successfully, but when I checked the result, the udm-0 is zero everywhere. I'm sure that the Energy Equation is enabled. Could somebody tell me why this happend?

Best regards!

Benny
  Reply With Quote

Old   June 8, 2005, 07:42
Default Re: udfs'
  #2
Alec Eiffel
Guest
 
Posts: n/a
Hi Benny

you need to store the values using C_UDMI(c,t,i). Fluent stores all variables at cell centres not at faces. So change your UDF to cell loop and should work
  Reply With Quote

Old   June 8, 2005, 22:13
Default Re: udfs'
  #3
Benny
Guest
 
Posts: n/a
hi Alec Eiffel,

I'm sorry to say that I feel doubt what you said. In the definition of F_UDMI(f,t,i), it reads: stores data in user-defined face memory location for given index. But I thank you very much for your suggestion!

Best regards!

Benny

  Reply With Quote

Old   June 9, 2005, 06:23
Default Re: udfs'
  #4
Alec Eiffel
Guest
 
Posts: n/a
yes but it also reads: Note that F_UDMI is available for boundary and wall faces, only.

It wont work for faces inside the domain only at boundarys
  Reply With Quote

Old   June 9, 2005, 12:33
Default Re: udfs'
  #5
Benny
Guest
 
Posts: n/a
What I want to know is temperature on the wall. But I found that the udm-0 is equal to 0 everywhere. How could get it?
  Reply With Quote

Old   June 9, 2005, 14:34
Default Re: udfs'
  #6
us
Guest
 
Posts: n/a
In this case, you need to specify the address of that wall in your udf. Use following in your UDF at the beginning to get the same. domain = Get_Domain(domain_ID);

Also, put begin_loop inside thread_loop_f(t,domain) loop to perform begin loop operation on threads of perticular domain. Regards, -US
  Reply With Quote

Old   June 9, 2005, 21:57
Default Re: udfs'
  #7
Benny
Guest
 
Posts: n/a
dear us, Thank you very much for your suggestion! But what kind of looping macro 'begin_loop' is? Should it be begin_f_loop or others? Thank you!

Regards!

Benny
  Reply With Quote

Old   June 9, 2005, 23:40
Default Re: udfs'
  #8
Benny
Guest
 
Posts: n/a
BTW, if my case is single phase, is the domain_ID equal to 1?
  Reply With Quote

Old   June 10, 2005, 11:25
Default Re: udfs'
  #9
saghir
Guest
 
Posts: n/a
DEFINE_ADJUST(read_ur_file, domain) {

Thread *t; face_t f; t = Lookup_Thread(domain,wall_thread_ids["n ???"]);

begin_f_loop(f,t)

{

F_UDMI(f,t,0) = F_T(f,t);

}

end_f_loop(f,t)

} }
  Reply With Quote

Old   June 10, 2005, 11:26
Default Re: udfs'
  #10
us
Guest
 
Posts: n/a
Domain ID is the ID that is assigned to each zone. For example, wall, velocity inlet, velocity outlet etc each has unique domain ID. So when you open boundary condition panel and select the wall you are interested in, you will see its domain id at the bottom of right hand part of the same panel.

Yes, with 'begin_loop', i meant with that was begin_f_loop.Sorry about that.

begin_f_loop(f, f_thread) /* loops over faces in a face thread */

{

}

end_f_loop(f, f_thread)

Regards, -US
  Reply With Quote

Old   June 13, 2005, 09:19
Default Re: udfs'
  #11
zubier
Guest
 
Posts: n/a
  Reply With Quote

Old   June 13, 2005, 23:21
Default Re: udfs'
  #12
Benny
Guest
 
Posts: n/a
Dear all,

Now I have no diea. I followed what you said to write the udf, but udm-o is still equal to 0. What should I do? Could soembody write a udf for me to check a variable , suych as temperature, on the wall? Thank you ahead!

Benny
  Reply With Quote

Old   June 14, 2005, 12:08
Default Re: udfs'
  #13
us
Guest
 
Posts: n/a
Hi Benny,

One more suggestion to try. I looked at your UDF. You use DEFINE_ADJUST. I would say you better use following UDF. You may want to know the reason why? DEFINE_ADJUST udf is executed at the start of iteration. Or in the case of unsteady problem, at the start of new time timestep. While, DEFINE_EXECUTE_AT_END udf is executed at the end of iteration(means after the calculation is complete). So what i think is, when you try to store values in UDM using DEFINE_ADJUST, there is probably no value of temperature to be stored in your UDM since it is the start of iteration or new timestep. So try using following UDF. Hope this works out. In my openion it should definitely work out.

------------------ #include "udf.h"

DEFINE_EXECUTE_AT_END(execute_at_end)

{

Domain *d;

Thread *t;

face_t f;

d = Get_Domain(wall_domain_no); /* wall domain for yr temp*/

thread_loop_f(t,d)

{

begin_f_loop(f,t)

F_UDMI(f,t,0) = F_T(f,t);

end_f_loop(f,t)

}

} -----------------
  Reply With Quote

Old   June 19, 2005, 23:48
Default Re: udfs'
  #14
Benny
Guest
 
Posts: n/a
Dear us, I follow your suggestion, and write the udf as following:

# include "udf.h" DEFINE_EXECUTE_AT_END(execute_at_end) { Domain *d; Thread *f_thread; face_t f; d = Get_Domain(3); /* the wall zone ID is 3*/ thread_loop_f(f_thread,d) {

begin_f_loop(f,f_thread)

{

F_UDMI(f,f_thread,0) = F_T(f,f_thread);

}

end_f_loop(f,f_thread) } }

But when I run it, it gives error message and cease to run. Do you know why?
  Reply With Quote

Old   June 20, 2005, 14:50
Default Re: udfs'
  #15
us
Guest
 
Posts: n/a
UDF seems ok. Are you able to compile it and load the same successfully? or you get the compilation error. What error? One more question, you want to know the temp. at wall. Now, wall is the solid boundary of your domain, right? So what kind of boundary condition you hv specified there for temp or energy eqn? Just trying to understand your case.
  Reply With Quote

Old   June 20, 2005, 21:27
Default Re: udfs'
  #16
Benny
Guest
 
Posts: n/a
Yes, I have compiled it and loaded it successfully. But when I run it, it reads: Error: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () I think it's common error message, so I found nothing useful info. My case is simple, a circular duct with heat flux on its wall, and the thickness of the wall is zero.
  Reply With Quote

Old   June 21, 2005, 11:34
Default Re: udfs'
  #17
us
Guest
 
Posts: n/a
Have you activated UDM in Define/User-defined/Memory panel? You require to set it to 1. I hope you haven't forgotten to do so. Sometimes when we forget to do so we come up with such error. Just to confirm, you run your UDF through Define/User-defined/Function-hook panel, third drop-down text, named 'Execute at End', from the top. right? If all these things are ok, then UDF should be working. -US
  Reply With Quote

Old   June 21, 2005, 21:57
Default Re: udfs'
  #18
Benny
Guest
 
Posts: n/a
I have done all of your suggestion, but it doesn't work. Can the udf be run on your computer?
  Reply With Quote

Old   June 22, 2005, 11:49
Default Re: udfs'
  #19
us
Guest
 
Posts: n/a
I'll give a try today.
  Reply With Quote

Old   June 22, 2005, 22:52
Default Re: udfs'
  #20
Benny
Guest
 
Posts: n/a
Dear us,

Thank you very much!

Benny
  Reply With Quote

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem using property udfs in parallel mode EllenW Fluent UDF and Scheme Programming 5 July 10, 2009 05:31
problem using property udfs in parallel mode EllenW FLUENT 0 June 23, 2009 18:18
Unsteady and Flux UDFs for UDSs tom FLUENT 0 February 13, 2009 11:27
Multiple UDFs Graeme FLUENT 4 August 28, 2004 16:47
Experimental Repository for UDFs, Journal Files and Scheme Scripts Jonas Larsson FLUENT 0 March 5, 2000 16:36


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