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

How to update operating pressure using UDF DEFINE_ADJUST

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 26, 2020, 02:58
Default How to update operating pressure using UDF DEFINE_ADJUST
  #1
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
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.

Last edited by arunraj; June 26, 2020 at 07:23.
arunraj is offline   Reply With Quote

Old   June 26, 2020, 07:24
Default
  #2
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
I solved

RP_Set_Real("operating-pressure", p_op_new)
/define/operating-conditions/operating-pressure (rpgetvar 'p_op_new)
arunraj is offline   Reply With Quote

Old   June 30, 2020, 12:05
Default
  #3
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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
homay95 is offline   Reply With Quote

Old   June 30, 2020, 23:20
Default
  #4
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
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)

Last edited by arunraj; July 1, 2020 at 06:17.
arunraj is offline   Reply With Quote

Old   July 1, 2020, 02:52
Default
  #5
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   July 1, 2020, 02:55
Default
  #6
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
something like this can help. Inside f_loop

Message ("Text %g \n", var_name);
arunraj is offline   Reply With Quote

Old   July 1, 2020, 02:58
Default
  #7
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
okay thank you. and where should I put this line? inside f-loop or outside?
homay95 is offline   Reply With Quote

Old   July 1, 2020, 03:14
Default
  #8
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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)
homay95 is offline   Reply With Quote

Old   July 1, 2020, 03:45
Default
  #9
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
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?
arunraj is offline   Reply With Quote

Old   July 1, 2020, 04:13
Default
  #10
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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
homay95 is offline   Reply With Quote

Old   July 1, 2020, 04:22
Default
  #11
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
You just repeated what you mentioned earlier. whats your problem and domain.
arunraj is offline   Reply With Quote

Old   July 1, 2020, 04:27
Default
  #12
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?
homay95 is offline   Reply With Quote

Old   July 1, 2020, 04:38
Default
  #13
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
First search for some phd thesis and see if someone has already written udf for this. or of similar nature.
arunraj is offline   Reply With Quote

Old   July 1, 2020, 04:40
Default
  #14
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
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?!
homay95 is offline   Reply With Quote

Old   July 1, 2020, 04:43
Default
  #15
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
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.
arunraj is offline   Reply With Quote

Old   July 1, 2020, 04:44
Default
  #16
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
okay thank you very much
homay95 is offline   Reply With Quote

Old   July 1, 2020, 04:46
Default
  #17
Senior Member
 
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16
arunraj is on a distinguished road
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)
}
arunraj is offline   Reply With Quote

Old   July 1, 2020, 04:51
Default
  #18
Member
 
Homayoon sohrabi
Join Date: May 2020
Posts: 56
Rep Power: 6
homay95 is on a distinguished road
yes I can use that as a template. thanks
homay95 is offline   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
UDF to update Operating pressure Rahul Fluent UDF and Scheme Programming 6 June 26, 2020 05:54
A question on shared pressure in Cavitation UDF dinhanh Fluent UDF and Scheme Programming 0 May 3, 2018 07:33
the role of operating pressure in flow simulation sunflower FLUENT 1 December 20, 2010 22:24
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 06:13
Hydrostatic pressure in 2-phase flow modeling (long) DS & HB Main CFD Forum 0 January 8, 2000 16:00


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