How to update operating pressure using UDF DEFINE_ADJUST
Hello everyone,
I have written an UDF to update the operating pressure. I would like to know what should I do for operating pressure to be updated with the value of p_op_new. Is the below format right. |
I solved
RP_Set_Real("operating-pressure", p_op_new) /define/operating-conditions/operating-pressure (rpgetvar 'p_op_new) |
Hi
I have written a code by DEFINE_ADJUST for temperature jump as follows : DEFINE_ADJUST(temperaturejump3, domain) { Domain *d; int zone_ID = 16; Thread *f_thread = Lookup_Thread(domain, zone_ID); Thread *c_thread; cell_t cell; face_t face; double dTdy, temp, walltemp; double b = 0.000001; thread_loop_f (f_thread,domain) { begin_f_loop(face,f_thread) { cell = F_C0(face,f_thread); c_thread = THREAD_T0(f_thread); walltemp = F_T(face,f_thread); dTdy = C_T_G(cell,c_thread)[1]; F_PROFILE(face, f_thread, zone_ID) = (b*dTdy) + walltemp; } end_f_loop(face,f_thread) } } is it correct or does it need any modifying?? Thanks in advance |
Use 'message' in udf and check if your udf works. though it seems fine to me. I belive you can simply wirte
thread_loop_f (f,d) { begin_f_loop(f,t) } end_f_loop(f,t) |
thanks for your help but how could I use 'message'? could you be please more specific? and I had a problem that when I hooked DEFINE_ADJUST to hooked functions and start calculation, it says there is "SIGSEGV" error and closes the FLUENT immediately! what should I do? what is wrong with my code?
|
something like this can help. Inside f_loop
Message ("Text %g \n", var_name); |
okay thank you. and where should I put this line? inside f-loop or outside?
|
I got your message and thank you very much. but I think my condition is different with that in the UDF. I need to write a DEFINE_ADJUST for this:
T)f = T)s + b(dT/dy) in which T)f is fluid temperature and T)s is solid wall temperature and b is temperature jump coefficient and I also need to apply 'coupled' condition between the face and its shadow to maintain thermal conservation (the heat flux entering one is equal to heat flux exiting the other) |
Okay I understand. Take a sample udf from cfd online. search for it. modify it and use. As you are new, it is difficult to do directly. Mainly the format of UDF is important. Also, you need to explain the problem, How do I know if you are looking for which problem?
|
yes actually Im new with UDF coding so Im just looking for a DEFINE_ADJUST UDF template so I could modify it, I mean I need to know which arguments and expressions I have to write in my code for applying a temperature jump on a face. the temperature jump function is as follows :
T)f = T)s + b(dT/dy) in which T)f is fluid temperature and T)s is solid wall temperature and b is temperature jump coefficient |
You just repeated what you mentioned earlier. whats your problem and domain.
|
Im sorry I didnt understand before. Im simulating a heat-sink with rectangular michrochannel which have hydrophobic inside walls and water flowing through it, so I need to write a UDF for the temperature jump on liquid-solid interfaces (I have a slip flow on interfaces). can you please help me?
|
First search for some phd thesis and see if someone has already written udf for this. or of similar nature.
|
I have searched already but I didnt find any useful source. do you have any recommendation about where could I find some better Thesis? I mean an University website or something like that?!
|
I beleive you need to apply udf both on wall as well as shadow wall. So whatever udf i sent could be a reference. work on that improve that for your model.
|
okay thank you very much
|
This could help you i guess
# include "udf.h2" DEFINE_ADJUST(match_boundary_at_end, d) { FILE *fp; Thread *tc1, *tc2; Thread *tf1, *tf2 ; cell_t c1, c2; face_t f1, f2; real f_c1[ND_ND], f_c2[ND_ND]; real dist; tf1 = Lookup_Thread(d,WALLSIDE1); tf2 = Lookup_Thread(d,WALLSIDE2); begin_f_loop(f1,tf1) { ----- } end_f_loop(f1,tf1) begin_f_loop(f2,tf2) { ---- } end_f_loop(f2,tf2) } |
yes I can use that as a template. thanks
|
All times are GMT -4. The time now is 07:20. |