|
[Sponsors] |
April 25, 2018, 02:29 |
Help with setting up UDF/UDS for diffusivity
|
#1 |
New Member
MCKoz
Join Date: Apr 2018
Posts: 9
Rep Power: 8 |
Hi all, I am new to fluent, and this is my first post to this forum.
I am attempting to do a multiphase flow simulation for my geometry. This involves a porous zone, as well as another non-porous zone. I am attempting to use UDS to define the diffusivity in each of these regions. Currently I have selected for there to be two UDS, one for each region. Additionally I have written a UDF, and have a macro for each region. Now, I'm not sure where to go from here. I'm confused on how to associate the UDF code to the UDS that I want to track, which is the diffusion of the secondary phase throughout the volume. The only thing I can see to do is to attach my compiled UDF to 'UDS diffusivity' for the secondary material. However, this does nothing for the simulation, and the UDS has no calculations. Could someone help me to understand how I can apply my Diffusivity code for each zone and then monitor the diffusion in CFD-Post. Any help is much appreciated! |
|
April 25, 2018, 06:09 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
UDF is a user-defined functions, actually it is a code UDS is user-defined scalar, which is defined through UDF frankly speaking, I do not understand what is a problem. Once you have both codes for UDS and some other code (you called UDF), you may put everything into one file., or different files with links. You may monitor any variable defined in UDF using UDMIs best regards |
||
April 25, 2018, 15:02 |
|
#3 |
New Member
MCKoz
Join Date: Apr 2018
Posts: 9
Rep Power: 8 |
Hi,
Thanks for your reply. So I suppose I already have both codes for my UDS with the code I have written. One Diffusivity macro for each zone. I've compiled my code and imported into fluent, and then selected for two UDS in my setup. Now I'm wondering how I associate the code with the UDS or 'define it through UDF' as you mentioned. Additionally, how would I apply one macro to one zone, and then one macro to the other zone? |
|
April 25, 2018, 22:01 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Unfortunately, I don't understand your points.
May be anybody else will help you. If you need my help, put here sketch of your domain and codes, I will try to help you best regards |
|
April 26, 2018, 10:11 |
|
#5 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
The UDS is a scalar that is diffusing. The UDS should have a diffusivity, not be used to define a diffusivity. You can however define the diffusivity for your UDS using a UDF. So the UDF that you used, could be used for the diffusivity of your UDS. But you also have to give boundary conditions for your UDS. If you did not change any boundary conditions for your UDS, you will use the default boundary conditions, which are very boring, and result in a solution which is zero everywhere. I don't know exactly what you want, but I can make two guesses: A. You are attempting to use a UDF to define the diffusivity of regular fluids in each of these regions. In this case: get rid of the UDS's. B. You are attempting to use a UDF to define the diffusivity of a UDS in each of these regions. In this case: you only need one UDS, and you need to add boundary conditions for your UDS. |
||
April 26, 2018, 15:01 |
|
#6 |
New Member
MCKoz
Join Date: Apr 2018
Posts: 9
Rep Power: 8 |
Thanks for your reply! Pakk, I think I am understanding better now. Based on your comments, I am attempting to use a UDF to define the diffusivity of a UDS.
So in that case, I suppose I just need the one UDS, and my boundary condition could essentially be the inlet value of the mass fraction? Then I just simply need to attach my DEFINE_DIFFUSIVITY UDF to the material properties for whatever the primary fluid is (i.e. water). Does this sound correct? Again, I thank you for your comments! |
|
April 27, 2018, 13:08 |
|
#7 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 12 |
Hi dinknflicka,
A few quick pointers: 1) You seem to be asking about how to hook the UDFs into the model. It is very true that you can write a UDF and compile it, but it still has zero effect on the model until you use put that UDF into some settings. The settings that you are looking for here are presumably the material properties of the UDS in the fluid. So, go look there (and in the help files) -- it should become more obvious. 2) However, you will find that there is no mechanism for applying one UDF to one zone and another to another. You need to supply one UDF for the property, and decide inside there which value is relevant -- possibly a three-way decision, if you want a third value for zones other than the two you mentioned. So, a sketch of what you want might be this: Code:
#include "udf.h" #define ZONE1_ID 4 #define ZONE2_ID 7 DEFINE_DIFFUSIVITY(uds_diff, c, t, i) { real diff; if(THREAD_ID(t) == ZONE1_ID) diff = 1e-6; else if (THREAD_ID(t) == ZONE2_ID) diff = 2e-6; else diff = 1e-5; return diff; } 3) The example in the Customisation Manual has two important but subtle details: Code:
DEFINE_DIFFUSIVITY(mean_age_diff,c,t,i) { return C_R(c,t) * 2.88e-05 + C_MU_EFF(c,t) / 0.7; } Second: if you want your UDS to be dispersed by turbulence, you need to add it yourself to the UDF diffusivity. This is unlike the situation for species. The second term above does this, assuming a turbulent Schmidt number of 0.7. Good luck! Ed |
|
Tags |
multi phase flow, user defined function, user defined scalar |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent Parallelization Problem After AC Power Dropped | pawl | Hardware | 5 | November 13, 2016 07:08 |
using chemkin | JMDag2004 | OpenFOAM Pre-Processing | 2 | March 8, 2016 23:38 |
[snappyHexMesh] determining displacement for added points | CFDnewbie147 | OpenFOAM Meshing & Mesh Conversion | 1 | October 22, 2013 10:53 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 22:58 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |