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

Description of flux() method

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

Like Tree11Likes
  • 11 Post By fumiya

Reply
 
LinkBack Thread Tools Display Modes
Old   March 20, 2013, 05:19
Default Explanation of flux() method
  #1
Senior Member
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 217
Blog Entries: 1
Rep Power: 11
fumiya is on a distinguished road
I try to describe the role of flux() method and how it achieves it's role in OpenFOAM.
This topic is difficult for me to comprehend, so I'm grad if the following explanations could be of some help
  • Role of flux() method
    To construct the conservative face flux
  • How to achieve this
    If we discretize the pressure poisson equation(e.g., pEqn in simpleFoam), we can get

    \sum_{f} \left \{\left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f} \right \}=\sum_{f}\left ( \frac{H}{A_{P}} \right )_{f}\cdot \mathbf{S}_{f} ---(1)

    where \mathbf{S}_{f} = \mathbf{\Delta } + \mathbf{k}(See the attached picture).

    The second term of the l.h.s of the eqn. (1) is the explicit non-orthogonal correction term
    (source term) and the first term is the implicit orthogonal part(matrix coefficients).
    If we arrange the above equation using OpenFOAM notation(v2.2), we get

    \sum_{f} \left \{ \mathrm{phiHbyA} -\left ( \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f}  \right ) \right \}=0 ---(2)

    Then we can construct the conservative face flux phi by

    \mathrm{phi} = \mathrm{phiHbyA} - \left ( \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f}  \right ) ---(3)

    In the eqn. (3), the pEqn.flux() calculates

    \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f} ---(4)

    ,so we can get the conservative face flux using the following code

    Code:
    if (simple.finalNonOrthogonalIter())
    {
        phi = phiHbyA - pEqn.flux();
    }
  • Where is flux() function implemented?
    As you can see in the eqn. (4), the flux() is the sum of
    • 1st term
      the off-diagonal coefficients of the pressure poisson equation multiplied by pressure values at cell centers

      in fvMatrix.C
      Code:
      00895     for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
      00896     {
      00897         fieldFlux.internalField().replace
      00898         (
      00899             cmpt,
      00900             lduMatrix::faceH(psi_.internalField().component(cmpt))
      00901         );
      00902     }
      and lduMatrix::faceH is implemented in lduMatrixTemplates.C
      Code:
      00092         for (register label face=0; face<l.size(); face++)
      00093         {
      00094             faceHpsi[face] =
      00095                 Upper[face]*psi[u[face]]
      00096               - Lower[face]*psi[l[face]];
      00097         }
    • 2nd term
      the non orthogonality explicit corrections

      in fvMatrix.C
      Code:
      00937     if (faceFluxCorrectionPtr_)
      00938     {
      00939         fieldFlux += *faceFluxCorrectionPtr_;
      00940     }

Please correct the mistakes, if any.

Best regards,
Fumiya
Attached Images
File Type: png over-relaxed.png (5.5 KB, 136 views)

Last edited by fumiya; March 21, 2013 at 11:09.
fumiya is offline   Reply With Quote

Old   August 25, 2013, 23:40
Default
  #2
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 754
Rep Power: 10
sharonyue is on a distinguished road
Quote:
Originally Posted by fumiya View Post
I try to describe the role of flux() method and how it achieves it's role in OpenFOAM.
This topic is difficult for me to comprehend, so I'm grad if the following explanations could be of some help

..........................

Best regards,
Fumiya
Excellent!!Fumiya now Its a bit clear regarding the p.Eqn.flux().

BTW, do you think
Code:
fvScalarMatrix pEqn
            (
                fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
            );

fvScalarMatrix pEqn
            (
                fvm::div(A*fvc::grad(p)) == fvc::div(phiHbyA)
            );
is the same?
sharonyue is offline   Reply With Quote

Old   December 21, 2016, 11:39
Default
  #3
New Member
 
