CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problem with transport properties depending on Temperature (https://www.cfd-online.com/Forums/openfoam-solving/60397-problem-transport-properties-depending-temperature.html)

Hello everybody, I'm actual

Hello everybody,

I'm actually modifying the buoyantSimpleFoam solver in order to introduce transport coefficients depending on temperature. But I'm encountering a problem. The energy conservation is solved with the enthalpy value and I want to access to the temperature value in order to interpolate transport coefficients - like the viscosity - with the temperature. The viscosity I used is written in an external file "mu.txt" and it's tabulated with the temperature all the 100K. I've written the code like that:

f=fopen("/home/fvm/OpenFOAM/fvm-1.2/run/tutorials/buoyantSimpleFoam/test/0/mu.tx t","r");
fscanf(f,"%d",&Nmu); // Reading if the total number of the value Nmu
for (int i=0; i<Nmu; i++)
{
fscanf(f,"%lf",&TT_temp[i]); // Reading of the temperature values
}
for (int i=0; i<Nmu; i++)
{
fscanf(f,"%lf",&Tmu_temp[i]); // Reading of the viscosity values
}
fclose(f);

(sorry for using C programming but I'm not easy with C++ programming)

scalarField& muInternal = mu.internalField();
const scalarField& TInternal = T.internalField(); (or T_.internalField();)

forAll (muInternal, cellI)
{
muInternal[cellI] = Interpolate(TInternal[cellI], Tmu_temp, TT_temp, Nmu);
}

But errors appears when I compiled the code: with T, there is not enough information and with T_, T_ it's not declared in this code.

The way I'm using is it wrong or just the programming is incomplete?

F. LAGO

 eugene November 24, 2005 07:25

Thats because T is not declare

Thats because T is not declared in the top level code. Try thermo->T()

Thank you Eugene: it's work we

Thank you Eugene: it's work well.

 liugx212 December 5, 2005 13:03

Dear Frédéric LAGO: Could

Dear Frédéric LAGO:

Could you help me see my code and errors. I think maybe, I miss some header files. Please give some advice.

// set the nu for each cell
116: volScalarField& nuInternal = nu.internalField();
forAll (nuInternal, celli)
{
if (componentValue[celli] > 0)
nuInternal[celli] = 0.3;
else nuInternal[celli] = 0.1;
}
// set the rho for each cell
125: volScalarField& rhoInternal = rho.internalField();
forAll (rhoInternal, celli)
{
if (componentValue[celli] > 0)
rhoInternal[celli] = 2000000;
else rhoInternal[celli] = 20000;
}

// set the E for each cell
134: volScalarField& EInternal = E.internalField();
forAll (EInternal, celli)
{
if (componentValue[celli] > 0)
EInternal[celli] = 7854;
else EInternal[celli] = 1000;
}

Error as:

stressedFoam.C:116: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:125: error: 'struct Foam::dimensionedScalar' has no member named 'internalField'
stressedFoam.C:134: error: 'E' was not declared in this scope
stressedFoam.C:134: error: '<typeprefixerror>E' previously declared here

Thanks deeply,
Guoxiang

Dear Guoxiang, line 116 try

Dear Guoxiang,

line 116 try:
const scalarField& nuInternal = nu.internalField();
volScalarField& nuInternal = nu.internalField();
Try the same thing line 125.
Line 134 your value E is not declared or not solved in your code...

Frédéric LAGO

 liugx212 December 6, 2005 13:51

Dear Frédéric LAGO: Thanks

Dear Frédéric LAGO:

Thanks for your help. But I was also same errors. I will try again and ask for you.

Thanks a lot.
Guoxiang

 All times are GMT -4. The time now is 20:06.