|
[Sponsors] |
UDF for Defining different Density calculation formula for different Cell-zones. |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 2, 2022, 13:20 |
UDF for Defining different Density calculation formula for different Cell-zones.
|
#1 |
New Member
shubham
Join Date: Dec 2021
Posts: 1
Rep Power: 0 |
Hello all,
I have a problem in defining Density. I am simulating multiphase simulation where density is a function of Temperature and composition. For that I want to define two different density calculation formula in two different cell zones. For this I am using the following UDF: #include "udf.h" #include "math.h" #include "materials.h" #include "threads.h" /* I want to define two different DENSITY variation in two different cell zones. */ DEFINE_PROPERTY(cell_density,c,t) { real rho; int i; real T; real xch4; Material *sp; Domain *mixture_domain; mixture_domain = Get_Domain(3); // domain id of liquid phase = 3 Thread *tc1,*tc2; tc1 = Lookup_Thread(mixture_domain,14); //14 is Domain id of bottom zone tc2 = Lookup_Thread(mixture_domain,15); //15 Domain id of middle zone if (t == tc1) //when thread pointer at bottom zone xch4 remain constant { mixture_species_loop(THREAD_MATERIAL(t),sp,i) { T = C_T(c,t); xch4 = 0.89; rho = (-0.8292 - (0.5407*xch4))*(T - 100) - (250.15*xch4) + 690.73; } //return rho; } else if (t == tc2) //when thread pointer at middle zone Temperature remain constant { mixture_species_loop(THREAD_MATERIAL(t),sp,i) { T = 111.67; xch4 = C_YI(c,t,1); rho = (-0.8292 - (0.5407*xch4))*(T - 100) - (250.15*xch4) + 690.73; } //return rho; } return rho; } The UDF compiles without any problems. However, as soon as it starts, the simulation begins to diverge. Without UDF, the simulation runs without a hitch. I can't seem to figure out what the issue is. Does anyone have an idea what this can be due to? Many thanks in advance. |
|
June 10, 2022, 01:48 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
i think you don't need these lines:
Code:
mixture_species_loop(THREAD_MATERIAL(t),sp,i) Code:
xch4 = C_YI(c,t,1); You may try to define some specific value for initialization (when time = 0) explicitly to bypass possible issue. make sure you are using correct index for material either, which you put as 1
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
mixture density, multiphase mixture model, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF in case with DPM modle | POSTHU | Fluent UDF and Scheme Programming | 0 | March 3, 2021 08:21 |
[snappyHexMesh] Creating multiple multiple cell zones with snappyHexMesh - a newbie in deep water! | divergence | OpenFOAM Meshing & Mesh Conversion | 0 | January 23, 2019 05:17 |
UDF for current density in PEM fuel cell | sajjad haider | FLUENT | 2 | February 22, 2012 19:16 |
Cells with t below lower limit | Purushothama | Siemens | 2 | May 31, 2010 22:58 |
REAL GAS UDF | brian | FLUENT | 6 | September 11, 2006 09:23 |