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

using DEFINE_SOURCE for a part of a boundary

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2017, 12:57
Default using DEFINE_SOURCE for a part of a boundary
  #1
New Member
 
ali
Join Date: Jun 2016
Posts: 10
Rep Power: 10
abdoli is on a distinguished road
hi guys
i am new in using udf. i am modeling nucleate boiling and i have some problem in that. i am writing a udf to use DEFINE_SOURCE for a part of one boundary (zone-ID is 3) of my model as below. (my model is a simple rectangular).
#include "udf.h"
DEFINE_SOURCE(VOF_source1, c, t, dS, eqn)
{
real xc[ND_ND], c1x, c1y, source;
face_t f;
cell_t c,c0;
Domain *domain=Get_Domain(1);
Thread *t0,*t=Lookup_Thread(domain,3);
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
C_CENTROID(xc,c0,t0);
c1x=xc[0];
c1y=xc[1];
if (0.01<c1y && c1y<0.03)
{
source =0.055;
dS[eqn] =0;
return source;
}
}
it works but it seems that source term exists in all of domain, not only in the part of the specified boundary and the part that is defined by if statement.
what is wrong? your guide will be very helpful for me.
if more information in needed, i will send.

best regards
abdoli is offline   Reply With Quote

Old   September 17, 2017, 23:01
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Quote:
Originally Posted by abdoli View Post
hi guys
i am new in using udf. i am modeling nucleate boiling and i have some problem in that. i am writing a udf to use DEFINE_SOURCE for a part of one boundary (zone-ID is 3) of my model as below. (my model is a simple rectangular).
#include "udf.h"
DEFINE_SOURCE(VOF_source1, c, t, dS, eqn)
{
real xc[ND_ND], c1x, c1y, source;
face_t f;
cell_t c,c0;
Domain *domain=Get_Domain(1);
Thread *t0,*t=Lookup_Thread(domain,3);
c0 = F_C0(f,t);
t0 = THREAD_T0(t);
C_CENTROID(xc,c0,t0);
c1x=xc[0];
c1y=xc[1];
if (0.01<c1y && c1y<0.03)
{
source =0.055;
dS[eqn] =0;
return source;
}
}
it works but it seems that source term exists in all of domain, not only in the part of the specified boundary and the part that is defined by if statement.
what is wrong? your guide will be very helpful for me.
if more information in needed, i will send.

best regards


Hello

DEFINE_SOURCE(VOF_source1, c, t, dS, eqn) macros already has built in loop over all cells-threads (VOF_source1, c, t, dS, eqn)

I'm suggesting you to use flag UDMI variable for the region, you are interested in.

Code:
#include "udf.h"
DEFINE_SOURCE(VOF_source1, c, t, dS, eqn)
{
   real xc[ND_ND], c1x, c1y, source;
   face_t f;
   cell_t c,c0;
   Domain *domain=Get_Domain(1);
Thread *t0,*t=Lookup_Thread(domain,3);
   c0 = F_C0(f,t);
   t0 = THREAD_T0(t);
   C_CENTROID(xc,c0,t0);
    c1x=xc[0];
    c1y=xc[1];
if (C_UDMI(c,t,0) >0 )
{
if (0.01<c1y && c1y<0.03)
{
    source =0.055;    
}
}else{source= 0.0;}
dS[eqn] =0;
return source;
}
Now when you initialized your simulation go to Patch... and put value 1 for UDMI_0 in the region you want

Do not forget to change the number of UDMs in Fluent GUI from 0 to 1

Best regards
AlexanderZ is offline   Reply With Quote

Old   September 19, 2017, 15:30
Default
  #3
New Member
 
ali
Join Date: Jun 2016
Posts: 10
Rep Power: 10
abdoli is on a distinguished road
dear AlexanderZ
thanks for your reply. now i have one domain in my model. is it needed to separate region that should be patched (near boundary) at first? if yes, how i can do that?
abdoli 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
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 92 May 21, 2024 08:56
3D Windturbine simulation in SU2 k.vimalakanthan SU2 15 October 12, 2023 06:53
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 08:30
Out File does not show Imbalance in % Mmaragann CFX 5 January 20, 2017 11:20
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


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