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

Fix negative values

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2018, 07:18
Default Fix negative values
  #1
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
I have included an additional variable in my model, that flows under a convection-diffusion equation (in cfx transport). There is also a negative source (sink) . The analysis is transient, nad in the results the additional variable goes negative. I have included a source coefficient, but it still goes negative. What can I do about it, to constrain it from going negative?
Pled is offline   Reply With Quote

Old   September 16, 2018, 19:43
Default
  #2
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Are you sure your sink term is correct? If your sink term just pulls stuff out then it will just go negative.

If your additional variable is something which should not go negative (such as a concentration) you need a sink equation which reduces the amount pulled out to zero as you approach zero concentration.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 17, 2018, 06:26
Default
  #3
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,929
Rep Power: 28
Gert-Jan will become famous soon enough
Provided you implemented everything correctly, you might observe numerical over- and undershoots. So, reduce timestep and see if the problems reduces.
Gert-Jan is offline   Reply With Quote

Old   September 17, 2018, 10:25
Default
  #4
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
I cannot reduce timesteps, because my simulation is for 1 year. So every timestep is about 1 month. The problem is that even when I solve a problem with a timestep of minutes I still have negative values.
On other thing is that for every additional variable I have a source and a sink. The source does not depend on the additional variable itself, but the sink does.
Pled is offline   Reply With Quote

Old   September 17, 2018, 10:27
Default
  #5
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
Also the additional variables are concentrations.
Pled is offline   Reply With Quote

Old   September 17, 2018, 19:37
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Quote:
I cannot reduce timesteps, because my simulation is for 1 year.
A very common response. But totally wrong, I am afraid. To do CFD you need to:
* Work out how big a simulation you need to run to get the accuracy you require, including mesh and time step size
* Then you get a computer big enough to run the simulation in a time frame you are happy with.

If you decide the computer you want to run on and how long the simulation is going to take, then guess what the accuracy of the simulation is going to be? Hopeless - the results are going to be useless and you were better off not doing the simulation at all because it will not tell you anything useful.

So: You MUST determine the time step you need for accuracy first, even if that requires a huge run time. Once you have determined the accuracy you need you know what capacity computer you need to run it, and even if the simulation is viable at all. There are many CFD simulations which are just not viable to do on any computer as the resources required exceed the computing resources of the entire world (such as DNS of air flow over an aircraft).

Can you post your CCL?
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 18, 2018, 05:42
Default
  #7
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
Is there any way to post it only to you Glenn?
Pled is offline   Reply With Quote

Old   September 18, 2018, 07:05
Default
  #8
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
You can send me a PM (private message). But do not ask me CFD questions by PM, I will not answer it, as my signature says. CFD questions should be posted on the forum.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 18, 2018, 15:45
Default
  #9
Senior Member
 
Join Date: Jun 2009
Posts: 1,880
Rep Power: 33
Opaque will become famous soon enough
If you are solving additional variables that are bounded, you must understand the numerics of the CFD code you are using.

The advection-diffusion transport equation with a source/sink will produce unbounded solutions during iterative convergence. The linearization of the source term (other terms are already handled internally) is critical to prevent the solution to become unbounded.

Read the documentation for the treatment of the species equations or combustion models where bounded variables are computed, and try to implement the appropriate linearization.

Not using the best linearization possible will force you to reduce the pseudo timestep considerably, and if you are lucky to obtain a solution at all.

If you are solving for concentrations transport, may I ask why you cannot use the built-in equations for multi-component materials?
Opaque is offline   Reply With Quote

Old   September 21, 2018, 07:48
Default
  #10
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
I cannot use multi component materials, because some of the additional variables are human cells, for which there are no data for molar masses.

Also, in some of the components there is only a diffusion and not a convection term. So how can i model this in a multi-component flow.

Even if there were values for molar masses, can I model a diffusion equation as an expression or there would be analysis errors?

In reality cells are particles, which flow based only on diffusion.

So I can't find an appropriate way to model this. Can you suggest me something?
Pled is offline   Reply With Quote

Old   September 21, 2018, 21:13
Default
  #11
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Molar masses are only used in some fluid models. And sometimes an estimate is good enough. Don't just write it off out of hand.

For components which don't convect then yes, they should be an additional variable so you can model pure diffusion.

If you could post your CCL that would help explain what you are doing.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 26, 2018, 07:56
Default
  #12
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
ok How can I upload a ccl file as attached?
Pled is offline   Reply With Quote

Old   September 26, 2018, 08:19
Default
  #13
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
In CFX-Pre go File/export/CCL. Or right click on tree and view the CCL. Or go to the command line "cfx5cmds -read -def <def file name> -txt <Output text file.ccl>".

Then attach the text ccl file to your forum post.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 26, 2018, 08:35
Default
  #14
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
I know how to export a ccl, but not how to upload it here. were is the button for attachment?
Pled is offline   Reply With Quote

Old   September 26, 2018, 09:27
Default Is there any way to model a new material without molar mass?
  #15
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
If I just copy paste it, it cannot be uploaded since it is larger than the limit of words
Pled is offline   Reply With Quote

Old   September 26, 2018, 19:16
Default
  #16
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
FAQ: https://www.cfd-online.com/Wiki/Ansy...n_the_forum.3F
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   September 28, 2018, 04:48
Default
  #17
Member
 
Dimitrios S. P.
Join Date: Jan 2018
Posts: 63
Rep Power: 8
Pled is on a distinguished road
this is the ccl. There are functions of variable's values at the inlet
Attached Files
File Type: zip Files.zip (62.5 KB, 2 views)
Pled is offline   Reply With Quote

Old   October 2, 2018, 19:33
Default
  #18
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,872
Rep Power: 144
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Your CEL is too complex for me to check. It is not realistic for me to go through this in detail. If you want me to check it you are going to have to simplify it.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Reply

Tags
negative values, source coefficient


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
using chemkin JMDag2004 OpenFOAM Pre-Processing 2 March 8, 2016 23:38
rhoSimpleFoam negative rho values JuanRodriguez OpenFOAM Pre-Processing 0 March 25, 2015 14:25
Mass flow rate boundary condition with negative values ashtonJ CFX 3 November 26, 2014 06:21
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 14:06
[blockMesh] Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Meshing & Mesh Conversion 10 April 2, 2007 15:00


All times are GMT -4. The time now is 10:38.