# varying cp with temperature .

 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 22, 2011, 07:44 #21 Senior Member     Anton Kidess Join Date: May 2009 Location: Germany Posts: 1,377 Rep Power: 30 It means that you are trying to solve for two variables within one equation.

 February 22, 2011, 07:49 #22 Senior Member   Balkrishna Patankar Join Date: Mar 2009 Location: Pune Posts: 123 Rep Power: 17 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 ?

 July 18, 2013, 05:12 #23 Member   Rohith Join Date: Oct 2012 Location: Germany Posts: 57 Rep Power: 13 Hi BalKrishna Have you found the solution for this problem. How can some body solve 2 variables here. Regards Rohith

 June 16, 2015, 10:10 #24 New Member   Sandip Wadekar Join Date: Oct 2014 Posts: 17 Rep Power: 11 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]); } } }

 June 16, 2015, 10:18 #25 New Member   Sandip Wadekar Join Date: Oct 2014 Posts: 17 Rep Power: 11 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]); } } }

 June 16, 2015, 10:41 #26 Member   Rohith Join Date: Oct 2012 Location: Germany Posts: 57 Rep Power: 13 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

 June 16, 2015, 11:09 #27 New Member   Sandip Wadekar Join Date: Oct 2014 Posts: 17 Rep Power: 11 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);

 June 18, 2015, 03:32 #28 New Member   Sandip Wadekar Join Date: Oct 2014 Posts: 17 Rep Power: 11 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];```

June 30, 2016, 17:32
#29
New Member

elham usefi
Join Date: Apr 2016
Location: tabriz,iran
Posts: 13
Rep Power: 10
Quote:
 Originally Posted by balkrishna 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&, const fvMatrix&) 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
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?

 July 1, 2016, 01:09 #30 Member   Rohith Join Date: Oct 2012 Location: Germany Posts: 57 Rep Power: 13 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

July 3, 2016, 18:12
#31
New Member

elham usefi
Join Date: Apr 2016
Location: tabriz,iran
Posts: 13
Rep Power: 10
Quote:
 Originally Posted by RaghavendraRohith 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! 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

 Tags density, property, specific heat, temperature