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/)
-   -   Compiling Error - Need help with C++ (https://www.cfd-online.com/Forums/openfoam-programming-development/104356-compiling-error-need-help-c.html)

SiCaRiUs July 8, 2012 06:38

Compiling Error - Need help with C++
 
Hi all,

i just need your help in putting an Equation to C++.

The following Code works fine:

Code:

{
    kappat = turbulence->nut()/Prt;
    kappat.correctBoundaryConditions();

    volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat);

    fvScalarMatrix TEqn
    (
        fvm::div(phi, T)
      - fvm::Sp(fvc::div(phi), T)
      - fvm::laplacian(kappaEff, T)
      - ((U & fvc::grad(p)) / Cp)
      - (((turbulence->nuEff() / Cp) * (fvc::grad(U) + fvc::grad(U)().T())) && fvc::grad(U))
    );

    TEqn.relax();
    TEqn.solve();

    rhok = 1.0 - beta*(T - TRef);
}

But when i want to enhance the equation with one more term, it doesn't work anymore.
Here is the part of the equation i want to put into c++:

http://sicarius.serverteil.de/vh_term.jpg

This is my try in the code:

Code:

{
    kappat = turbulence->nut()/Prt;
    kappat.correctBoundaryConditions();

    volScalarField kappaEff("kappaEff", turbulence->nu()/Pr + kappat);

    fvScalarMatrix TEqn
    (
        fvm::div(phi, T)
      - fvm::Sp(fvc::div(phi), T)
      - fvm::laplacian(kappaEff, T)
      - ((U & fvc::grad(p)) / Cp) 
      - (((turbulence->nuEff() / Cp) * (fvc::grad(U) + fvc::grad(U)().T() - (2.0/3.0 * fvm::div(U)))) && fvc::grad(U))
    );

    TEqn.relax();
    TEqn.solve();

    rhok = 1.0 - beta*(T - TRef);
}

But i got the following compiling error:

Quote:

Making dependency list for source file buoyantBoussinesqSimpleFoamVH211_erw.C
SOURCE=buoyantBoussinesqSimpleFoamVH211_erw.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/finiteVolume/lnInclude -I/opt/openfoam211/src/turbulenceModels -I/opt/openfoam211/src/turbulenceModels/incompressible/RAS/lnInclude -I/opt/openfoam211/src/transportModels -I/opt/openfoam211/src/transportModels/incompressible/singlePhaseTransportModel -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/buoyantBoussinesqSimpleFoamVH211_erw.o
In file included from buoyantBoussinesqSimpleFoamVH211_erw.C:77:0:
TEqn.H: In Funktion »int main(int, char**)«:
TEqn.H:13:98: Fehler: keine passende Funktion für Aufruf von »div(Foam::volVectorField&)«
TEqn.H:13:98: Anmerkung: Kandidaten sind:
/opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:45:1: Anmerkung: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:62:1: Anmerkung: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:77:1: Anmerkung: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvmDiv.C:88:1: Anmerkung: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::fvm::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
make: *** [Make/linux64GccDPOpt/buoyantBoussinesqSimpleFoamVH211_erw.o] Fehler 1
I hope you can help me!
Thanks a lot!

Greetings
Sebastian

SiCaRiUs July 8, 2012 10:22

Ok. I think i've got it. Just multiplicated the red term with the identity tensor. Now it works.


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