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/)
-   -   varying cp with temperature . (https://www.cfd-online.com/Forums/openfoam-programming-development/84704-varying-cp-temperature.html)

akidess February 22, 2011 07:44

It means that you are trying to solve for two variables within one equation.

balkrishna February 22, 2011 07:49

Thanks. That is clear . However a formulation like below ,
Code:

fvScalarMatrix hEqn
    (
        fvm::ddt(rho, h)
      + fvm::div(phi, h)
      - fvm::laplacian(turbulence->alphaEff(), h)
    ==
        DpDt
    );

assumes constant k . How does one program without the constant k assumption ?

RaghavendraRohith July 18, 2013 05:12

Hi BalKrishna

Have you found the solution for this problem. How can some body solve 2 variables here.

Regards
Rohith

wadekar June 16, 2015 10:10

Dear sir,
I am getting the error after using Foam::tanh(...)

The error is: call of overloaded ‘tanh(const int&)’ is ambiguous
c[ignCell] =1-Foam::tanh(ignSite.cells()[icelli]);

The code is:

forAll(ign.sites(), i)
{
const ignitionSite& ignSite = ign.sites()[i];

if (ignSite.igniting())
{
forAll(ignSite.cells(), icelli)
{
label ignCell = ignSite.cells()[icelli];

c[ignCell] =1-Foam::tanh(ignSite.cells()[icelli]);
}
}
}

wadekar June 16, 2015 10:18

Dear sir,
I am getting the error after using Foam::tanh(...)

The error is: call of overloaded ‘tanh(const int&)’ is ambiguous
c[ignCell] =1-Foam::tanh(ignSite.cells()[icelli]);

The code is:

forAll(ign.sites(), i)
{
const ignitionSite& ignSite = ign.sites()[i];

if (ignSite.igniting())
{
forAll(ignSite.cells(), icelli)
{
label ignCell = ignSite.cells()[icelli];

c[ignCell] =1-Foam::tanh(ignSite.cells()[icelli]);
}
}
}

RaghavendraRohith June 16, 2015 10:41

Hi Sandip,

I hope tanh in openfoam takes only a value i.e if you define a dimensionedScalar then please define its value. See that there exists no Fields. I See Ignsites is a constant, i am not sure. If you can define it so.

Best Regards,
Rohith

wadekar June 16, 2015 11:09

Thanks Raghavendra

I have tried with the interger value 5,
but still i am getting the same error:

call of overloaded ‘tanh(int)’ is ambiguous
c[ignCell] =Foam::tanh(5);

wadekar June 18, 2015 03:32

Hello friends,
I am compile the below mention code and i am getting the error

error: ‘distance’ was not declared in this scope
c = Foam::tanh[distance];

Code:


pointField meshPoints(mesh.points());
      label i(0);
     
      forAll( meshPoints, kk)
      { 
        vector curPoint = meshPoints[kk];
        vector distance = curPoint - vector(0, 0, 0);
   
        i++;
    scalar dis = mag(distance);   
        Info<< "distance = " << dis << endl;
 
      }
      Info << i << "  Points are changed" << endl;
     
    volScalarField  c = Foam::tanh[distance];


elham usefi June 30, 2016 17:32

Quote:

Originally Posted by balkrishna (Post 296408)
When i rewrite the enthalpy equation as :
Code:

fvScalarMatrix hEqn
          (
          fvm::ddt(rho, h)
          + fvm::div(phi, h)
          ==
            fvm::laplacian(k,T)
          + DpDt + heatSource
          );
//In the above , k is thermal conductivity , T is temperature , h is enthalpy .

I get the following error :
Code:

incompatible fields for operation
    [h] == [T]

    From function checkMethod(const fvMatrix<Type>&, const fvMatrix<Type>&)
    in file /home/ifmg/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/fvMatrix.C at line 1181.

How to overcome it ?


Hi i knw this post is old but i need help on this problem :D
in my case Cp varies in different locations, so I need to write energy equation with enthalpy. I wrote it like this:
Code:

  fvScalarMatrix EEqn
    (
        fvm::div(phi, E)
      - fvm::laplacian(k_n/cp, E)
    ==
        fvOptions(rho,E)
    );

    EEqn.relax();

    fvOptions.constrain(EEqn);

    EEqn.solve();

    fvOptions.correct(E);
    T=E/cp;
    rhok = (1.0 - beta*(T - TRef));

but I got unrealistic solution that diverges!
can u help me?:confused:

RaghavendraRohith July 1, 2016 01:09

Hi,

The only error i see is that you have defined enthalpy as E=cp*T But it is
deltaE = cp*deltaT.

Hope it helps

Regards,
Rohith

elham usefi July 3, 2016 18:12

Quote:

Originally Posted by RaghavendraRohith (Post 607515)
Hi,

The only error i see is that you have defined enthalpy as E=cp*T But it is
deltaE = cp*deltaT.

Hope it helps

Regards,
Rohith

HI!
thank u for ur response:) but I didnt get it!:confused: if we replace E with cp*T in
Code:

    (
        fvm::div(phi, E)
      - fvm::laplacian(k_n/cp, E)
    ==
        fvOptions(rho,E)
    );

the result would be like:
Code:

    (
        fvm::div(phiCp, T)
      - fvm::laplacian(k_n, T)
    ==
        fvOptions(rhoCp,T)
    );

so isnt EEqn correct?

actually first I tried TEqn like this:
Code:

    (
        fvm::div(phiCp, T)
      - fvm::laplacian(k_n, T)
    ==
        fvOptions(rhoCp,T)
    );

but I didnt get correct results!
but when I assume that cp is constant! like this:
Code:

    (
        cp*fvm::div(phi, T)
      - fvm::laplacian(k_n, T)
    ==
        fvOptions(rhoCp,T)
    );

I get good results! although the variation of cp is not very significant!
so I tried EEqn :D


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