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

convergence problem with source terms

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

Like Tree5Likes
  • 1 Post By ghorrocks
  • 1 Post By Opaque
  • 1 Post By evcelica
  • 1 Post By ghorrocks
  • 1 Post By Opaque

Reply
 
LinkBack Thread Tools Display Modes
Old   December 6, 2017, 04:14
Default convergence problem with source terms
  #1
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Dear all,

In CFX, I am trying to simulate chemical reactions as source terms of species in flow. Species are defined as volumetric variables with transport equation.

The source coefficients are set to be the source magnitude divided by the species concentration.

The simulations are steady state and due to the complex nature of reactions, I stop simulations after ~30,000 iterations, where flow in fully converged and there is only slight change in the species concentrations.

However, there appear some regions with negative values of species concentrations in the domain.

I am attaching a snapshot of the domain with the blue regions showing negative values. Flow direction is shown by arrows, and sources are only active in the circles where the residence time is greater than some threshold. But as you see negative values appeared also in the tube underneath.

Note, that before activating chemical sources, I simulated a flow only system to reach steady state, then the sources were activated.

I appreciate any comment/help on that.

Thanks a lot.
Attached Images
File Type: png 4CFDOnline.png (35.9 KB, 13 views)
cardioCFD is offline   Reply With Quote

Old   December 6, 2017, 06:32
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 14,606
Rep Power: 113
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
Wiggles, overshoots and undershoots are common issues in numerical simulation. I recommend you look in a numerical methods textbook to get some background in this area.

Things to look at:
* advection scheme, especially for the species variables (this is the main thing to look at)
* order of time differencing
* whether convergence is adequately tight
* Other numerical settings can have an effect but are usually close to optimum for most cases.
cardioCFD likes this.
ghorrocks is offline   Reply With Quote

Old   December 6, 2017, 09:26
Default
  #3
Senior Member
 
Join Date: Jun 2009
Posts: 781
Rep Power: 15
Opaque is on a distinguished road
Are you modeling the species and chemical reactions using the built-in functionality in ANSYS CFX, or a custom implementation using Additional Variables?

ANSYS CFX already takes care of several issues with chemical reactions such as:

- Linearization of reaction rates for robustness and faster convergence
- Appropriate species weighting when computing mixture properties
- Consistent discretization between energy transport and species transport
- etc

A custom implementation lacks all the above, and it will take time to tune it up for efficient simulations.

My 2 cents.
cardioCFD likes this.
Opaque is offline   Reply With Quote

Old   December 6, 2017, 10:22
Default
  #4
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 747
Rep Power: 14
evcelica is on a distinguished road
One simple thing is to reduce your time step, which will reduce the overshoots.

I always found that if my source term was set to sink greater than all the variable in a certain time step, it would become unstable. However if I cut that time step in half, it would only sink half the variable amount, and proceed fine. Double the original time step, and it would sink 2x the actual amount and go negative.

Source term linearization fixes this though I believe, but have never done so, I just use smaller time steps.

But all the previous suggestions are more proper/advanced, mine is just the quick fix for certain cases.
cardioCFD likes this.
evcelica is offline   Reply With Quote

Old   December 11, 2017, 07:01
Default
  #5
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Are you modeling the species and chemical reactions using the built-in functionality in ANSYS CFX, or a custom implementation using Additional Variables?

ANSYS CFX already takes care of several issues with chemical reactions such as:

- Linearization of reaction rates for robustness and faster convergence
- Appropriate species weighting when computing mixture properties
- Consistent discretization between energy transport and species transport
- etc

A custom implementation lacks all the above, and it will take time to tune it up for efficient simulations.

My 2 cents.
Thanks to all for the comments. I took Opaque's suggestion and defined a variable composition mixture, instead of defining species' concentrations as additional variables. For the reactions, I defined sources on mass fractions.

Apparently, the problem with the overshoots is resolved. Thanks.

To check the new setup, I deactivated all the reactions and simulated only the flow of reactants and the carrier liquid in the system. Here are the observations:

1) The convergence rate dropped remarkably. Once the flow is settled, I increased timescale factors for species.mf by 1000 which led in convergence after ~100 iterations.

2) Once the convergence reached, I compared the velocities and there were some differences between the previous (additional variable) setup and this (variable composition mixture) setup. I would consider it to be natural as now I have a multicomponent flow (although the concentration of species are very small) with each specie having a different kinematic diffusivity.

I can see some potential reasons, but to be honest, I am not sure which result is more reliable. Would it be possible than the increase in timescale factor (multiplication by 1000) caused some problem?

Many thanks for your attention. Any comment on these would be appreciated.
cardioCFD is offline   Reply With Quote

Old   December 15, 2017, 16:14
Default
  #6
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Are you modeling the species and chemical reactions using the built-in functionality in ANSYS CFX, or a custom implementation using Additional Variables?

ANSYS CFX already takes care of several issues with chemical reactions such as:

- Linearization of reaction rates for robustness and faster convergence
- Appropriate species weighting when computing mixture properties
- Consistent discretization between energy transport and species transport
- etc

A custom implementation lacks all the above, and it will take time to tune it up for efficient simulations.

My 2 cents.
Hi Opaque,

As I mentioned I took your decision and defined a variable compositionmixture instead of using additional variables to represent species concentrations. But I am still using sources to define reaction rates since when I change the mixture type to reacting flow and would like to define reactions using the CFX built in method, it asks me to specify heat of reaction. I do not want to solve any energy equation or consider heat transfer in my model. Thats why I used variable composition mixture + source terms.
The problem with negative concentrations is solved but I am still struggling with convergence since residual curves become flat after ~1000 iterations.
I tried to increase timescale factor but to no avail.
I was wondering if you have any suggestion for me at this stage. Thanks a lot.
cardioCFD is offline   Reply With Quote

