CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

Residence time

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2020, 04:30
Default Residence time
  #1
Member
 
Davide
Join Date: Jul 2015
Posts: 79
Rep Power: 7
marsa27 is on a distinguished road
Hi,
I would like to know how is possible to calculate the residence time of the streamline in CFX. My domain is a box in which the air enters from a patch and then exits form another patch. How can I calculate the residence time of the air to pass from the inlet to the outlet patch? Is it possible to export something to have the precise value for every streamline at the outlet?
Or is it possible to have a graph that shows how many streamlines take some time to exit?

Thank you
marsa27 is offline   Reply With Quote

Old   August 5, 2020, 19:36
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,344
Rep Power: 126
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
You can get the residence time for a streamline by putting the time variable on the streamline object (as a colour if you like).
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   August 6, 2020, 02:16
Default
  #3
Member
 
Davide
Join Date: Jul 2015
Posts: 79
Rep Power: 7
marsa27 is on a distinguished road
Is it possible to have an average residence time among the streamlines in the outlet patch?

Quote:
Originally Posted by ghorrocks View Post
You can get the residence time for a streamline by putting the time variable on the streamline object (as a colour if you like).
marsa27 is offline   Reply With Quote

Old   August 6, 2020, 07:40
Default
  #4
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,344
Rep Power: 126
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
It might be easier to calculate this in run-time. Add an additional variable, make it convection only with a source term over the entire domain of 1 [1/s]. This means the additional variable will accumulate 1 every second. Rerun the simulation. It will be a normal post processing variable which you can calculate averages any where you like.
karachun likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   August 7, 2020, 02:44
Default
  #5
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,166
Rep Power: 17
Gert-Jan is on a distinguished road
It is indeed possible to add a scalar that can calculate the residence time as a variable in the domain. I consider this as an inaccurate apporach since the variable suffers from mixing. Meaning that liquid with short residence time mixes with liquid with high residence time, ending up at an average value.
Better add massless particles, track these in a one-way coupling calculation. In Output Control add a csv-export of particle data (velocity, time, traveling distance) at outlets of interest. You can set this all in CFX-Pre. After the run, open the csv in a spreadsheet and calculate the average resisdence time and make resisdence time distributions. In general, that is the information you want.
Gert-Jan is offline   Reply With Quote

Old   August 7, 2020, 03:15
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,344
Rep Power: 126
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
I would not dismiss the scalar approach out of hand. While it does have diffusion, if you use a convection only scalar (ie no added diffusion) and have a mesh with reasonable resolution and properly converged the diffusion can readily be made small enough that it is negligible. If getting the time correct is critical and you are using this approach then you should do a sensitivity analysis on mesh size. I suspect you will find this approach converges before the fluid modelling does, meaning that any mesh which is sufficiently resolved to capture the flow will also be sufficiently resolved to capture the time accurately using the scalar approach.

The scalar approach has the big advantage that it then gives you a variable field. A variable field makes it simple to do calculations like average over an area. Any particle based approach means it is more challenging to perform calculations.

In fact you could say the particle approach is less accurate that the scalar approach here because you have to use some form of interpolation function over the area you are interested in, and unless you are a numerical methods guru you are going to use less accurate interpolation functions than CFX uses to solve the equations. So the particle approach has its own approximations

My vote is still to go with the scalar approach and only give up on it if the mesh sensitivity analysis shows it is not converging with a reasonable mesh size.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   August 7, 2020, 03:47
Default
  #7
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,166
Rep Power: 17
Gert-Jan is on a distinguished road
I am a chemical engineer. With that backgorund, you get biased to residence time distributions, since it is has a link to chemical (side) reactions. If you use the scalar approach, you get as many (mixed) values as elements/nodes you have on your outlet. Not enough for my residence time distributions.

So, it depends a bit on the application Davide has. If he wants the time streamlines have on the outlet, that resembles a bit the particles track approach. However, I find it hard to obtain a table with end values from a streamlines in Post out of an exported csv file. At least harder than the predefined export of particles values at the outlet. Since the solver spits it out at the end of the run. Therefore I prefer the particle approach.
Gert-Jan is offline   Reply With Quote

Old   August 7, 2020, 16:59
Default
  #8
Member
 
Henrique Stel
Join Date: Apr 2009
Location: Curitiba, Brazil
Posts: 74
Rep Power: 13
Stel is on a distinguished road
Quote:
Originally Posted by marsa27 View Post
Hi,
I would like to know how is possible to calculate the residence time of the streamline in CFX. My domain is a box in which the air enters from a patch and then exits form another patch. How can I calculate the residence time of the air to pass from the inlet to the outlet patch? Is it possible to export something to have the precise value for every streamline at the outlet?
Or is it possible to have a graph that shows how many streamlines take some time to exit?

Thank you
Try this and check if it's what you want:

