CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (http://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Bug in turbulentHeatFluxTemperatureFvPatchScalarField; OF 1.6.x (http://www.cfd-online.com/Forums/openfoam-bugs/72284-bug-turbulentheatfluxtemperaturefvpatchscalarfield-1-6-x.html)

evrikon February 1, 2010 09:40

Bug in turbulentHeatFluxTemperatureFvPatchScalarField; OF 1.6.x
 
Hi forum,

in OpenFoam 1.6.x the boundary condition which represents a constant heat flux through the boundary does not work for incompressible cases like buoyantBoussinesqSimpleFoam. To see the bug please have a look into

/src/turbulenceModels/incompressible/turbulentHeatFluxTemperatureFvPatchScalarField.C
:line 160

You can see:
const scalarField& Cpp =
patch().lookupPatchField<volScalarField, scalar>(CpName_);

This is not correct because an incompressible solver does not have any information about Cp.
-----------------------------------------
Here is my bugfix:

void turbulentHeatFluxTemperatureFvPatchScalarField::up dateCoeffs()
{
if (updated())
{
return;
}

const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");

const scalarField alphaEffp =
patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);

// const scalarField& Cpp =
// patch().lookupPatchField<volScalarField, scalar>(CpName_);

transportModel& laminarTransport = rasModel.transport();
dimensionedScalar Cp(laminarTransport.lookup("Cp"));

gradient() = q_/(Cp.value()*alphaEffp);

fixedGradientFvPatchScalarField::updateCoeffs();
}
-------------------------------------------------------------------------------------------------
Further I specified Cp by adding one line into readTransportProperties.H for solver buoyantBoussinesqSimpleFoam:

//Bug fix OLK: Cp is needed for fixedHeatFlux boundary condition
// Heat capacity
dimensionedScalar Cp(laminarTransport.lookup("Cp"));
-------------------------------------------------------------------------------------------------
For other incompressible solvers with heat transfer it should be done too.

Now I can use the new boundary condition turbulentHeatFluxTemperature for both compressible and incompressible cases.

Cheers, Oleksiy

rob3rt July 2, 2010 05:23

Hello Evrikon,

I had this error while trying to compile your bugfix.

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C:1 59: error: ‘transportModel’ was not declared in this scope
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C:1 59: error: ‘laminarTransport’ was not declared in this scope
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C:1 59: error: ‘rasModel’ was not declared in this scope
derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C:1 62: error: ‘Cpp’ was not declared in this scope

What should I declare to make this working?

And

another question is: what is difference between turbulentHeatFluxTemperature (without rho) and wallHeatFlux (http://openfoamwiki.net/index.php/Contrib_wallHeatFlux)?
I think both can be used for incompressible cases, right?

Thanks very much for your time.

Kind Regards,
Robert.

evrikon September 7, 2010 07:31

Dear Robert,

I implemented this bug fix directly in OpenFoam 1.6.x. I changed the boundary condition in turbulentHeatFluxFvPatchField.C as described above and recompiled the whole turbulenceModels staff. It takes only a few minutes. If you try to do that, please do a backup of turbulenceModels directory before!

I assume you simply miss the corresponding libraries. Do you try to define this boundary condition as your own library? Then you do need to look into your Make/files and Make/Options.

cgoniva September 9, 2010 04:39

Dear Oleksiy,

Shouldn't you add rho to the equation:
"gradient() = q_/(Cp.value()*alphaEffp*rho0); "
as this is done here (http://openfoamwiki.net/index.php/Contrib_wallHeatFlux) ???

This rho should be read from dictionary as you did for Cp:
"dimensionedScalar rho0(laminarTransport.lookup("rho0")); "

Cheers,
Chris

cgoniva September 9, 2010 04:52

oh... some mistake, it should be:

"gradient() = q_/(Cp.value()*alphaEffp*rho0.value()); "

Cheers, Chris

evrikon September 27, 2010 08:52

No, I only speak about the incompressible case where no rho is present in OpenFoam. Therefore the gradient is not divided by rho. For compressible cases it should be divided.


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