longyun wang
Join Date: Dec 2016
Posts: 6
Rep Power: 2
longyun000 is on a distinguished road
Quote:
Originally Posted by fumiya View Post
I try to describe the role of flux() method and how it achieves it's role in OpenFOAM.
This topic is difficult for me to comprehend, so I'm grad if the following explanations could be of some help
  • Role of flux() method
    To construct the conservative face flux
  • How to achieve this
    If we discretize the pressure poisson equation(e.g., pEqn in simpleFoam), we can get

    \sum_{f} \left \{\left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f} \right \}=\sum_{f}\left ( \frac{H}{A_{P}} \right )_{f}\cdot \mathbf{S}_{f} ---(1)

    where \mathbf{S}_{f} = \mathbf{\Delta } + \mathbf{k}(See the attached picture).

    The second term of the l.h.s of the eqn. (1) is the explicit non-orthogonal correction term
    (source term) and the first term is the implicit orthogonal part(matrix coefficients).
    If we arrange the above equation using OpenFOAM notation(v2.2), we get

    \sum_{f} \left \{ \mathrm{phiHbyA} -\left ( \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f}  \right ) \right \}=0 ---(2)

    Then we can construct the conservative face flux phi by

    \mathrm{phi} = \mathrm{phiHbyA} - \left ( \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f}  \right ) ---(3)

    In the eqn. (3), the pEqn.flux() calculates

    \left ( \frac{1}{A_{P}} \right )_{f}\left | \mathbf{\Delta }  \right |\frac{p_{N}-p_{P}}{\left | \mathbf{d} \right |}  +\left ( \frac{1}{A_{P}} \right )_{f}\mathbf{k}\cdot \left ( \triangledown p \right )_{f} ---(4)

    ,so we can get the conservative face flux using the following code

    Code:
    if (simple.finalNonOrthogonalIter())
    {
        phi = phiHbyA - pEqn.flux();
    }
  • Where is flux() function implemented?
    As you can see in the eqn. (4), the flux() is the sum of
    • 1st term
      the off-diagonal coefficients of the pressure poisson equation multiplied by pressure values at cell centers

      in fvMatrix.C
      Code:
      00895     for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
      00896     {
      00897         fieldFlux.internalField().replace
      00898         (
      00899             cmpt,
      00900             lduMatrix::faceH(psi_.internalField().component(cmpt))
      00901         );
      00902     }
      and lduMatrix::faceH is implemented in lduMatrixTemplates.C
      Code:
      00092         for (register label face=0; face<l.size(); face++)
      00093         {
      00094             faceHpsi[face] =
      00095                 Upper[face]*psi[u[face]]
      00096               - Lower[face]*psi[l[face]];
      00097         }
    • 2nd term
      the non orthogonality explicit corrections

      in fvMatrix.C
      Code:
      00937     if (faceFluxCorrectionPtr_)
      00938     {
      00939         fieldFlux += *faceFluxCorrectionPtr_;
      00940     }

Please correct the mistakes, if any.

Best regards,
Fumiya
hi,
I am studing icofoam now, and I found the code:
[/CODE]
77 surfaceScalarField phiHbyA
78 (
79 "phiHbyA",
80 fvc::flux(HbyA)
81 + fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
82 );
[/CODE]

I can't understand why there is an item "fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)"? According to the equation above, there should be only the first item.
longyun000 is offline   Reply With Quote

Old   December 24, 2016, 13:40
Default
  #4
Senior Member
 
Fumiya Nozaki
Join Date: Jun 2010
Location: Yokohama, Japan
Posts: 217
Blog Entries: 1
Rep Power: 11
fumiya is on a distinguished road
Hi,

The term "ddtCorr" is considered in the transient solvers.
The following references could be of some help:

Best regards,
Fumiya
__________________
fumiya is offline   Reply With Quote

Old   April 3, 2017, 20:36
Default
  #5
New Member
 
yuancong
Join Date: Sep 2016
Posts: 2
Rep Power: 0
yuan_neu is on a distinguished road
Quote:
Originally Posted by sharonyue View Post
Excellent!!Fumiya now Its a bit clear regarding the p.Eqn.flux().

BTW, do you think
Code:
fvScalarMatrix pEqn
            (
                fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
            );

fvScalarMatrix pEqn
            (
                fvm::div(A*fvc::grad(p)) == fvc::div(phiHbyA)
            );
is the same?
i do not think so. fvc::grad(p) returns a volscalarfield. so the second pEqn is actually based on grad(p).
yuan_neu 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
Sign of Heat Flux at wall Kyung FLUENT 2 February 26, 2016 17:25
Comparison: Finite Volume Method vs. Analytic Method m-fry Main CFD Forum 1 April 20, 2010 14:40
About the Flux splitting method maximus Main CFD Forum 0 February 24, 2006 01:05
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09
total mass flux correction for compressible fluid? Francesco Di Maio Main CFD Forum 0 August 21, 2000 04:23


All times are GMT -4. The time now is 08:04.