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

How does CFX deal with small diffusion coefficients?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 11, 2018, 08:59
Default How does CFX deal with small diffusion coefficients?
  #1
Member
 
Join Date: Jun 2017
Posts: 40
Rep Power: 10
cardioCFD is on a distinguished road
Hello,

My question is a bit related to the CFX solver theory. It is known that small diffusion coefficients (like 1 e -11 m^2/s) may cause numerical instabilities. I was wondering if anyone has a clue how CFX deals with such issues when you solve transport equations for additional variables.

Thanks a lot.
cardioCFD is offline   Reply With Quote

Old   December 11, 2018, 11:27
Default
  #2
Senior Member
 
Erik
Join Date: Feb 2011
Location: Earth (Land portion)
Posts: 1,196
Rep Power: 24
evcelica is on a distinguished road
I don't think this would cause numerical instabilities.
That said, is your flow turbulent? If so then turbulent diffusion will be much larger than the molecular diffusion, so this coefficient will not matter too much anyways.
evcelica is offline   Reply With Quote

Old   December 11, 2018, 17:46
Default
  #3
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 18,011
Rep Power: 146
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Erik is correct, a low diffusion coefficient will not cause problems. It just means there will be just about no molecular diffusion.

A low viscosity might cause problems. In some cases this can cause the flow to go highly unstable. Viscosity is required to keep the flow stable. Is this what you mean?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   April 3, 2019, 11:11
Default
  #4
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
May I please follow up on this?
Although not problematic, with low Diff Coeff. and in pure diffusion case (flow turned off by expert parameters) with nonlinear source terms, it takes for ever to solve the problem.

I have a case (2D, additional variables and source terms) and as soon as I increase the time step above 1 second the linear solver overflows. Well, in a case where this diffusion problem is solved for 1 month duration, it will take a year to converge!!!
In COMSOL, it starts with millisecond time step and goes up to hours and converges within 1 hour. How to accelerate the problem convergence in CFX?
Thanks
ftab is offline   Reply With Quote

Old   April 3, 2019, 16:29
Default
  #5
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
To be specific, you are solving a pure diffusion problem + sources.

In steady state, or transient?
Opaque is offline   Reply With Quote

Old   April 3, 2019, 17:54
Default
  #6
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Quote:
Originally Posted by Opaque View Post
To be specific, you are solving a pure diffusion problem + sources.

In steady state, or transient?
Thanks for the reply! Correct, only Diff + sources. In future will consider convection (maybe).
I am doing it transient now, but the steady simulation is not also fast enough.
ftab is offline   Reply With Quote

Old   April 3, 2019, 18:25
Default
  #7
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
Steady-state convergence is all about linearization, and coupling; otherwise, the algorithm relies on a small timestep as an under-relaxation mechanism.

Would you mind stating the form of the equations? In particular, the sources and the form of the diffusion coeffcients?
Opaque is offline   Reply With Quote

Old   April 4, 2019, 13:06
Default
  #8
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Steady-state convergence is all about linearization, and coupling; otherwise, the algorithm relies on a small timestep as an under-relaxation mechanism.

Would you mind stating the form of the equations? In particular, the sources and the form of the diffusion coeffcients?

Thanks, absolutely!

There are 3 different Additional variables, first is free drug

diffusion-reaction Eq,

dC/dt = Dd2C/dx2 + Dd2C/dy2- Ka1*C*(B1-P) - Ka2*C*(B2-Q) + Kb1*P + Kb2*Q

and the other two are bound drugs

dP/dt=Ka1*C*(B1-P)-Kd1*P,

dQ/dt=Ka2*C*(B2-Q)-Kd2*Q,

only reaction; i.e. source and sink

ftab is offline   Reply With Quote

Old   April 4, 2019, 14:28
Default
  #9
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Just to clarify further, it works, and the results are ok, but it takes forever and crashes as soon as time step is increased. A similar simulation in COMSOL for instance takes 1 hour and the time step goes as high as hours. In CFX, takes days or weeks on cluster.
ftab is offline   Reply With Quote

Old   April 4, 2019, 15:01
Default
  #10
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
Interesting system.

I assume you have
- created 3 AddVariables
- activated the 3 AddVariables as Diffusive Transport Equation, use D as the diffusion coefficient for one of them, and 0/small for the other two
- created a sub-domain
- activated sources for each AddVar in the sub-domain
- added the strength of the sources as described in the equation
- added source coefficient for the sources

Would you mind describing the form of your linearization coefficients? and also I assume your variables are positive definite, correct?
Opaque is offline   Reply With Quote

Old   April 4, 2019, 16:55
Default
  #11
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Interesting system.

