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/)
-   -   overloaded function type in div (https://www.cfd-online.com/Forums/openfoam-programming-development/119341-overloaded-function-type-div.html)

shash June 15, 2013 04:45

overloaded function type in div
 
hi foamers,

I am a newbie to openfoam, i am trying to implement a species transfer eq. on interfoam solver but i am getting errors while compiling my solver:

Quote:

cEqn.H:23:104: error: no matching function for call to ‘div(Foam::surfaceScalarField&, Foam::volScalarField&, <unresolved overloaded function type>)’
cEqn.H:23:104: note: candidates are:
/home/shash/OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/lnInclude/fvmDiv.C:45:1: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
snippet from cEqn.H

surfaceScalarField cPhi=
(
fvc::interpolate((D1 - D2/He)/(alpha1 +(1-alpha1)/He))*fvc::snGrad(alpha1)
)*mesh.magSf();

surfaceScalarField DPhi=
(
fvc::snGrad(Di)
)*mesh.magSf();

fvScalarMatrix Eqn
(
fvm::ddt(C) +fvm::div(phi,C) -fvm::laplacian(fvc::interpolate(Di),C) -fvm::div(DPhi,C,Foam::fvc::scheme) +fvm::div(cPhi,C,Foam::fvc::scheme)
);
Eqn.solve();

shash June 16, 2013 16:04

Can someone plz reply to my query, i m stuck :confused:

wyldckat June 16, 2013 16:23

Greetings shash,

I think the problem is this part of the code:
Code:

fvm::div(DPhi,C,Foam::fvc::scheme) +fvm::div(cPhi,C,Foam::fvc::scheme)
"Foam::fvc::scheme" doesn't make much sense... and I have not seen this in the solvers of OpenFOAM.

Best regards,
Bruno

shash June 16, 2013 16:28

Hi bruno,

Thanks for the reply, ya you are correct , this part of the code is giving me lots of problems.
first i tried fvm::div(DPhi,C,scheme) but it didn't work so i modified to fvm::div(DPhi,C,Foam::fvc::scheme) , Can you please suggest what modification should i make .

:D

wyldckat June 16, 2013 16:30

Why aren't you simply using:
Code:

fvm::div(DPhi,C)
:confused:

The scheme is meant to be configured in the case folder, namely in file "system/fvSchemes"!

shash June 16, 2013 16:40

hi bruno I tried that , thou i was able to successfully compile my solver but when i ran my case i got following errors and i assumed probably its b'coz i haven't specified the third parameter.
Quote:

Starting time loop

Courant Number mean: 0 max: 0
Interface Courant Number mean: 0 max: 0
deltaT = 0.00119047619
Time = 0.00119048

MULES: Solving for alpha1
Phase-1 volume fraction = 0 Min(alpha1) = 0 Max(alpha1) = 0
MULES: Solving for alpha1
Phase-1 volume fraction = 0 Min(alpha1) = 0 Max(alpha1) = 0


--> FOAM FATAL IO ERROR:
keyword div(((interpolate(((rho-(rho|rho))|(alpha1+((1-alpha1)|rho))))*snGrad(alpha1))*magSf),C) is undefined in dictionary "/home/shash/OpenFOAM/shash-2.1.1/run/arbit/abhijit-case/damBreak/system/fvSchemes::divSchemes"

file: /home/shash/OpenFOAM/shash-2.1.1/run/arbit/abhijit-case/damBreak/system/fvSchemes::divSchemes from line 30 to line 33.

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

FOAM exiting

wyldckat June 17, 2013 16:52

Hi shash,

:confused: But the message says it all!
All you need to do is to edit the file "system/fvSchemes" inside your case folder and find the group "divSchemes" and add this entry or similar:
Code:

div(((interpolate(((rho-(rho|rho))|(alpha1+((1-alpha1)|rho))))*snGrad(alpha1))*magSf),C) Gauss linear;
For example, if you look at this file for the tutorial "multiphase/interFoam/ras/damBreak", you'll see this:
Code:

divSchemes
{
    div(rho*phi,U) Gauss linear;
    div(phi,alpha) Gauss vanLeer;
    div(phirb,alpha) Gauss interfaceCompression;
    div(phi,k) Gauss upwind;
    div(phi,epsilon) Gauss upwind;
    div(phi,R) Gauss upwind;
    div(R) Gauss linear;
    div(phi,nuTilda) Gauss upwind;
    div((muEff*dev(T(grad(U))))) Gauss linear;
}

So you simply add the line the solver is asking for:
Code:

divSchemes
{
    div(rho*phi,U) Gauss linear;
    div(phi,alpha) Gauss vanLeer;
    div(phirb,alpha) Gauss interfaceCompression;
    div(phi,k) Gauss upwind;
    div(phi,epsilon) Gauss upwind;
    div(phi,R) Gauss upwind;
    div(R) Gauss linear;
    div(phi,nuTilda) Gauss upwind;
    div((muEff*dev(T(grad(U))))) Gauss linear;
    div(((interpolate(((rho-(rho|rho))|(alpha1+((1-alpha1)|rho))))*snGrad(alpha1))*magSf),C) Gauss linear;
}

Best regards,
Bruno

shash June 18, 2013 12:21

Hi bruno,

Thanks a very lot it works, I suppose i misinterpreted the errors that were displayed :D


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