CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Describing div terms in fvSchemes (https://www.cfd-online.com/Forums/openfoam-programming-development/85542-describing-div-terms-fvschemes.html)

santiagomarquezd February 28, 2011 21:36

Describing div terms in fvSchemes
 
Hi FOAMers, I have a solver with this code:

Code:

    fvVectorMatrix UEqn
    (
        fvm::ddt(rhom, U)
      + fvm::div(phi, U)
      + fvc::div
        (
            alpha*rhop*Vdrp*Vdrp,
            "div(phiVdrp,Vdrp)"
        )
      - fvm::laplacian(mum, U, "laplacian(mum,U)")
    );

when I run the solver I obtain this error:

Code:

--> FOAM FATAL IO ERROR:
keyword div(phiVdrp,Vdrp) is undefined in dictionary "/home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes"

file: /home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes from line 30 to line 32.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 396.

FOAM exiting

then if I add this:

Code:

divSchemes
{
    div(phi,U)  Gauss upwind; //limitedLinearV 1;
    div(rhop*phi,alpha) Gauss upwind;
    div(phiVdrp,alpha) Gauss upwind;
    div(phiVdrp,Vdrp) Gauss upwind;
}

to my system/fvSchemes dictionary I still get an error, but a different one:

Quote:

--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes::div(phiVdrp,Vdrp) at line 33.

From function ITstream::read(token& t)
in file db/IOstreams/Tstreams/ITstream.C at line 84.

FOAM exiting
Any clues about that?, I've checked some similar threads without success.

Regards.

akidess March 1, 2011 04:57

The divergence schemes in fvSchemes apply to convective terms like fvm::div(phi, X), but your term in the equation seems to be a simple explicit divergence of a scalar field, so why not just write it in the following way?
Code:

fvVectorMatrix UEqn
    (
        fvm::ddt(rhom, U)
      + fvm::div(phi, U)
      + fvc::div
        (
            alpha*rhop*Vdrp*Vdrp
        )
      - fvm::laplacian(mum, U, "laplacian(mum,U)")
    );


santiagomarquezd March 1, 2011 12:06

Anton, I took this notation from settlingFoam, but on the other hand I'd tried you suggested with same results:

Code:

    fvVectorMatrix UEqn
    (
        fvm::ddt(rhom, U)
      + fvm::div(phi, U)
      + fvc::div
        (
            alpha*rhop*Vdrp*Vdrp
        )
      - fvm::laplacian(mum, U, "laplacian(mum,U)")
    );

error obtained at runtime:

Code:

--> FOAM FATAL IO ERROR:
keyword div((((alpha*rhop)*Vdrp)*Vdrp)) is undefined in dictionary "/home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes"

file: /home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes from line 30 to line 32.

    From function dictionary::lookupEntry(const word&, bool, bool) const
    in file db/dictionary/dictionary.C at line 396.

FOAM exiting

adding corresponding line in system/fvSchemes

Quote:

--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/santiago/OpenFOAM/santiago-1.6.x/run/tankBubbles/system/fvSchemes::divSchemes::div((((alpha*rhop)*Vdrp)*Vd rp)) at line 34.

From function ITstream::read(token& t)
in file db/IOstreams/Tstreams/ITstream.C at line 84.

FOAM exiting
Regards.

akidess March 1, 2011 13:03

Ah, you are right, looking at fvcDiv.* it is indeed possible to name even an explicit term and force usage of a certain divergence scheme instead of plainly calling surfaceIntegrate. I'm sorry I don't really have other ideas what could cause the problem. Hopefully someone else will notice this thread and have an answer.

santiagomarquezd March 1, 2011 15:15

Anton, the correct entry in fvSchemes is:

Code:

divSchemes
{
    div(phi,U)  Gauss upwind; //limitedLinearV 1;
    div(phi,alpha) Gauss upwind;
    div(phiVdrp,alpha) Gauss upwind;
  div(phiVdrp,Vdrp) Gauss upwind phiVdrp;
}

it's necessary to explicitly write the flux which will be used in order to interpolate the values at faces. Early alberto shown me the wording to include the flux properly.

Regards.


All times are GMT -4. The time now is 01:21.