|
[Sponsors] |
May 6, 2014, 09:39 |
using rho in a formula in a solver
|
#1 |
New Member
Gennaro
Join Date: May 2014
Posts: 23
Rep Power: 12 |
Dear all,
I'm relatively new to OF programming and C++ programming, so I apologize for any improper question. I need to write, starting from Laplacian foam, a solver for heat transfer in superfluid helium. In the superfluid helium the thermal conductivity is a function of the density rho. I need to write a line of code which would first calculate the thermal conductivity. In the formula of the thermal conductivity there is rho. I want rho to be read from the constant/thermophysicalProperties file, and to be icoPolynomial like the following: equationOfState { rhoCoeffs<8> ( 3.6036e2 -8.3495e1 7.5874 -3.4024e-1 8.0052e-3 -9.4653e-5 4.4333e-7 0 ); //[kg/m3] // coeff a + bT+cT˛+... } How I can do it? What should I add in createFields.H? It should be something like volScalarField rho ( IOobject ( "rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), thermo.rho() ); but I'm not sure that thermo.rho() is the right function and I don't know what else to add in order to make it work? Thanks in advance Gennaro |
|
May 6, 2014, 09:55 |
|
#2 |
Senior Member
Join Date: Dec 2011
Posts: 121
Rep Power: 15 |
You can use this in your createFields.H :
scalar rho ( readScalar(thermophysicalProperties.lookup("rho")) ); |
|
May 6, 2014, 10:44 |
|
#3 |
New Member
Gennaro
Join Date: May 2014
Posts: 23
Rep Power: 12 |
Thanks Omid,
Your help is very appreciated. I'm trying it and I'll let you know if it works as soon as I test it. But I first need to add a function g which is a function of rho itself. g reads something like g = rho*Foam:ow((Foam:ow((T/Tlamda),5.7))*(1-Foam:ow((T/Tlamda),5.7)),3); Now I'm not sure about how I can declare g in createfields.H. Someone (who tried the same before me) declared it in the following way: volScalarField g ( IOobject ( "g", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedScalar("g",dimensionSet(3,1,-9,-1,0,0,0),scalar(0.)) ); But how can this be correct if a constant value of 0 is assigned to g? Thanks for your help Kind regards Gennaro |
|
May 6, 2014, 13:33 |
|
#4 |
New Member
Gennaro
Join Date: May 2014
Posts: 23
Rep Power: 12 |
Hi Omid,
I tried to run the solver and unfortunately your implementation of rho doesn't work, because the following lines in constant/thermophysicalProperties are not read: thermoType { type heSolidThermo; mixture pureMixture; transport polynomial; thermo hPolynomial; equationOfState rhoConst; specie specie; energy sensibleEnthalpy; } mixture { equationOfState { rho 7874; // [kg/m3] } } Any ideas on how to make it work? Thanks Genn |
|
May 7, 2014, 12:11 |
|
#5 | |
Senior Member
Join Date: Dec 2011
Posts: 121
Rep Power: 15 |
Quote:
If you need to extract input data as the format you gave, you can have a look at : http://www.cfd-online.com/Forums/ope...ictionary.html |
||
May 8, 2014, 06:44 |
|
#6 |
New Member
Gennaro
Join Date: May 2014
Posts: 23
Rep Power: 12 |
Hi Omid,
at the end I managed to solve the problem. In fact, if I want the thermal properties to be read in a run time selectable way according to thermoType { type heRhoThermo; mixture pureMixture; transport const; thermo hConst; equationOfState perfectGas; specie specie; energy sensibleEnthalpy; } I just had to add the following: autoPtr<solidThermo> sThermo ( solidThermo::New(mesh) ); solidThermo& thermo = sThermo(); thermo.validate(args.executable(), "h", "e"); Thanks and best regards Gennaro |
|
June 7, 2014, 12:00 |
|
#7 |
Member
Niu
Join Date: Apr 2014
Posts: 55
Rep Power: 12 |
Dear Omid,
I'm new to Open FOAM, I'm confused that why rho(density) is not defined in most tutorial cases such as cavity and channel395? Regards! Z.Q. Niu |
|
June 8, 2014, 07:06 |
|
#8 |
New Member
Gennaro
Join Date: May 2014
Posts: 23
Rep Power: 12 |
Hi Z.Q,
rho is not defined in case of perfect gas, because the value is calculated from T and p. |
|
Tags |
laplacianfoam, rho, thermophysicalproperties |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
icoLagrangianFoam OF1.6 myNewParticleSolver | heavy_user | OpenFOAM | 23 | June 2, 2020 03:18 |
Quarter Burner mesh with periosic condition | SamCanuck | FLUENT | 2 | August 31, 2011 12:34 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 21:02 |
Low Mach number Compressible jet flow using LES | ankgupta8um | OpenFOAM Running, Solving & CFD | 7 | January 15, 2011 14:38 |
why the solver reject it? Anyone with experience? | bearcat | CFX | 6 | April 28, 2008 15:08 |