|
[Sponsors] |
September 23, 2016, 02:14 |
Effect of "Yi.max(0.0)" in YEqn.H
|
#1 |
Member
Join Date: Aug 2015
Posts: 37
Rep Power: 10 |
reactingFoam's YEqn.H (applications/solvers/reactingFoam/YEqn.H) sets up an equation called YiEqn and then solves it as follows:
Code:
YiEqn.relax(); fvOptions.constrain(YiEqn); YiEqn.solve(mesh.solver("Yi")); fvOptions.correct(Yi); Yi.max(0.0); What does "Yi.max(0.0)" do? |
|
September 23, 2016, 06:51 |
|
#2 |
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12 |
Hi,
I think you are correct, as to my understanding it is a hard coded lower bound for each of the scalar fields. It forces Y field to be non-negative. If after solving species field equation Yi is negative somewhere on your mesh, then the code just takes that value and substitutes it with 0.0. If it was as you suggested -> min(0.0) then it would do an opposite job of cutting of all of the positive values and forcing them to be zero. This is done in addition to using a Gauss limitedLinear 1 fvScheme on div(Yi_h) that should try and get the top bounding condition for the mass fraction fields sorted. Here's a snippet of how does the max() member function of GeometricField look like: Code:
template<class Type, template<class> class PatchField, class GeoMesh> void Foam::GeometricField<Type, PatchField, GeoMesh>::max ( const dimensioned<Type>& dt ) { Foam::max(internalField(), internalField(), dt.value()); Foam::max(boundaryField(), boundaryField(), dt.value()); } Hope this helps. Ben Last edited by rhythm; September 23, 2016 at 10:20. |
|
September 23, 2016, 11:01 |
|
#3 |
Member
Join Date: Aug 2015
Posts: 37
Rep Power: 10 |
Thanks for your reply, Ben.
Good to hear that you agree with my interpretation. I suppose that the idea behind calling it "max" is that A.max(b) is equivalent to A = max(A,b) ? This is the part that I've gotten hung up on; I've been mentally parsing A.max(b) as "clip A so that its maximum is b," which is equivalent to A = min(A,b). Also, for consistency, wouldn't it also make sense to add a second line: Code:
Yi.min(1.0); |
|
September 24, 2016, 07:28 |
|
#4 | ||
Member
Ben Jankauskas
Join Date: Jun 2013
Location: Exeter
Posts: 34
Rep Power: 12 |
Hi,
Quote:
Quote:
My knowledge of the numerical schemes lacks, but I would think that this is the reason a Gauss limitedLinear 1 is used in fvSchemes. In addition to a lowerBound value of 0.0 it numerically tries to keep the solution between [0:1] hence hopefully making it as physical as possible and making the bounding slightly smoother. This is a bit of a speculation on my part, so I'll read through the limiting schemes code later today, and if I have additional ideas I'll share it. Ben |
|||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
modelling the effect of smear effect in Casing with Drilling | babak1 | Main CFD Forum | 0 | July 17, 2013 10:48 |
Can Flow-3D solve the Joule-Thomson effect? | seasoul | FLOW-3D | 8 | December 21, 2011 00:01 |
Can 'shock waves' occur in viscous fluid flows? | diaw | Main CFD Forum | 104 | February 16, 2006 05:44 |
VOF and strong surface tension effect | phsieh2005 | Main CFD Forum | 1 | August 30, 2005 06:56 |
Iclude particle diameter effect in wall? | yueroo | FLUENT | 0 | April 14, 2001 03:56 |