Tuesday, 19 April 2016

Way Off Topic - Brower's Fog Film Model.



Brower’s fog film model, according to Ghiaasiaan (2007). Starts with the molar-flux based, Couette flow model of condensation from a carrier gas:

where:
HGI
Heat transfer coefficient of gas film
TG
(average?) gas temperature
TI
Saturation temperature, at interface gas concentration.
HFI
Heat transfer coefficient of liquid film.
TF
(average?) liquid temperature
N”
Molar flux
hfg
Latent heat of condensation

where:
K~GI
Mass transfer coefficient (molar basis)
Xv,s
Mole fr of vapour at the surface of the liquid.
Xv,G
Mole fr of vapour in the bulk gas.

Normal film models overpredict the condensation rate when fog occurs. Brower’s model applies corrections to the above. 
These correction factors are found using the equations Browers developed:
where:
Cpv
Heat capacity of vapour
Le
Lewis number , thermal diffusivity over mass diffusivity av/Dv,n.
ShGI
Sherwood number, mass transfer rate over diffusion rate KGI pipe dia/ρGD12
NuGI
Nusselt number
F
F = Pv(T)/P. so I’m guessing, equilibrium vapour pressure over total pressure, which would make it equilibrium mole fraction by Raoult’s law. Which would make dF/dT]TI the gradient of this at the gas/liquid interface.

REF
Ghiaasiaan, SH. 2007. Two phase flow,boiling and condensation in conventional and miniature systems. Chambridge University Press.

Wednesday, 20 January 2016

Discretisation in Fluent

Fluent has a variety of options for the solver. In this post I’ll be covering first and second order upwind schemes. Other options exist, such as QUICK and MUSCL, but I will leave these out. I’ll also be concentrating on pressure based solver, solving at the cell centres, in steady state simulations (laminar & RANS).  

Most CFD uses a finite volume method to discretise the PDEs. The PDEs are integrated, and this puts them in a form that applies to a single mesh cell.
Becomes,
.
The integration over the cell faces (integral with circle through it) comes from the “divergence theorem”. The resulting sums balance flows into and out of the cell (Craft, 2011). The transient term (∂ρφ/∂t V) is defined by the temporal discretisation and equals zero in steady state.
As the flow is actually being solved, the value of the variable at the current cell centre and the cell face, φ and φf, are unknown. Generally, the value in the current cell is expressed in terms of the faces values, and the face values are found from the cell-centred values in surrounding cells. This gives us a linearized set of equations of the form:
The a’s are the ‘linearised coefficients’, subscript p refers to current cell, nb refers to neighbouring cells. An example is included below in Figure 1 for the first order upwind case. The coefficients anb and b will be different for every cell in the domain, at every iteration. The field for φ can be calculated by recalculating iteratively for all of the cells in the domain.
Most of the interpolation schemes focus on how the face value φf can be calculated from the neighbouring cell values. For the first order upwind scheme, face value φf is equal to the upstream cell-centre value.




For the Second order upwind scheme:
In the equation immediately above, φ and nabla φ are found in the upstream cell. “r” is the displacement distance from the upwind cell centre to the cell face. This is the main difference between first and second order upwind methods: instead of assuming the value of φ is constant over the upstream cell, the second order upwind scheme basically uses ‘linear interpolation’ (in a loose sense) of the gradient (nabla φ) in the upstream cell to find the values at the face.
nabla φ itself found through a “least-squares cell-based” method by default in fluent. (in basic terms, a sort of ‘weighted average’ of the surrounding cell values is used to find the gradient in each cell).
The theory guide mentions a “Multi-dimensional linear reconstruction approach”, and references Barth & Jespersen (1989).  I have taken this out on interlibrary loan, but reading the paper hasn’t significantly improved my understanding of the second order upwind scheme. My understanding of what they mean by “multi-dimensional linear reconstruction” is just what has been described – you find the cell-face value using the gradient.
Gradient Limiters:
This isn’t the end of the story because the second order upwind method can create spurious oscillations. The calculated cell face value has to be between the values of the two cells (current cell centre and the upwind cell centre) to prevent spurious oscillations. This is the monotonicity principle and is applied in Fluent through Gradient limiters. These are typically applied as shown (ψ = gradient limiter).
There are three different types in Fluent:
  • Standard limiter
  • Multidimensional limiter
  • Differentiable limiter
