|
[Sponsors] |
Density based on temperature and species mass fraction UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 3, 2021, 04:24 |
Density based on temperature and species mass fraction UDF
|
#1 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
Hello,
I am writting an UDF to calculate the density of my mixture taking into account the temperature and species mass fraction. When I consider only the temperature change the simulation is OK. However when I consider both (temperature and species mass fraction) I have problems solving the simulation. Can someone help me? Thanks ***** DEFINE_PROPERTY(density_mixture,c,t) { /* Definir variables */ int i = 0; Material *sp; real density; real temp; real conc; real alpha; real beta; real homogeneous_density; real homogeneous_concentration; alpha = 0.001222587; beta = 0.275; homogeneous_density = 748.435; homogeneous_concentration = 0.5167; /* Temperatura & concentracion de celda */ temp = C_T(c,t); mixture_species_loop(THREAD_MATERIAL(t),sp,i) { conc = C_YI(c,t,i); } /* Ecuación */ density = homogeneous_density*((1)-(alpha*(temp- 298.16))+(beta*(conc-0.5167))); /* Result return */ return density; } |
|
September 4, 2021, 02:54 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
"problems solving the simulation"
This can mean many things... Crash, doesn't converge, converges too slow, converges to a wrong solution... What do you mean here?
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
September 4, 2021, 04:12 |
|
#3 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
I have problems with the simulation because it does not convergence, the residuals go up.
The question is that if I put in the UDF only the part of the temperature and alpha and eliminate the part of the concentration the simulation convergence correctly. Why can happen this? I want to consider both parts (temperature and concentration) and I dont know where is the error. Thanks |
|
September 4, 2021, 05:16 |
|
#4 |
Member
Guven Nergiz
Join Date: Jul 2020
Location: Turkey
Posts: 52
Rep Power: 6 |
You want to read overall temperature of mixture or temperature of every fractions in the mixture?
|
|
September 4, 2021, 09:44 |
|
#5 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
Hi
I want to read the temperature of each cell and also the mass fraction of each cell. Ones I know that information, I want to calculate the density using the UDF that I send. If I consider only the temperature, the simulation runs correctly but when I use the mass fraction macro the simulation doesnt convergence. Thanks |
|
September 4, 2021, 11:35 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
But the mass fraction of what? Your code is not clear about it.
You have a mixture. Your mass fractions will sum to 100%. In your code, you calculate them all, and use the last calculated mass fraction. You're lucky if that is the one you want...
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
September 4, 2021, 12:29 |
|
#7 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
Hi
I want use the mass fraction of my first component in each cell to calculate the density later. conc = C_YI(c,t,i); With this can I calculate that eliminating the loop part? I want to know the mass fraction of my first component (i) in each cell. Thanks |
|
September 4, 2021, 15:04 |
|
#8 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
The first component is i=0.
conc = C_YI(c,t,0);
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
September 4, 2021, 17:10 |
|
#9 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
Yes I know that and in the UDF I define int i = 0. So if I eliminate the loop the other part is correct in the UDF? If I eliminate the loop am I considering the mass fraction in each cell of the first species to calculate then the density?
Thanks |
|
September 4, 2021, 18:36 |
|
#10 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
If with "the loop" you mean "mixture_species_loop(THREAD_MATERIAL(t),sp,i) ", then yes.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". |
|
September 6, 2021, 03:57 |
|
#11 |
New Member
Antton
Join Date: Nov 2019
Posts: 11
Rep Power: 7 |
Hi again,
I eliminte the "loop" part butI have the same problems, the simulation doesnt convergence. If I only consider the temperatura and I delete the part in wich I take into account the mass fraction of my first species, the UDf that I use is the following one and the simulation convergence correctly: #include "udf.h" DEFINE_PROPERTY(density_mixture,c,t) { /* Definir variables */ int i = 0; Material *sp; real density; real temp; real conc; real alpha; real beta; real homogeneous_density; real homogeneous_concentration; alpha = 0.001222587; beta = 0.275; homogeneous_density = 748.435; homogeneous_concentration = 0.5167; /* Temperatura & concentracion de celda */ temp = C_T(c,t); /* Ecuación */ density = homogeneous_density*((1)-(alpha*(temp- 298.16))); /* Result return */ return density; } Why can happen this? Maybe is because the density and mass fraction equations are related and is not posible to calculate the density taking into account the mass fraction? Thanks |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error message: Insufficient Catalogue Size | Paresh Jain | CFX | 33 | August 16, 2024 06:09 |
Species Mole and Mass Fraction Macro | combustion | FLUENT | 18 | February 5, 2024 13:23 |
problem in temperature and liquid fraction value in the udf | durg | FLUENT | 0 | October 23, 2018 02:52 |
convective term of temperature and species mass fraction | comingdaytime | OpenFOAM Post-Processing | 0 | October 18, 2017 13:15 |
Accessing the species mass fraction for particles data in UDF | mac_09 | FLUENT | 17 | August 9, 2017 21:15 |