|
[Sponsors] |
Negative values in a modified scalarTransportFoam |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
Hi all,
I am using a modified version of scalarTransportFoam which allows for variable diffusivity (although the problem I am encountering is also present for constant diffusivity). First, I solve the steady state flow profile using simpleFoam, which shows excellent convergence, approaches velocity profile I expect, and shows very small divergence errors, i.e. max(fvc::div(phi)) < 10^(-10). This velocity field includes some recirculation near the boundary, where I impose a fixed uniform value of the scalar. Due to this convective term, my scalar concentration goes negative near the boundary, which is unphysical. I am trying to figure out exactly what numerical schemes and solvers I should be using for this problem. Currently I am using: C { solver smoothSolver; smoother GaussSeidel; tolerance 1e-10; relTol 0; } where C is my scalar concentration, and div(phi,C) Gauss linearUpwind Gauss linear; but I have also tried many alternatives including bounded Gauss upwind, Gauss linear, Gauss upwind, etc... I would really appreciate any help! Thanks |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Ender Demirel
Join Date: Jun 2009
Location: Turkey
Posts: 20
Rep Power: 17 ![]() |
I recommend you to use limited scheme for the divergence term to limit the scalar variable C in the range of 0 to 1. Otherwise negative values may be encountered due to the truncation errors arising from the discretization scheme.
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
Awesome, thanks for this suggestion. I didn't know there were specific schemes for this case, but from what I can gather from the documentation it seems like:
div(phi,C) Gauss limitedLinear01 1; is the proper choice. Does that make sense? It does seem to result in smaller negative values for my scalar concentration, but it still doesn't strictly enforce positivity. Is there something I'm missing? |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Ender Demirel
Join Date: Jun 2009
Location: Turkey
Posts: 20
Rep Power: 17 ![]() |
I had used Gamma01 method to strictly bound the scalar variable.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
Thanks, I didn't find the Gamma01 method in the fvSchemes documentation, but when I try:
div(phi,C) Gauss Gamma01 1; in my divSchemes, I still find values of C that are negative. Am I still missing something? Edit: following hjasak's instructions here: Schemes for scalar in LES I also switched to laplacian(D,C) Gauss linear limited 1; and switched to Euler for ddt scheme. I still end up with negative values for my C. Also they are not trivially small values, but almost the same order of magnitude as my positive values. Thanks again |
|
![]() |
![]() |
![]() |
![]() |
#7 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
Here is an example code that illustrates the problem. I am using OpenFOAM 5.0. Simply unzip the directory, run blockMesh, and then simpleFoam, which will converge in about 0.525 seconds. Then copy the T initial condition into the converged directory: "cp 0/T 0.525". Then run scalarTransportFoam. If you use paraView to look at the final result, you will see that there are negative temparature values, which are non-physical. They're not that dramatic, but they also are not negligible, and I cannot eliminate them regardless of which fvSchemes I choose.
I would greatly appreciate any help. This same problem has been a hindrance on multiple different simulations at this point. Thanks! Edit: Also I should note that these negative values do not appear to go away with a more refined grid. Last edited by wildfire230; May 2, 2018 at 08:46. |
|
![]() |
![]() |
![]() |
![]() |
#8 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
I haven't done a comprehensive set of tests, but these negative values from scalarTransportFoam do not appear to go away with a finer mesh or smaller time step. I think it must be an issue with the selection of schemes, but I do not understand the details well enough.
|
|
![]() |
![]() |
![]() |
![]() |
#9 |
Senior Member
Join Date: Jul 2013
Posts: 124
Rep Power: 13 ![]() |
Hi all, I am still trying to solve this problem. Does anyone know the requirements on grid size for stability of the scalarTransportFoam solver for a given diffusivity coefficient and velocity field? For example, here: https://en.wikipedia.org/wiki/Numeri...usion_equation there is a condition listed as h < 2a/u, where a is the diffusivity coefficient, h is the grid size, and u is the fluid velocity. However, I believe this is specifically for the case of forward Euler centered difference.
Does anyone know the restrictions on grid size for scalarTransportFoam for a given diffusivity coefficient. Specifically, in my case the diffusivity is very small, so that the Peclet number is large. |
|
![]() |
![]() |
![]() |
![]() |
#10 | |
Senior Member
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 11 ![]() |
Quote:
I have encountered the same issue. I am having the scalar negative. I think its the solver issue more than the scheme. I am planning dig into the multiphase solver to check the implementation. Have you gotta any updates? Thanks, Rdf |
||
![]() |
![]() |
![]() |
![]() |
#11 |
Senior Member
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 16 ![]() |
> This velocity field includes some recirculation near the boundary, where I impose a fixed uniform value of the scalar. Due to this convective term, my scalar concentration goes negative near the boundary, which is unphysical.
I assume this is an outlet with a zero gradient b.c. for velocity. If you give zero gradient than it has to be there. The simulation is overstrained to enforce this. If possible, extend the outflow area to give the flow room for homogenizing.
__________________
Uwe Pilz -- Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950) |
|
![]() |
![]() |
![]() |
![]() |
#12 |
Senior Member
Reviewer #2
Join Date: Jul 2015
Location: Knoxville, TN
Posts: 141
Rep Power: 11 ![]() |
After some playing around with the code, it looks like this problem is associated with the boundary condition when the flow is pointing outwards. If you apply a fixedValues or a fixedGradient BC (centrally a fixedValues types too), the outgoing flux on that face will be calculated with the values that you specified which potentially will be larger than the quantity in that cell and produce a negative value. This is also should be the reason why there is the inletOutlet BC in the OpenFOAM (zeroGradient for outflow and fixedValue for inflow). Someone correct me if I am wrong.
Now for the most of the problem that you can avoid the inflow (reverse flow), you can just take care of this problem when you compute the flow field. |
|
![]() |
![]() |
![]() |
![]() |
#13 | |
New Member
Yanjun Tong
Join Date: Jul 2020
Posts: 21
Rep Power: 6 ![]() |
Quote:
![]() |
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Preventing negative scalar (UDS) values?? | Matthew Brannock | FLUENT | 5 | September 1, 2020 12:32 |
Cannot achieve negative wall shear stress values in CFD Post (ANSYS) | SAtkins | CFX | 3 | August 3, 2016 14:27 |
Negative values for minimum alphas | Taataa | OpenFOAM Running, Solving & CFD | 0 | June 28, 2016 04:04 |
Problem using large writeInterval values in Modified interPhaseChangeFoam | vasava | OpenFOAM Running, Solving & CFD | 4 | January 27, 2015 03:02 |
channelFoam for a 3D pipe | AlmostSurelyRob | OpenFOAM | 3 | June 24, 2011 13:06 |