varying cp with temperature .
In the buoyantBousinessqSimpleFoam solver i want to vary my Cp with temperature . How should i write the program for this ?

As a start , lets say i want to vary Cp in the following manner :
Cp = C*tanh(mT) ; I write the program in the following manner : Code:
Info<<" Reading field Cp "<<endl ; Code:
dimensionedScalar m (laminarTransport.lookup("m")); In TEqn.H i have the added a source term . and hence need Cp . I add it in the following manner . Code:
Cp = C*tanh(mT); Code:
> FOAM FATAL ERROR: 
i think, this is something to do with dimensional consistency for LHS and RHS. From the error message it may said that the term "C*tanh(mT)" should have the units of cp.
An alternative way is use JANAF tables. 
1) you can use thermodynamic table which is implemented in open foam
2) but whats the dimension of c and cp, does they have the same dimensions? if yes, try it forAll (C,celli) {cp[celli]=c[celli]*tanh(m*T[celli]) } or define m as dimless and use T.value() to get just the value of it 
@chandramurthy : C has the dimensions of Cp and m*T is dimensionless. .... m has dimensions of [ 0 0 0 1 0 0 0 ] while T has that of [0 0 0 1 0 0 0].... The error says that m*T is not dimensionless .... which is not very clear to me ...

@nimasam : C and Cp have the same dimensions . regarding the loop you have suggested when i declare C and Cp as volScalarFields and simply do Cp = C*tanh(m*T) shouldnt it be executed on all cells ?

u are right, every thing seems correct! but those two suggested methods were to insure that variable are dimensionless

@nimasam I get the following error for the first one :
error: ‘struct Foam::volScalarField’ has no member named ‘value’ for the second one : error: cannot convert ‘Foam::dimensioned<double>’ to ‘double’ in assignment 
Hi,
value() is a method for scalars, not for volScalarFields. You have to loop over cells to use it. Did you check mT is actually dimensionless (you did not say how you define it in the code). Best, 
@alberto i define m in transportProperties in the following manner :
Code:
m m [0 0 0 1 0 0 0] 0.2; as Code:
dimensionedScalar m (laminarTransport.lookup("m")); Code:
error: cannot convert ‘Foam::dimensioned<double>’ to ‘double’ in assignment 
Use
m.value() However it should really work with fields without looping. Best, 
about janafthermo
Quote:
i am very new to openfoam, is it possible to use janafthermo.H while using the interfoam solver?? basically i want to vary Cp and density with temperature and pressure in a 2 phase incompressible vof problem. Please help me out in this matter. regards, karthik 
that gives the following error :
Code:
error: call of overloaded ‘tanh(double)’ is ambiguous 
problem solved . Thanks everyone . I was including the variation in a header file . Once this was removed and added it in TEqn.H ... it worked ... thanks a lot for your help .

ambiguous
Quote:
use Foam::tanh(....) instead of tanh() , it will cure the pain;) 
In case of varying Cp with temperature , i wish to vary it conditionally .
What i mean is : for T < Tvalue Cp = f(T) ; for T >= Tvalue Cp = g(T) ; in such a case i am not able to use the standard operators like >= or > or < My code is as follows: Code:
forAll(T,celli) Code:
TEqn.H: In function ‘int main(int, char**)’: Code:
In readTransportProperties.H 
dear friend you can not assign a dimension Scalar to a scalar so use value()
Tleft.value() and so on 
thanks ,
that was a lesson learnt .... 
I am solving a heat transfer problem with water as fluid . So far I am using the buoyantBousinessqSimpleFoam solver . This solver however has the temperature formulation instead of the enthalpy formulation for the energy equation . That is correct considering that Cp and rho are assumed to be constant . I wish to formulate the energy equation using enthalpy . Can any of the already available solvers do this ? I went through the tutorials of solvers which are present in OF170 , what i found was that all of them used the working substance as air , assuming it as a perfectGas . This was declared in constant/thermophysicalProperties as :
Code:
/** C++ **\ 
When i rewrite the enthalpy equation as :
Code:
fvScalarMatrix hEqn Code:
incompatible fields for operation 
All times are GMT 4. The time now is 13:44. 