|
[Sponsors] |
February 7, 2011, 05:50 |
varying cp with temperature .
|
#1 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
In the buoyantBousinessqSimpleFoam solver i want to vary my Cp with temperature . How should i write the program for this ?
|
|
February 8, 2011, 06:08 |
|
#2 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 ; volScalarField Cp ( IOobject ( "Cp", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); Info<<" Reading field C "<<endl ; volScalarField C ( IOobject ( "C", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); 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); followed by the temperature equation . Code:
--> FOAM FATAL ERROR: Argument of trancendental function not dimensionless From function trans(const dimensionSet& ds) in file dimensionSet/dimensionSet.C at line 370. |
|
February 8, 2011, 12:25 |
|
#3 |
Member
MSR CHANDRA MURTHY
Join Date: Mar 2009
Posts: 33
Rep Power: 17 |
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. |
|
February 8, 2011, 17:24 |
|
#4 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25 |
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 |
|
February 8, 2011, 22:09 |
|
#5 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
@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 ...
|
|
February 8, 2011, 22:19 |
|
#6 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
@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 ?
|
|
February 9, 2011, 00:02 |
|
#8 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
@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 |
|
February 9, 2011, 02:01 |
|
#9 |
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36 |
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 Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. |
|
February 9, 2011, 05:13 |
|
#10 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
@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 |
|
February 9, 2011, 05:21 |
|
#11 |
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36 |
Use
m.value() However it should really work with fields without looping. Best,
__________________
Alberto Passalacqua GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541) OpenQBMM - An open-source implementation of quadrature-based moment methods. To obtain more accurate answers, please specify the version of OpenFOAM you are using. |
|
February 9, 2011, 05:32 |
about janafthermo
|
#12 | |
New Member
karthik
Join Date: Dec 2010
Location: munich
Posts: 16
Rep Power: 16 |
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 |
||
February 9, 2011, 05:43 |
|
#13 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
that gives the following error :
Code:
error: call of overloaded ‘tanh(double)’ is ambiguous |
|
February 9, 2011, 06:05 |
|
#14 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 .
|
|
February 10, 2011, 08:10 |
|
#16 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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) { if ( T[celli] >= Tleft && T[celli] <= Tmid) { Cp[celli] = 1000*41.2/50.0 * (T[celli] - Tleft) + cpConstant; } else if ( T[celli] > Tmid && T[celli] <= Tright ) { Cp[celli] = -1000*41.2/50 * ( T[celli] - Tright ) + cpConstant; } } Code:
TEqn.H: In function ‘int main(int, char**)’: TEqn.H:23: error: no match for ‘operator>=’ in ‘T.Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::DimensionedField<double, Foam::volMesh>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double](celli) >= Tleft’ TEqn.H:23: error: no match for ‘operator<=’ in ‘T.Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::DimensionedField<double, Foam::volMesh>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double](celli) <= Tmid’ TEqn.H:25: error: cannot convert ‘Foam::dimensioned<double>’ to ‘double’ in assignment TEqn.H:27: error: no match for ‘operator>’ in ‘T.Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::DimensionedField<double, Foam::volMesh>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double](celli) > Tmid’ TEqn.H:27: error: no match for ‘operator<=’ in ‘T.Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::<anonymous>.Foam::DimensionedField<double, Foam::volMesh>::<anonymous>.Foam::Field<double>::<anonymous>.Foam::List<double>::<anonymous>.Foam::UList<T>::operator[] [with T = double](celli) <= Tright’ TEqn.H:29: error: cannot convert ‘Foam::dimensioned<double>’ to ‘double’ in assignment /home/ifmg/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘transonic’ make: *** [Make/linux64GccDPOpt/buoyantBoussinesqSimpleFoam.o] Error 1 Code:
In readTransportProperties.H dimensionedScalar Tleft (laminarTransport.lookup("Tleft")); dimensionedScalar Tright (laminarTransport.lookup("Tright")); dimensionedScalar Tmid (laminarTransport.lookup("Tmid")); |
|
February 10, 2011, 08:44 |
|
#18 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
thanks ,
that was a lesson learnt .... |
|
February 22, 2011, 06:07 |
|
#19 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.0 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object thermophysicalProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; mixture air 1 28.96 1004.4 0 1.831e-05 0.705; // ************************************************************************* // |
|
February 22, 2011, 08:24 |
|
#20 |
Senior Member
Balkrishna Patankar
Join Date: Mar 2009
Location: Pune
Posts: 123
Rep Power: 17 |
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 . 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. Last edited by balkrishna; February 22, 2011 at 08:45. Reason: concluding line |
|
Tags |
density, property, specific heat, temperature |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with zeroGradient wall BC for temperature - Total temperature loss | cboss | OpenFOAM | 12 | October 1, 2018 07:36 |
Calculation of the Governing Equations | Mihail | CFX | 7 | September 7, 2014 07:27 |
monitoring point of total temperature | rogbrito | FLUENT | 0 | June 21, 2009 18:31 |
udf for varying inlet temperature | aravind | FLUENT | 0 | October 27, 2008 11:08 |
chemical reaction - decompostition | La S. Hyuck | CFX | 1 | May 23, 2001 01:07 |