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

Where is the velocity flux phi initialised in Openfoam?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By superkelle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 8, 2020, 07:41
Arrow Where is the velocity flux phi initialised in Openfoam?
  #1
New Member
 
hari
Join Date: Jun 2020
Posts: 1
Rep Power: 0
hari154 is on a distinguished road
At very beginning of the simulation, where is phi calculated /initialised?

I am aware that phi is calculated according to,
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
But at the very beginning of the simulation we have to form Ueqn using phi, unfortunately we don't have rUA at the beginning of simulation.

So I am curious to know how phi is initialised?
hari154 is offline   Reply With Quote

Old   June 8, 2020, 08:25
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 616
Rep Power: 16
mAlletto will become famous soon enough
https://www.openfoam.com/documentati...8H_source.html
mAlletto is offline   Reply With Quote

Old   June 10, 2020, 05:26
Post
  #3
Member
 
alexander thierfelder
Join Date: Dec 2019
Posts: 71
Rep Power: 6
superkelle is on a distinguished road
Quote:
Originally Posted by hari154 View Post
At very beginning of the simulation, where is phi calculated /initialised?

I am aware that phi is calculated according to,
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
But at the very beginning of the simulation we have to form Ueqn using phi, unfortunately we don't have rUA at the beginning of simulation.

So I am curious to know how phi is initialised?

I think this question occures very often and has been answered several times. Just use the search function. Never the less I give you some additional advice, look into createField files of the solver source code for example in icoFoam: /applications/solvers/incompressible/icoFoam


Code:
Info<< "Reading field U\n" << endl;
volVectorField U
(
    IOobject
    (
        "U",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ,
        IOobject::AUTO_WRITE
    ),
    mesh
);


#include "createPhi.H"
Then search for this file, it is located in a different location. For simplicity just use the search in your OF directory. You will find createFields.H for example in /src/finiteVolume/cfdTools/incompressible , that have following code:



Code:

Global
    createPhi

Description
    Creates and initialises the relative face-flux field phi.

\*---------------------------------------------------------------------------*/

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "Reading/calculating face flux field phi\n" << endl;

surfaceScalarField phi
(
    IOobject
    (
        "phi",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::AUTO_WRITE
    ),
    fvc::flux(U)
);


// ************************************************************************* //
You will also find some additional "links" that are also called createFields.H but don't mind that ( for example in /src/finiteVolume/lnInclude ).



On the other hand there are also solvers that have no:

Code:
#include "createPhi.H"
like potentialFoam, there it is "hard coded" into createFields. Do not ask me why.



Code:
U = dimensionedVector(U.dimensions(), Zero);

surfaceScalarField phi
(
    IOobject
    (
        "phi",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::AUTO_WRITE
    ),
    fvc::flux(U)
);
What I does not know myself is whether there is a difference in the ways to write the flux:


Code:
fvc::flux(U)
vs.
Code:
phi = (fvc::interpolate(U) & mesh.Sf())
Maybe someone else could bring light into this dark. I suspect that there is maybe the same math involved but, with some additional conditions/restrictions for the fvc::flux() function, since the second version is very strait forward.


I have also seen versions where the "fvc::" is not put in front like in "createPhiv.H" . I also don't know why that is.(and where/what phiv is used for)

Code:
surfaceScalarField phiv
(
    IOobject
    (
        "phiv",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::AUTO_WRITE
    ),
    flux(U)
);
lpz456 likes this.
superkelle is offline   Reply With Quote

Reply

Tags
icofoam, rheofoam


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM course for beginners Jibran OpenFOAM Announcements from Other Sources 2 November 4, 2019 09:51
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 07:15
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin cfd.direct OpenFOAM Announcements from Other Sources 0 September 21, 2016 12:50
pressure and velocity in OpenFoam is smaller than Fluent mechy OpenFOAM 4 September 18, 2013 17:19
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 10:11


All times are GMT -4. The time now is 02:40.