# How can I calculate mass flux[kg/m²s] by only inputting the mass fraction of a species in fluent?

Hello! In Fluent, I am curious about how to calculate mass flux of a species [kg/m²s] from the mass fraction of that species which has density=0.25kg/m³, that species was applied to a Wall BC (Horizontal line), there are no Normal velocities (Y-velocity) on that wall, but there are axial velocities (X-velocity) on that Wall boundary. That species has a Molecular weight=6kg/kmol. Note that there is only one species on that Wall boundary. In fluent, to set up that wall boundary, there is also the species tap to let us to fill out the mass fraction, so I put mass fraction=1, because there is only one species on that boundary. Therefore, how can I calculate the mass flux of that species [kg/m²s] from the detailed information that I provide? Or if you want more information, I can provide you further. It is the equation for calculating mass flux before running calculation in fluent, because after running calculation, I will get the results and I will calculate mass flux from those results by the equation provided by fluent: Ji=((density*Diffusion coefficient of a species)+(density*Effective diffusion coefficient of turbulent flow))*mass fraction gradient, then take this results to compare with the flux before running calculation. In this problem, I just want to know the equation or formulas to calculate that mass flux of a species before getting the results from fluent. Thank you! I will appreciate your help.

«1

• Actually you need to define an UDF there or rely on source terms in the next cell layers: You want to add or extract some part of the species you can then use DEFINE_SOURCE applied to that cell layer. Another way is to code all that using DEFINE_PROFILE where you provide the mass fraction of the specie as a result of equation (diffusion)

• To @DrAmine ! Thank you for your advise, but when I look at the source term, I realize that if we add the volume source, we have to add it in the whole fluid domain, but in my case I want to add volume source only on the elements next to Inlet 2 ( you can see Inlet 2 in the figure), the elements filled with red color, so in the UDF code, how can I do it? I am very young in UDF, can you guide me something? You can see my figures as the following:

Thank you again for your help!

• @DrAmine Thank you very much, I will try to create new cell zone first, and if I have any problem, I will come here again. Thank you for your help!

• @DrAmine Hello! Sir! I have done what you told me, except UDF. I created New Cell zone next to my boundary successfully, but I do not write UDF, I just put the constant value in the mass source. Is it acceptable or not? Because I do not know how to write mass source in UDF, I saw only the sample of UDF of momentum source, not mass source. This is why I do not know how to write UDF about the mass source. Another one problem, after when I input the mass source (constant value) into the selected cells, I still got the same results as the results when I did not input the mass source, so it seems that, molar concentration of a species is not changed at all, even if I input the mass source or not. Or is there any another ways that I can check the results of mass source that i input? Thank you! Sir! Please help me! I have been having this hard time for long time ago.

• If you're adding a species you need to add the mass source and species (same value), otherwise you're adding the last species in the mixture list (which should be the main material present).

• @Rob Thank you very much for your reply. But I am still not sure about what you mean, you meant that, if I add mass source = 0.001 kg/m³s, so I have to add species = 0.001kg/m³s as well, am I right? But I do not know how to add species in the unit of [kg/m³s], I saw only the species tap, then I can add only the mass fraction there. Usually, when I add mass source = 0.001 kg/m³s, then on the wall boundary next to the cells that I input mass source, there is a species tap=> mass fraction, then I input 1, it means that, there is only one species on that boundary. Or do I have to write UDF for inputting species = 0.001kg/m³s? It seems like my idea is very young like the elementary school student, so I will appreciate all your patient and reply to me! Thanks again!

• In source terms it'll be kg/m3/s

Which means the mass you add is for that species. Otherwise the mass is added to the bulk species. These are added to the cell zones, the boundary (wall) doesn't need anything doing for the species model.

• edited September 17

@Rob Thank again! When I saw the options in your Fluent, I realized that my Fluent does not have the option for adding each one species source like water source or oxygen source, it is because I use the old version of ANSYS Fluent, I am using Fluent 2015. Which version are you using? In my case, I want to add only single source on the selected cell, not mixture source, this is why I want to have the options as yours. Thank you very much!

