CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

A few questions about LES filtering in OpenFOAM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 1, 2016, 05:17
Default A few questions about LES filtering in OpenFOAM
  #1
New Member
 
章严
Join Date: May 2014
Posts: 21
Rep Power: 4
zhangyan is on a distinguished road
Hello,
In the OpenFOAM source codes,I found "laplace Filter" in the source codes, so I guessed the dynLagrangian must be used accompany with "laplace Filter".

Actually, I am going to implement the dynamic K-E or dynLagrangian SGS model to another software. But I don't know how to implement the "simple Filter".

It seems that implementing laplace Filter is more easier. Could you tell me does the SGS models must be used accompany with particular Filters? For example, dynamicKEqn + simple filter; dynamicLagrangian + laplace Filter.

Another question: If you understand the meaning of "simple Filter", Could you tell me the physical meaning of it?

Please forgive my poor English.

simple Filter:

tmp<volScalarField> filteredField = fvc::surfaceSum
(
mesh().magSf()*fvc::interpolate(unFilteredField)
)/fvc::surfaceSum(mesh().magSf())

laplace Filter:

tmp<volTensorField> filteredField =
unFilteredField() + fvc::laplacian(coeff_, unFilteredField())


Thanks,
Zhang Yan

[ Moderator note - Moved from here: What LES should do for you? ]

Last edited by wyldckat; May 1, 2016 at 15:01. Reason: see "Moderator note"
zhangyan is offline   Reply With Quote

Old   May 4, 2016, 09:50
Default
  #2
Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 33
Rep Power: 3
usv001 is on a distinguished road
Hi Zhang Yan,

I am trying to figure out LES implementation in OpenFOAM myself but I'll still try to give an answer. Please correct me if I am wrong.

simpleFilter
If you look at the code, you will see that the unFilteredField is first interpolated from the cell centers to the cell faces using 'fvc::interpolate'. Then, the filteredField is simply the area-weighted average of the interpolated values using 'fvc::surfaceSum'.

laplaceFilter
I am not so sure about this but I'll try. I'm borrowing some ideas from image processing since that's all the relevant information that I could find on Laplace filters.

Let's say you have a random signal, u which has high frequency noise that you wish to filter/smooth. We can derive the finite difference Laplace operator for the signal as:
\nabla^2 u = \frac{u_{i-1} - 2u_i + u_{i+1}}{\Delta^2}
According to the code, the Laplacian is first multiplied by 'coeff_' which is proportional to V^{2/3} and, hence, has the dimensions of \Delta^2. This result is then added to the unFilteredField. Let's try to do that by letting the proportionality parameter 'widthCoeff_' as 4:
\tilde{u_i} = u_i +\frac{ \Delta^2}{4}  \left(  \frac{u_{i-1} - 2u_i + u_{i+1}}{\Delta^2} \right)  = \frac{u_{i-1} + 2u_i + u_{i+1}}{4}
As it can be seen, the result is an average over the adjacent cells.

Conclusion
I think filtering operation can be viewed as smoothing or averaging operation. I would love to know if I am getting any of this wrong. Also, I am not too sure as to the role of 'widthCoeff_' and would like to know more as well.

As to which filter to use with which dynamic SGS model, I think it does not really matter. Any filter should be fine as long as you define the relevant '<LESFilter>Coeffs'. However, according to this, the laplace filter is not generally used. Not too sure why.

Anyway, hope this helps you.
usv001 is offline   Reply With Quote

Old   May 4, 2016, 10:11
Default
  #3
New Member
 
章严
Join Date: May 2014
Posts: 21
Rep Power: 4
zhangyan is on a distinguished road
Thank you very much!
Since it's too late today (in my country), I will study your admirable answer carefully tomorrow.
zhangyan is offline   Reply With Quote

Old   May 7, 2016, 02:53
Default
  #4
New Member
 
章严
Join Date: May 2014
Posts: 21
Rep Power: 4
zhangyan is on a distinguished road
Quote:
Originally Posted by usv001 View Post
Hi Zhang Yan,

I am trying to figure out LES implementation in OpenFOAM myself but I'll still try to give an answer. Please correct me if I am wrong.

simpleFilter
If you look at the code, you will see that the unFilteredField is first interpolated from the cell centers to the cell faces using 'fvc::interpolate'. Then, the filteredField is simply the area-weighted average of the interpolated values using 'fvc::surfaceSum'.

laplaceFilter
I am not so sure about this but I'll try. I'm borrowing some ideas from image processing since that's all the relevant information that I could find on Laplace filters.

