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

Adding Source Terms in Specific Cells

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 24, 2021, 09:26
Post Adding Source Terms in Specific Cells
  #1
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
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.
Cooper24 is offline   Reply With Quote

Old   October 25, 2021, 00:33
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
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
so you will get a flag to check if cell is adjusted to interface

in define_source you'll need to check that flag
Code:
if(C_UDMI(c,t,i) == 1)
{}
Cooper24 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   October 25, 2021, 03:06
Default
  #3
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
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.
Cooper24 is offline   Reply With Quote

Old   October 25, 2021, 04:13
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   October 25, 2021, 09:22
Default
  #5
Member
 
Join Date: Jul 2020
Location: India
Posts: 63
Rep Power: 5
Cooper24 is on a distinguished road
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
Cooper24 is offline   Reply With Quote

Reply

Tags
interface capture, two phase flow, udmi, vof multiphase


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
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 16: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 18:13
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 12:41
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 05:18


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