Ψ is a factor between 1 and 0, so ψ = 1 is fully 2nd order upwind, ψ = 0 is fully 1st order upwind (φf = φupstream cell). In the standard limiter, ψ is calculated to force φf to be between the min & max of the neighbouring cells*. In the standard limiter a minimum ψ is found in each cell and applied to every face, while the multidimensional limiter applies a different ψ to each face of the cell. Differentiable limiter is more complex & perhaps appropriate for a later blog entry.
References:
Craft, TJ. 2011. Review of Basic Finite volume Methods. (Unpublished) University of Manchester.
Bakker, A. 2002. Applied Computational Fluid Dynamics Lecture 5 – Solution methods. (unpublished) www.bakker.org accessed 20th January 2016.
Barth, TJ. Jespersen, DC. 1989. The design and application of upwind schemes on unstructured meshes. 27th AIAA meeting,
Figure 1 - Example of the discretisation process, for a first order upwind scheme (Bakker, A. 2002)

*by “neighbouring cells” we mean the minimum or maximum of the cell centre values of all the neighbour cells of the upstream cells. This is covered in Barth & Jespersen (1989)

Monday, 18 January 2016

Euler-Lagrange models (DPM)

Below are some eclectic notes on DPM I thought would be worth uploading. The section begins with DPM basics and goes on to discuss stiff DPM type problems. Please excuse the non-standard referencing and abruptness. the bulk of this info is simply re-constituted from the Ansys literature. The 2nd half of the post looks briefly at how heat transfer is modelled for the particles.
Source: http://www3.nd.edu/~gtryggva/CFD-Course2010/2010-Lecture-19.pdf
The most important equation for Euler-Lagrange models is:
The force balance is usually something like this:
Drag + gravity & buoyancy + other forces (lift, added mass, pressure… thermophoresis?)
When the effect of the particles on the fluid is not considered, this is known as one-way coupling. The DPM source terms are not included in the flow calculations, and DPM is applied as a post-processing technique.
When the effect of the particles on the fluid is considered, this is known as two-way coupling. The DPM source terms are included in the flow calculations. In this case, the particles need to be iterated with the flow. The DPM underrelaxation factor defines how many iterations are required for the source terms to take full effect on the flow. This is described by the graph below, you can see the default DPM URF = 0.5 takes about 10 iterations to update the source term, 10 iterations is the default setting for the “number of continuous phase iterations per DPM iteration” in Fluent.
  • Source: ansys fluent lectures – combustion 14.0 – dpm. Best practice for DPM reactive flows
The default URFs are fine for simple cases. For more complex cases default URF can be too aggressive. Effect of URF is highly non-linear. You can increase the number of stochastic tries for turbulence random walk models in order to even out the particle’s effect on the flow. Underrelax the species and energy to start-up the solution (recommends 0.9 for each) then once solution is stable, attempt to increase these to 1.
Source: fluent lectures – combustion 15.0_L4_DPM.
Often the convergence problem is related to high source terms generated in certain cells. Try increasing stochastic tries, and increase the number of gas-phase iterations per DPM iteration. Energy, radiation and ‘mixture fraction’ (species) should have residuals less than e-6.
Node based averaging spreads the load of a DPM source into neighbouring cells. Good for reducing grid dependency, and improving convergence in steady-state sims. “Enable Node-Based Averaging”.
Source term linearization can be combined with node based averaging for simulations without mass transfer. Must be done with caution - see below.
Source: Ansys Fluent lectures – multiphase -15.0 – DPM.
Solution strategies for steady flows in DPM
  1. Closer coupling between the dispersed and continuous flow.
    1. Increase underrelaxation factor for discrete phase
    2. Decrease number of continuous phase calculations between trajectory calculations
    3. Lower the underrelaxation factors for the continuous phase
  2. Decoupling between dispersed and continuous flow.
    1. Lower the underrelaxation factor for discrete phase
    2. Increase number of continuous phase calculations between trajectory calculations
_____________________________________________________________

DPM Switching Laws