I assume you have
- created 3 AddVariables
- activated the 3 AddVariables as Diffusive Transport Equation, use D as the diffusion coefficient for one of them, and 0/small for the other two
- created a sub-domain
- activated sources for each AddVar in the sub-domain
- added the strength of the sources as described in the equation
- added source coefficient for the sources

Would you mind describing the form of your linearization coefficients? and also I assume your variables are positive definite, correct?

Thanks! I could not explain it better Opaque!
The Diff coeff cannot be zero, nor smaller than 1e-16. An Ansys expert told me not to put any number and it actually worked.

I have added NO source coefficients.
Could you please explain what you mean by linearization coefficient? I have done none in that regard.
Yes you are correct. Positive definite.
ftab is offline   Reply With Quote

Old   April 4, 2019, 17:05
Default
  #12
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
If you have no source coefficient (linearization coefficient), I am surprised you can even get a solution at all. The timestep must be infinitesimally small.

Linearization (source coefficients) of positive definite variables is an art; however, the first approach (for segregated solution algorithm) is to compute the derivative of the source respect to the solution variable.

In your case (barring typing errors), the source coefficients would be

Eq 1 --> - abs(Ka1*(B1-P) +Ka2*(B2-Q))

Eq 2 --> - (Ka1*C + Kd1)

Eq 3 --> - (Ka2*C + Kd2)

That is a zero approximation w/o controlling the positive definite aspect of neither C, P nor Q. Worth a try though

It would be great if you share the convergence plot as well with and w/o linearization.

Update:

I recall answering similar questions years ago. Using the Forum "Advanced Search" tool for one of my post, and "linearization" will find it for you.

In summary: there is a "Combustion Source Term Linearization" section in the CFX-Solver Theory doc worth looking at it if you feel numerically inclined. That is how combustion reaction mechanism are treated in CFX-Solver.
Opaque is offline   Reply With Quote

Old   April 4, 2019, 17:38
Default
  #13
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Opaque,
Thanks a lot for your time and elaborate explanation.
I will apply, even this rough source coefficients, and put updates here.
You are right. Probably I was lucky starting with infinitesimally small time points.
ftab is offline   Reply With Quote

Old   April 8, 2019, 15:11
Default
  #14
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Opaque,
Just wanted to update that your solution of lineraization PLUS adaptive time stepping works like a charm.
Thanks a lot
ftab is offline   Reply With Quote

Old   April 8, 2019, 15:25
Default
  #15
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
Glad to hear you got the algorithm to work w/o issues.

Did you observe any out of bounds values? Say < 0, or > 1 (normalized concentrations-> mass fractions)

I wonder if this case could have been setup using the built-in reactions mechanism?
Opaque is offline   Reply With Quote

Old   April 8, 2019, 17:24
Default
  #16
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Glad to hear you got the algorithm to work w/o issues.

Did you observe any out of bounds values? Say < 0, or > 1 (normalized concentrations-> mass fractions)

I wonder if this case could have been setup using the built-in reactions mechanism?

Good point!
I only observed small negative values (1.3e-6). I would rather even fix these. Any hint?
Would you direct me to study on built-in reactions mechanisms that you mentioned? totally new to me.
ftab is offline   Reply With Quote

Old   April 8, 2019, 17:49
Default
  #17
Senior Member
 
Join Date: Jun 2009
Posts: 1,938
Rep Power: 34
Opaque will become famous soon enough
ANSYS CFX can be customized for specific reactions. Check the CFX-Pre Users Guide (Chapter 28) - Materials and Reactions

On the negative values, if they are small and located in regions of low interest, I would not worry about them. Otherwise, check the section I mentioned earlier "Combustion Source Term Linearization"

Now keep in mind that some meshes can produce out of bounds solutions, and there is nothing you can do to prevent that besides except improving the mesh quality. Clipping solution values do nothing except exacerbate the problem somewhere else.
Opaque is offline   Reply With Quote

Old   April 9, 2019, 10:25
Default
  #18
Member
 
Ftab
Join Date: Sep 2011
Posts: 87
Rep Power: 16
ftab is on a distinguished road
Thanks a lot Opaque!
I learned a lot and fixed an issue which was a nightmare with your help!
ftab 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
[ICEM] Simple pipe meshing - problems with y+ in CFX Keizers ANSYS Meshing & Geometry 23 January 15, 2015 09:00
cfx diffusion to porous media bitak CFX 3 November 9, 2012 16:18
How to stop diffusion and advection in a zone for selected species. hda FLUENT 0 March 19, 2012 00:59
Pros and Cons for CFX, CFdesign, COMSOL Val Main CFD Forum 3 June 10, 2011 03:20
CFX 4.4 installation problem Pandu Sattvika CFX 1 December 1, 2001 05:07


All times are GMT -4. The time now is 22:58.