Let's say you have a random signal, u which has high frequency noise that you wish to filter/smooth. We can derive the finite difference Laplace operator for the signal as:
\nabla^2 u = \frac{u_{i-1} - 2u_i + u_{i+1}}{\Delta^2}
According to the code, the Laplacian is first multiplied by 'coeff_' which is proportional to V^{2/3} and, hence, has the dimensions of \Delta^2. This result is then added to the unFilteredField. Let's try to do that by letting the proportionality parameter 'widthCoeff_' as 4:
\tilde{u_i} = u_i +\frac{ \Delta^2}{4}  \left(  \frac{u_{i-1} - 2u_i + u_{i+1}}{\Delta^2} \right)  = \frac{u_{i-1} + 2u_i + u_{i+1}}{4}
As it can be seen, the result is an average over the adjacent cells.

Conclusion
I think filtering operation can be viewed as smoothing or averaging operation. I would love to know if I am getting any of this wrong. Also, I am not too sure as to the role of 'widthCoeff_' and would like to know more as well.

As to which filter to use with which dynamic SGS model, I think it does not really matter. Any filter should be fine as long as you define the relevant '<LESFilter>Coeffs'. However, according to this, the laplace filter is not generally used. Not too sure why.

Anyway, hope this helps you.


Hi,
According to your reply, I got my answer about simple filter:
filteredField = sum(A_i * S_i) / sum(S_i)
A_i is face value after interpolate, S_i is face area.
Is it right?

Besides, I have another question:
If I use simple filter as the test filter for a dynamic SGS model,
as a test filter, how does simple filter show the double width compared to the first filter?

Last edited by zhangyan; May 7, 2016 at 06:51.
zhangyan is offline   Reply With Quote

Old   May 8, 2016, 09:34
Default
  #5
Member
 
Join Date: Sep 2015
Location: Singapore
Posts: 33
Rep Power: 3
usv001 is on a distinguished road
Hi there,

Yup, I have the same idea of the simple filter.

I am reading up on filtering myself (I am new to LES/OpenFOAM as well) but here is what I think is happening:

The filtering of the original LES equations is implicit in OpenFOAM, i.e. the finite volume method (grid+discretization) itself acts as a filter! This is known as implicit LES. So, when you apply any dynamic model, it performs a further filtering process, the test filter.

The factor of two does appear in the code. For example, for the 'homogeneousDynSmagorinsky' model:

Code:
const volSymmTensorField MM
    (
        sqr(delta())*(filter_(mag(D)*(D)) - 4*mag(filter_(D))*filter_(D))
    );
Notice the factor '4'. That is the result of...
MM_{ij} = \Delta^2 \left[ \widetilde{D_{ij}\sqrt{D_{ij} D_{ij}}} - \frac{\Delta_t^2}{\Delta^2} \widetilde{D_{ij}}{\sqrt{\widetilde{D_{ij}} \widetilde{D_{ij}}}} \right] where {\Delta_t}/{\Delta} = 2.

Hope this helps.

Last edited by usv001; May 8, 2016 at 09:37. Reason: Error in formula
usv001 is offline   Reply With Quote

Old   May 8, 2016, 10:05
Default
  #6
New Member
 
章严
Join Date: May 2014
Posts: 21
Rep Power: 4
zhangyan is on a distinguished road
Thanks for your explanation!
Now I am implementing dynamic procedure to KIVA (the software I'm using).
In KIVA, velocity is stored on the vertices.
So one of the face(bottom) value is : 0.25(u1+u2+u3+u4).
Code:
     7/--------/|6
     /        / |
    / |      /  |
   /        /   |
 8/--------/5   |
  |   |    |    |
  |        |    |
  |  3|-  -| -  |2
  |   /    |   /
  |        |  /
  | /      | /
  |        |/
 4----------1
However, when I am calculate the filter_Sij.
You know, I must interpolate Sij to the cell faces.
For example, S11=dudx, in KIVA, dudx=0.25*(u3+u4+u7+u8-u1-u2-u5-u6)/delta_X

I know velocity is stored on the vertice, but I don't know where Sij is stored.
So I don't know how to interpolate Sij to the cell faces.
Do you have any idea?
zhangyan is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
LES filter in OpenFOAM openfoammaofnepo OpenFOAM Programming & Development 1 October 23, 2014 07:27
implicit and explicit filtering in LES kkpal OpenFOAM 0 February 19, 2014 03:27
Molecular viscosity calculation in LES on OpenFOAM babakflame OpenFOAM 0 January 26, 2014 05:13
Frequently Asked Questions about Installing OpenFOAM wyldckat OpenFOAM Installation 0 January 1, 2014 20:21
Serious bug in LES interface fs82 OpenFOAM Bugs 21 November 16, 2009 09:15


All times are GMT -4. The time now is 05:15.