|
[Sponsors] |
March 27, 2020, 11:29 |
Simple residence time of fluid in each cell?
|
#1 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Hi,
I have a UDF that calculates species sink terms based on condensation. However, I want the sink terms to be capped by the mass flow of the species entering the cell in order to avoid mass imbalances (i.e. right now, I can calculate the mass that should condensate per second, but what if the residence time in one cell is very long and there isn't enough mass in the cell to sustain this sink term? The corresponding source of the DPM would then be larger than the sink). Now, I know the volume and the species concentration within the cell, but not the time which it takes for the fluid to pass through each cell. Is there a way to calculate this that does not involve going into annoying geometrical calculations with the velocity vector and the cell face orientations? Thanks in advance and have a nice weekend, Baum |
|
March 27, 2020, 12:44 |
Time and Source
|
#2 |
Senior Member
|
It is not clear whether you are talking about the residence time of the discrete particles or the continuous fluid. But in my view, you need not worry about the residence time. Within a UDF, executed every time-step or every iteration, depending upon which one it is, data is available for the current state. The mass of specie in a cell is known. You can always check if the sink term is larger than that or not. Secondly, are you using two separate UDFs for continuous phase sink and particle source?
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 30, 2020, 07:49 |
|
#3 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Hi vinerm, thanks for you anwer.
Let me explain the issue with an example, and please correct me if my thinking is wrong: I know that my (fluid) species concentration in a given cell is 1 kg/m³. I know that my (fluid) sink term due to condensation in that cell is 10 kg/m³s, which I calculated from the last particle iteration. Now, if the (fluid) residence time in my cell is longer than 0.1 seconds, the next fluid iteration would yield mass imbalances as far as I know. This is due to the following: Fluent calculates that 110% of the species in the cell is lost in the sink during this iteration, which of course doesn't happen, but instead 100% of the species is being removed. The amount of particles generated in the next particle iteration however does not know that there wasn't enough mass of the species in the cell, and instead produces enough particles worth 110% of the mass in the cell. Even more simply put, the sink term is a function of time, while the mass of the species is not. Thus, with enough residence time, I would hit a point where the mass of the species reaches zero, which would lead to imbalances. All of this is especially true since, once the concentration in the cell drops due to the sink term, the sink term also drops with it. It's more of an asymptote towards the saturation concentration, at which point the condensation sink term becomes zero. Now, I could prevent this from ever happening by dampening the sink term appropriately (think Runge Kutta Integration or enhanced Euler instead of simple Euler Integration). So I would need to do the following: - My sink term is 10 kg/s, my residence time is 0.15 s, my species mass is 1 kg - If I had this sink term, my species concentration would reach zero, and thus the sink term in the following iteration would reach 0 kg/s - Thus, a better approximation for the "real" sink term in this iteration is (10+0)/2 = 5 kg/s. For all of this, I need the fluid residence time in each cell as far as I know. Again, I may miss something very obvious here, so I'd be happy to find out that I'm wrong. Regarding your question: I want to use one Source UDF that calculates the sink term for each cell and saves it as a UDMI. The next particle iteration will inject particles based on the sink terms in those UDMIs. Thus, the particle source amount depends solely on the sink term, not on the actual mass depletion in the cell since the last DPM iteration. I hope this clears up some confusion. |
|
March 30, 2020, 08:28 |
Sink Term
|
#4 |
Senior Member
|
I am afraid that it became more confusing but I suppose I still understood some of it. In my view, you are looking at it from an incorrect perspective. For Eulerian reference frame, there is no concept of residence time as such since nothing moves. Every cell only has a mass of fluid and a velocity. But this mass does not move; only its value is reduced or increased, which you are trying to express in terms of residence time. For understanding purpose, this might be alright but for implementation of a physical phenomenon, this may lead to wrong results.
As far as I understand, you want to model condensation that become droplets or add mass to existing droplets. Your worry is if there is no mass of a particular specie in a cell, the code will still predict a sink and will cause specie to either become negative or below the value that it should not be. That's a correct concern. However, to resolve it, the approach would be to knock at the door of physics. Why would there be condensation? Is it because of temperature, pressure, or some chemical aspect? All of these phenomena drive the phase change based on some gradient and as the phase change takes place the gradient keeps on reducing. So, the values are always realized and never become unrealistic. If you really are interested in using a residence time, then you have to define it properly for Eulerian frame. Since you cannot tag the mass in a cell, like a particle, the standard definition will not work.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 30, 2020, 09:55 |
|
#5 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
I am a bit confused when you say you don't have a residence time in a cell in a Eulerian field. Maybe my definition is a little off, looking at it from a chemical engineering background as a kind of hydraulic retention time. Example: If I have a reactor with a fixed volume of 1 m³, and each second 0.1 m³ of a fluid flows in one end and out the other, then the mass change is zero, but the average residence time of that fluid is 10 seconds. If there is a reaction happening in this reactor, then each fluid molecule takes part in this reaction for 10 seconds on average.
Thus, if each cell were one of these reactors (and the reaction is my sink) with the velocity being exactly perpendicular to one of the faces, then the average residence time of each fluid molecule in that cell should be the length of the cell divided by the flow velocity. If the fluid velocity is not perpendicular to any face and my cell is not a hexahedron, we get into annoying geometry things, which I want to avoid, hence my question. Now, if the fluid residence time in the cell multiplied by the sink term is larger than the amount of mass in that cell, the solver would set the species concentration in that cell zero in the next iteration. Let's call the overall species amount removed from the eulerian phase m_species. My particle source term, however, would exceed the amount of removed species, because it is defined by the sink term, which again by our assumptions here is larger than m_species. Your explanation regarding the gradient is 100% correct, but my question concerns the situation where the sink term (an absolute value calculated for this iteration and each cell) saved into the UDMI of the cell causes the whole mass of one species in that cell to condense in the next iteration, leading to mass imbalances in my simulation and convergence issues. Again, I may just be making a mistake in my thought process when it comes to the Euler phase, but I'm not seeing it yet. |
|
March 30, 2020, 10:20 |
The Scenario
|
#6 |
Senior Member
|
I understand the scenario and as far as talking in terms of residence time is concerned, your understanding is correct. This is also correct that residence time would require a completely different definition if it needs to be defined in Eulerian reference frame because the fluid in each cell is not tagged. However, to ensure that you don't unphysical results, we need to look at the rate at which condensation is taking place. If you are considering a fixed rate or a rate that is not connected with any physical field, then some mechanism can be used to control it. If it is connected with some physics, then it should already be alright and it would give you expected results. I am not sure if this information is known to you or not and whether it is useful or not, however, you can access any field up to two time-steps before the current time. This might be useful determining the change in species fraction and then ensure that sink is not larger than this.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 30, 2020, 12:33 |
|
#7 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Okay, it's good to see that we are getting closer in our understanding. Let me try to give an example as to why I think that there could be problems occurring, or better yet: I'll describe my case.
- First, I compute a steady-state solid fuel combustion. My focus is on a stable flame, so for now there is no condensation happening anywhere because I turn those models off. If I turned the condensation models on here, the computational time would exceed years due to the very high amount of interactions in the simulations. - Once the flame is stable, I turn off many of the equations and focus on the condensation. I look at the released species everywhere in my domain. Especially behind the flame, where all species got released into the gas phase and the temperatures are quickly dropping again, the supersaturation ratios are incredibly high. As a reference: Homogeneous nucleation will occur around supersaturations of ~2-10, yet in some cells the supersaturation will be 1000+ because I disabled my condensation UDFs so far. - Once I turn on the UDF, it will calculate that the rate of condensation is extremely high in those later cells. Orders of magnitude higher (per second) than the species mass in each cell. High enough to possibly create very strong mass imbalances if the residence time of the fluid in each cell is long enough. - This could be prevented if the condensated mass rate could be limited by the maximum amount of mass in each cell. But in order for me to program this into my UDF, I would need to know the residence time (in my understanding). Does this help? |
|
March 30, 2020, 12:55 |
Supersaturation and Condensation
|
#8 |
Senior Member
|
How are you measuring supersaturation? If it is measured in terms of mass fraction or mole fraction, then supersaturation will be high only if the species mass fraction really is high, else, it won't be. So, if UDF uses the supersaturation criterion to determine the condensation rate, then automatically, it should reduce the rate of condensation as soon as the mass fraction reduces. It appears to be pointing towards the same aspect I mentioned in the previous post - you need to look at the UDF that is determining the condensation source. It certainly calculates it using some criterion and is not applying a fixed value. If that criterion is a field and has changes in its value due to source term, then automatically the source will reduce. Another aspect could be if you assume that the species field is frozen, i.e., whatever has been predicted by the combustion simulation is in a steady-state. In that case, there is always enough species and it will not change due to source term. So, in my view, you should look at the formulation you have in your UDF that calculates source term.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 31, 2020, 04:58 |
|
#9 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Supersaturation is measured as partial pressure of species A in that cell divided by the saturation pressure at that cell's temperature. This means that even with low concentrations (say 0.1 wt.-%) the supersaturation can reach really high values as soon as the temperature lowers enough (as the saturation pressure is given by an exponential function according to Antoine).
I'm also not freezing the species concentration, just the other species and the temperature and flow field. Otherwise, the solution would not make any sense. Thus, a reduction will take place. I think I now know though where our difference in understanding lies. You are completely correct that the condensation criterion will produce a source term that is lower as soon as the concentration lowers. This is already happening. However, my only concern is that in a single iteration at the start of the simulation, mass imbalances will occur. Those could lead to the whole simulation diverging or giving unrealistic results. As soon as I turn on my UDF, I'm afraid of large imbalances occurring, because the gradients and therefore source terms are incredibly high. I can't just use URFs for a better convergence here since my UDF gives fixed values for the DPM injections. Hence my idea of reducing the sources internally in my UDF by calculating the local residence time and adapting the source accordingly. |
|
March 31, 2020, 05:11 |
Single Iteration
|
#10 |
Senior Member
|
If it is only for one iteration then you may use a switch inside the UDF so that it under-relaxes the source value by a fixed amount just for the first time and then switches the under relaxation off. But for that you need to know how much under-relaxation need to be done.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 31, 2020, 08:48 |
|
#11 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
... and for that I would love to know the residence time of the fluids in that cell, which brings me to this topic
|
|
March 31, 2020, 09:56 |
Simplification
|
#12 |
Senior Member
|
I suppose for that even a simplified formulation should be alright. You can use velocity magnitude at the cell and volume of the cell to define a residence time. To define time, you can use definition of the characteristic length used in multiphase flows, i.e., cube root of the volume. Ratio of this and the velocity will give you a representative time value for each cell and that should be alright.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 31, 2020, 10:36 |
|
#13 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
True, that's a good first approximation, which sadly falls apart for highly non-hexahedral cells. My question is whether there is some way in Fluent to get the "true" information out of the cell info without going into annoying 3D velocity vectors and geometry calculations.
Maybe it doesn't matter too much if I only leave the dampening on during the first few iterations though. In my initial idea, I wanted to leave this "dampening" function (which would lead to quicker convergence for these strongly oscillating cells if I'm not mistaken) on all the time, but I can not do that with the "wrong" residence time in some cells, since the converged solution would still give a wrong nucleation rate then. |
|
March 31, 2020, 10:59 |
Calculation
|
#14 |
Senior Member
|
I do not think there is a simpler way to do it. Either you have to do calculations with respect to the velocity vector and face vectors or you have to use cell skewness to correct the length scale. In any case, there is some kind of geometric calculation involved.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 31, 2020, 11:38 |
|
#15 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Thank you for your help. Let's see if someone else knows of a smart way that we both are unaware of.
|
|
March 31, 2020, 11:53 |
Alternatives
|
#16 |
Senior Member
|
There certainly are other alternatives and here are at least two of those
1. You can do a mass less injection and the determine RTD. Massless particles follow continuous fluid and the time distribution essentially represents fluid time. 2. Second option is to use Spatial Age Distribution. This method was developed by someone at Dow Chemicals. The concept is simple. You need to solve a UDS with its diffusivity given as a diffusivity of any scalar under the influence of turbulence. This scalar essentially determines the age of any fluid in a particular cell. So, essentially, the value of the scalar is residence time.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
March 31, 2020, 11:55 |
Further References
|
#17 |
Senior Member
|
Here is something really useful; includes something similar to SAD
https://www.researchgate.net/publica...Mixing_Systems
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
April 1, 2020, 04:44 |
|
#18 |
New Member
Join Date: Dec 2019
Posts: 29
Rep Power: 7 |
Very nice, thank you! I will look into those.
|
|
July 15, 2020, 09:04 |
|
#19 |
New Member
Pravin Raj
Join Date: Jul 2020
Posts: 1
Rep Power: 0 |
Did you get any solution to this issue? I am also struggling with same exact problem of mass imbalance due to source term. I am currently using "croot(C_Volume)/V_mag" or C_U_G(c, t)[i].... Both are approximate.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Time Step Continuity Errors simpleFoam | Dorian1504 | OpenFOAM Running, Solving & CFD | 1 | October 9, 2022 10:23 |
Question about adaptive timestepping | Guille1811 | CFX | 25 | November 12, 2017 18:38 |
How to export time series of variables for one point? | mary mor | OpenFOAM Post-Processing | 8 | July 19, 2017 11:54 |
Fluid Residence Time | Eric1 | CFX | 4 | April 24, 2010 18:39 |
Warning 097- | AB | Siemens | 6 | November 15, 2004 05:41 |