|
[Sponsors] |
October 24, 2021, 10:26 |
Adding Source Terms in Specific Cells
|
#1 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 |
I am modelling a 2 phase flow using VOF in FLUENT. I want to add some source terms in the N-S equations and energy equations. I need to add this source terms in the cells at the interface of 2 phases. I have written a UDF to identify these cells at every iteration.
I am using F_C0 and F_C1 to get the index of cells at the interface. For example, real cell_t c1 = F_C0(c,t). Then I storing this c1 in a user define memory location(C_UDMI). Now, I want to apply source in these cells with the index c1. So my question is can I use a if condition in DEFINE_SOURCE like: if(c == C_UDMI(c,t,i)) { source = ................. } else { source = 0; } Is it the correct way or am I doing it wrong? Any help is much appreciated. Thanks in advance. |
|
October 25, 2021, 01:33 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
I suggest you to use other approach
once you've found c0,t0,c1,t1 use Code:
C_UDMI(c0,t0,0)= 1, C_UDMI(c1,t1,0)= 1 in define_source you'll need to check that flag Code:
if(C_UDMI(c,t,i) == 1) {}
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 25, 2021, 04:06 |
|
#3 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 |
Thanks a lot for your suggestion. I will try that. Till now I was going with
if(c == C_UDMI(c,t,i)) { source = ............... } Also can you suggest if I am doing it right by using F_C0 and F_C1 to get the interfacial cells? I have been stuck with this for a long time now without any help. I am new to UDF writing and have written a UDF to track the interfacial cells but it is not working. I had posted this earlier in the forum also. Thanks. |
|
October 25, 2021, 05:13 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
from my point of view, if you need boundary between two phases while you are using VOF, then you don't need c0,c1
thre is a macro to check phase vof concentration C_VOF which will return you [0..1] depends on the phase inside the cell so your you may check C_VOF in cell and consider it's boundary (which you called interface) in case C_VOF >0.5 and C_VOF <= 1 value 0.5 could be different hope you get the idea
__________________
best regards ****************************** press LIKE if this message was helpful |
|
October 25, 2021, 10:22 |
|
#5 |
Member
Join Date: Jul 2020
Location: India
Posts: 66
Rep Power: 6 |
Actually earlier I was using this criteria only(0.01<C_VOF<1). Then I read a few papers and in those, authors had continuously tracked the interface using UDF. This is because, I am melting solid so when solid melts, iso surface for volume frction will change and I need to track the interface. So, I started writing a UDF for this taking help from the forum.
Thanks |
|
Tags |
interface capture, two phase flow, udmi, vof multiphase |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] Installation Problem with OF 6 version | Aurel | OpenFOAM Community Contributions | 14 | November 18, 2020 17:18 |
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 | ordinary | OpenFOAM Installation | 19 | September 3, 2019 19:13 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 02:41 |
[swak4Foam] Error bulding swak4Foam | sfigato | OpenFOAM Community Contributions | 18 | August 22, 2013 13:41 |
[swak4Foam] funkySetFields compilation error | tayo | OpenFOAM Community Contributions | 39 | December 3, 2012 06:18 |