• @Rob One more thing, do I need to define momentum source or not? Because when I read the manual of FLUENT, it is written that we cannot only define the mass source without the momentum source, should I? And because I use the turbulent K-epsilon model, do I need to define the turbulence sources or not? The following is what written in the Fluent Manual :

• To @Rob ! I am sorry, In my version, there are also the options as yours, I am really stupid, because i did not scroll down.Now I can add mass source of a species to my selected cell, but I am still not sure whether I should add momentum source and turbulence source or not. I will always appreciate your advise!😁

• edited September 17

@Rob ! Now I got the results and my results of species seems to be wrong, but I am not sure about my hand calculation because I compare the results of mass flux (value 1)= (mass source which i added*cell volume)/cell surface with the equation provided by manual of fluent talking about the flux of a species (value 2): Ji=-((density(i)*Di,m)+(density(i)*Dt))*mass fraction gradient. I mean I compare the value 1 and value 2. Is it the correct way to compare? But the results are completely wrong. Is there any equation for checking the results of that mass source after calculation?

Another one problem is: when I add the big value of mass source, the solution is not converged, then the velocity field is changed, so it means that when we add mass source, we also add velocity?

• You need to calculate the mass you want to add per second and then divide that by the cell volume you're applying it to. There's no need to add momentum in most cases, but you may need to add/remove energy to account for the source mass temperature (otherwise I think it'll be at the default reference temperature, changing the reference doesn't change the temperature added mass appears at).

The mass flux report should show the source,

• edited September 17

Dear@Rob ! Thanks again! I understand what you guided me! However, I am not sure about the value of mass flow rate (kg/s) which I need to calculate. Until now, In order to calculate mass flow rate in kg/s , I have been using the formula from Fluent which is: m=density*velocity*cell area= (kg/m³)(m/s)(m²)=kg/s. Then I divided this mass flow rate (kg/s) by cell volume (m³), thus the result of mass source should be kg/m³-s. Then after calculation, I compared the value of mass flow rate(kg/s)=density*velocity*cell area with the results in the flux report that you showed me. Is the formula which I used correct? But there is another problem, when I want to get the results of mass flow rate by going to report flux, then mass flow rate, I cannot see the 8 cells which I want to show the mass flow rate, in stead, I saw 15 surface bodies (I created only 8 new cell zones next to the inlet 2, so it should appear only 8 surface bodies). Is there something wrong in my mesh part?But in the cell zone condition, I saw only what I created (8 new cell zones and one more surface body which has no source). I really need your help! Thank You! I hope I can solve my problem soon because you have been teaching me a lot! You can see my figures below:

• Mass flow is something you need to determine BEFORE you open the software, that will be in kg/s or you can calculate it from velocity & density. You then need to convert that into kg/m3/s for the source term (divide by the source cell zone volume) and enter that number into the mass & species sources.

As an aside, I work UK office hours and typically am on here around lunchtime depending on other commitments. We will get to you but bumping threads isn't going to speed it up.

• @Rob Thank you and Yes, I did all as what you guided me, and I got the mass source around 0.25kg/m³-s in each cell according to the X-velocity, then I added this value to mass source and species in Fluent, but when I ran calculation, the solution is not converged. I realized that if I add mass source which is bigger than 0.01 kg/m³-s, the solution of calculation is not converged. What is this problem? Thank you!

• @Rob Hello! Sir! Finally, I got the right results of mass flux of a species, but I do not know why the velocity vector is changed? When we add mass source, does it mean that we add velocity as well? You can see the results of my velocity vector before adding mass source and after adding mass source.

1/ Velocity vector before adding mass source

2/ Velocity vector after adding mass source of a species

I really thank you for spending your precious time to help me so far, I hope you will keep replying to my question. Thanks!

• @Rob ! Please reply to me! I knew that you are very busy, but I really need your help! Thanks!

• Yes, I was busy gardening, relaxing and doing all the stuff that people do at weekends.

Looking at your model. You're adding mass, and therefore volume into your domain. What happens when you continuously add material into a system?