Create the streamlines as usual in CFD Post, name it as you want, for instance the default "Streamline 1" name. Click on File>Export>Export, ensure that Generic is chosen as Type, choose the Streamline 1 in Locations, and down in the white box hold Ctrl to select as "Selected Variable(s)" the following quantities, Streamline Number on Streamline 1 and Time on Streamline 1. Save the file as a .csv. Open this csv file in Excel, and sort all the Data in ascending order using as a reference the column where the Streamline Number on Streamline 1 values are located. With this you should have the x, y, z and time values of each streamline listed, one by one. If all of the created streamlines run all the way from inlet to outlet, the final time value of each streamline should be their travelling time from inlet to outlet. If you want to ensure that all of them reach the outlet, try to create the streamlines choosing the Backward option and starting from the Outlet instead of the inlet.

Hope that works for you. Good Luck.
Stel is offline   Reply With Quote

Old   August 9, 2020, 05:26
Default
  #9
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,166
Rep Power: 17
Gert-Jan is on a distinguished road
This works when the geometry is simple. But for complex geometries I find it very hard to find enough streamlines that travel through the geometry without stopping on a wall, or wherever. Either starting from an inlet, outlet, or a plane somewhere in the middle, with Forward and Backward calculation. I get Random streamlines, where it is hard to control and get statistically meaningfull results. And plotting 10000 streamlines in Post is undoable. Tracking 10000 particles while exporting the values on the outlet is a piece of cake.
Gert-Jan is offline   Reply With Quote

Old   August 11, 2020, 15:33
Default
  #10
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 973
Rep Power: 18
evcelica is on a distinguished road
I don't see why the scalar approach would be inaccurate? Yes, the scalar diffuses, but so do the fluid molecules. Any streamline/particle approach seems to me that you would only be tracking a small fraction of the particles, not the fluid continuum, and disregarding the actual diffusion that takes place? The scalar approach seems the more accurate way to me.
And as Glenn states, you can control the amount of diffusion if want to, though that seems wrong. (wrong physics, not wrong Glenn of course)

massFlowAve(Residence time)@Outlet should always = (Volume / VolFlowRate) for an incompressible fluid. Can we agree on that? Does the streamline/particle approach show this as well? It should as more and more of them are added?

Last edited by evcelica; August 12, 2020 at 14:07.
evcelica is offline   Reply With Quote

Old   August 13, 2020, 02:49
Default
  #11
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,166
Rep Power: 17
Gert-Jan is on a distinguished road
I agree, the scalar approach is elegant and simpler despite the limitations for residence distributions. However, I would like to extend my problem a bit further. I could use some help here as well. And it's not hypothetical.

Consider a chemical reactor with 2 inlets. For the liquids from both inlets, I want to determine the residence time (distribution) separately. How are we going to do that using the scalar approach?

For liquid 1 entering through inlet 1, I can define scalar 1 with a source term in the volume. For the scalar I start with zero on inlet 1. But what value should I put for this scalar 1 on inlet 2? CFX demands a value there.
The same applies the other way around, I can define scalar 2 for liquid 2 entering though inlet 2 and start with zero. But what should I set for this scalar 2 on inlet 1? CFX demands a value there as well.

Does anyone have a solution for this case? I need to set zero gradient for scalar 1 on inlet 2, or 'adiabatic', or......

Regs, Gert-Jan
Gert-Jan is offline   Reply With Quote

Old   August 13, 2020, 06:02
Default
  #12
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,344
Rep Power: 126
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
That is a bit limiting. The only supported boundary condition for the additional variable is a Dirichlet condition. My suggestions are:
* Have a look in the beta features or unsupported features (ie look in the RULES file) to see if Neumann boundary conditions can be done as a beta or unsupported feature.
* Do your own crude Neumann boundary condition by setting the boundary value of scalar 1 at inlet 2 to be equal to the value of scalar 1 a short distance into the domain in front of inlet 2. This will approximate a zero gradient boundary. A bit of a hack, but it might work for you.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   August 13, 2020, 18:22
Default
  #13
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,344
Rep Power: 126
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
Just checked: The "Zero Flux" option works for me on an additional variable on an inlet. It is a CCL only option, so you can't set it in CFX-Pre. It needs to be defined as a CCL object outside of CFX-Pre. Let us know if that works for you.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   August 14, 2020, 04:18
Default
  #14
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,166
Rep Power: 17
Gert-Jan is on a distinguished road
Thanks. I'll give it a try the next time I need to calculate the residence time.
Gert-Jan is offline   Reply With Quote

Old   August 17, 2020, 14:29
Default
  #15
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 973
Rep Power: 18
evcelica is on a distinguished road
Just a thought about Gert-Jan's case:
You could also use boundary sources for your inlets instead of "inlets". Then the wall they came from can be zero-flux for the scalars.

Each inlet would be a different fluid, even if they were the same fluid, you would use a mixture for the two fluids.

For your two scalars, each would be added to the volume on a fluid volume fraction basis.
evcelica is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script for pseudo-parallel usage of reconstructPar kwardle OpenFOAM Post-Processing 39 July 1, 2020 09:13
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 07:47
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58


All times are GMT -4. The time now is 04:23.