When modelling droplet evaporation, it is advised to always inject particles at a temperature a few degrees below their vaporisation temperature in order to improve stability.
When modelling heat transfer in DPM, irrespective of inert, droplet, or multicomponent particles, DPM switching laws are active. an example of switching laws progressing for a combusting particle:, in order of increasing temperature of particle
  1. inert heating law
  2. drying (water removal) - (evap, boil, inert heating)
  3. ...
  4. devolatilisation
  5. combustion
  6. inert heating
Inert heating or cooling: Law one, Law six.
Law one: apply when the particle temperature is less than the defined vaporisation temperature.
Tp < Tvap.
Law six: apply when the volatile fraction fv0 of the particle has been consumed (think this applies to coal combustion models etc). “Equation is saying: activate inert heating when the particle mass has dropped to that of the non-volatiles only”.
The “Inert Heating Law” is a simple single-film equation, with radiation heat transfer added-on.
,h = convective heat transfer coefficient. W/m2. Found by Ranz-Marshall correlation.
Droplet Vaporisation: Law Two
Applies between the vaporisation temperature and boiling pt temperature (or until the volatiles are completely gone).
The “diffusion controlled model” is just a single-film mass transfer law, which assumes the particle Temperature = equilibrium vapour concentration at the particle surface, and that raoult’s law applies in the bulk. Mass transfer resistance is found using the “Sherwood number correlation” which is just the Ranz-Marshall correlation with Heat/Mass Transfer Analogy applied (the one where you just replace dimensionless numbers).
Defining boiling point and latent heat
This is a Hess’s law-style enthalpy balance to extrapolate the latent heat at the boiling down to the vaporisation temperature. This is only active when “temperature dependent latent heat” is selected in the discrete phase model dialogue box.


  • (P-1 or DO, radiation modelling) when Radiation modelling is OFF, therefore the problem can’t be anything to do with radiation terms.
  • “temperature dependent latent heat” is off, therefore the problem can’t be anything to do with hess’s law-style calc.
Enthalpy balance for DPM source: P 494, Ansys theory guide
____________________________________________________
Linearize source terms: this option linearizes DPM source terms for momentum, energy and species w.r.t. cell variable φ. SDPM = Sconst  + Slin φ . Increases numerical stability for steady flows. Transient flows => longer time steps and larger URFs (+ve).

Have to be careful when used in conjunction with average DPM source terms, combining the two for vapourising particles can lead to numerical instabilities and unphysical results for gas temperature.

Saturday, 19 December 2015

First to Higher Order Blending

This is just a quick post on first-to-higher-order blending. First-to-higher-order blending is used when you want something in between a first order upwind and a second order upwind scheme in your simulation. Say you are trying to solve, and you get good convergence in first order, but when you move to second order you have trouble getting a converged solution - you can use first-to-higher-order blending to make this change gradually.

I've written a scheme journal file that'll do this gradual ramp-up. Scheme can be used just like a normal journal file. I've found the main difference between scheme and journal files is that scheme code gives you more options. Here I'm using scheme to do a loop (which to my knowledge isn't possible in an ordinary journal file). I've found that one downside is that scheme is more difficult to cancel & quit halfway through a calculation. It can also be more difficult to write.  

This scheme file slowly ramps up the first-to-higher-order blending value from 0 to 1, linearly over 1000 iterations (0,0.001,0.002,...). It'll then run the full second (or whatever) order sim. for another 1000 iterations. To use it take your first order case file, then change the "solution methods" from first order upwind to the new discretisation you want, then read the scheme file. You'll first need the scheme code saved as a .scm file in the directory. I do this using notepad & recommend it (copy and paste the code, go to save as, type: all files, add .scm to the end of the file name).

;;------------------------------------------------------------------
;;scheme function for ramping-up to second order
;;ramps up over 1000 iterations
;;JRH 18_12_15 cfdyourself.blogspot.co.uk
;;------------------------------------------------------------------
(do ((i 0 (+ i 1)) ) ((> i 999.1));;do loop for 1000 iterations
(define r (/ i 1000))
(ti-menu-load-string (format #f "/solve/set/numerics no yes no no no ~a " r));;
(ti-menu-load-string "/solve/iterate 1 ");;run the simulation for 1 iteration
);;end of the do loop
(ti-menu-load-string "solve/set/numerics no yes no no no 1 ")
(ti-menu-load-string "solve/iterate 1000 ")