Old   December 15, 2017, 18:51
Default
  #7
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 14,606
Rep Power: 113
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
Make sure you have read the FAQ on this topic: https://www.cfd-online.com/Wiki/Ansy...gence_criteria
cardioCFD likes this.
ghorrocks is offline   Reply With Quote

Old   December 15, 2017, 22:57
Default
  #8
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Thank you. Yup, I have already read this and tested most of the suggestions. Is there any way to
1) use variable composition mixture while defining chemical reactions using cfx built in functionality?
Or
2) use reacting flow mixture while not including the heat transfer and energy equation?

To me, it seems that if I use variable composition mixture then I should define reactions using sources, and the only way to use cfx built in functionality for chemical reactions is to define mixture as a reacting flow and then I should also define heat of reactions.

Any advice? Thanks
cardioCFD is offline   Reply With Quote

Old   December 18, 2017, 10:01
Default
  #9
Senior Member
 
Join Date: Jun 2009
Posts: 781
Rep Power: 15
Opaque is on a distinguished road
Not sure I understand your approach completely.

If you use the ANSYS CFX reaction description mechanism, which assumes (right or wrong) that a reaction transforms energy, you should not need to setup any sources into the species equations. They are automatically derived from the reaction mechanism associated with the mixture.

Regarding the heat of reaction parameter, can you just make it 0 and do not activate the heat transfer model (do not solve the energy equation)? Sure, some diagnostics regarding the heat of formation, or related may not make sense (But you will know why, correct?)

If you look at the combustion tutorial, you will see there is no sources setup anywhere.
cardioCFD likes this.
Opaque is offline   Reply With Quote

Old   December 19, 2017, 03:31
Default
  #10
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Not sure I understand your approach completely.

If you use the ANSYS CFX reaction description mechanism, which assumes (right or wrong) that a reaction transforms energy, you should not need to setup any sources into the species equations. They are automatically derived from the reaction mechanism associated with the mixture.

Regarding the heat of reaction parameter, can you just make it 0 and do not activate the heat transfer model (do not solve the energy equation)? Sure, some diagnostics regarding the heat of formation, or related may not make sense (But you will know why, correct?)

If you look at the combustion tutorial, you will see there is no sources setup anywhere.
Thanks a lot Opaque,
I am trying to define the reactions using the built-in functionality. Thanks
cardioCFD is offline   Reply With Quote

Old   December 19, 2017, 10:13
Default
  #11
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
Quote:
Originally Posted by cardioCFD View Post
Thanks a lot Opaque,
I am trying to define the reactions using the built-in functionality. Thanks
Hi Opaque,

I tired to define the reactions using CFX built-in functionality. I have 6 species and an inert carrier fluid. I did not know the specific heat capacity of each specie and I am not interested in simulating heat transfer at all, so I put Cp = 0 for all species.

Here is an example of how I defined the reactions:

REACTION: plateActTH
Option = Single Step
FORWARD REACTION RATE:
Option = Expression
Reaction Rate = plateActRateTH
END
PRODUCTS:
Materials List = AP
Option = Child Materials
CHILD MATERIAL: AP
Option = Stoichiometric
Stoichiometric Coefficient = 1.0
END
END
REACTANTS:
Materials List = RP
Option = Child Materials
CHILD MATERIAL: RP
Option = Stoichiometric
Stoichiometric Coefficient = 1.0
END
END
END

REACTION: plateActTHBlood
Additional Materials List = AP,Blood,RP
Option = Multi Step
Reactions List = plateActTH
END

And here is how I defined the reacting mixture:

MATERIAL: mixture
Material Group = User
Option = Reacting Mixture
Reactions List = plateActTHBlood
END

And I chose mixture as the fluid passing through the default domain, setting transport equations for each component and constraint for the carrier fluid (blood).

mixture is defined to be an ideal mixture.

When I start the simulations I see that the reaction products residuals + the monitor point with reaction products are all zero! meaning that the reactions are not taking place.

I was wondering if you have got any idea why this happens? I guess it might be related to the reaction energy which does not satisfy the Gibbs theorem because I set all the heat capacities to zero?

btw, the heat transfer mode is isothermal at 25 degree C.

I would appreciate if you have got any advice. Many thanks.
cardioCFD is offline   Reply With Quote

Old   December 19, 2017, 11:16
Default
  #12
Member
 
Join Date: Jun 2017
Posts: 37
Rep Power: 2
cardioCFD is on a distinguished road
To update:

I found out that the reason was much more stupider than one could think! I did not activate the combustion: finite rate chemistry in the default domain. Now I activated it and it starts working. The only thing I do not understand, is the difference between setting combustion model to finite rate chemistry in the default domain AND setting combustion or reaction to finite rate chemistry while defining each reaction?
cardioCFD is offline   Reply With Quote

Old   December 19, 2017, 15:54
Default
  #13
Senior Member
 
Join Date: Jun 2009
Posts: 781
Rep Power: 15
Opaque is on a distinguished road
A reaction rate can be computed using Finite Rate Chemistry, or approximated by another model such Eddy Dissipation, etc.

As long as you are using the same option consistently, nothing to worry about. Otherwise, it is a hierarchical definition of which option takes precedence.
Opaque is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 11 November 1, 2016 07:43
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 towanda OpenFOAM Community Contributions 6 September 5, 2015 21:03
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 15:14
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18


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