|
[Sponsors] |
September 15, 2017, 12:57 |
using DEFINE_SOURCE for a part of a boundary
|
#1 |
New Member
ali
Join Date: Jun 2016
Posts: 10
Rep Power: 10 |
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 |
|
September 17, 2017, 23:01 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
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; } Do not forget to change the number of UDMs in Fluent GUI from 0 to 1 Best regards |
||
September 19, 2017, 15:30 |
|
#3 |
New Member
ali
Join Date: Jun 2016
Posts: 10
Rep Power: 10 |
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? |
|
|
|
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 |