CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   turbulentHeatFluxTemperature doesn't work with buoyantBoussinesqPimpleFoam (https://www.cfd-online.com/Forums/openfoam-solving/204349-turbulentheatfluxtemperature-doesnt-work-buoyantboussinesqpimplefoam.html)

shang July 20, 2018 15:28

turbulentHeatFluxTemperature doesn't work with buoyantBoussinesqPimpleFoam
 
Dear all,

I am using OF 1612 on Centos 7, it was installed by following the tutorial on OFWiki.

I am currently modifying the hotRoom tutorial case under solver buoyantBoussinesqPimpleFoam to specify a constant heat flux at the floor. The modified BC for T is as below:

Code:

boundaryField
{
    floor
    /*{
        type            fixedValue;
        value          uniform 300; // Original
    }*/
    {
        type            compressible::turbulentHeatFluxTemperature;
        heatSource      flux;
        q              uniform 10e5;
        value          uniform 293.15;
        kappaMethod    fluidThermo;
        kappa          none;
        Qr              none;
    }
    ceiling
    {
        type            fixedValue;
        value          uniform 300;
    }
    fixedWalls
    {
        type            zeroGradient;
    }
}

I think I followed the example set in the source code of compressible::turbulentHeatFluxTemperature. But when I run the simulation, it shows following error message:

Code:

Starting time loop

Courant Number mean: 0 max: 0
Time = 2

PIMPLE: iteration 1


--> FOAM FATAL ERROR:
Kappa defined to employ fluidThermo method, but thermo package not available

    From function Foam::tmp<Foam::Field<double> > Foam::temperatureCoupledBase::kappa(const scalarField&) const
    in file turbulentFluidThermoModels/derivedFvPatchFields/temperatureCoupledBase/temperatureCoupledBase.C at line 142.

FOAM exiting

I checked the source code of temperatureCoupledBase.C, the relevant source code associated with this error message is:

Code:

case mtFluidThermo:
        {
            typedef compressible::turbulenceModel turbulenceModel;

            word turbName(turbulenceModel::propertiesName);

            if
            (
                mesh.foundObject<turbulenceModel>(turbName)
            )
            {
                const turbulenceModel& turbModel =
                    mesh.lookupObject<turbulenceModel>(turbName);

                return turbModel.kappaEff(patchi);
            }
            else if (mesh.foundObject<fluidThermo>(basicThermo::dictName))
            {
                const fluidThermo& thermo =
                    mesh.lookupObject<fluidThermo>(basicThermo::dictName);

                return thermo.kappa(patchi);
            }
            else if (mesh.foundObject<basicThermo>(basicThermo::dictName))
            {
                const basicThermo& thermo =
                    mesh.lookupObject<basicThermo>(basicThermo::dictName);

                return thermo.kappa(patchi);
            }
            else
            {
                FatalErrorInFunction
                    << "Kappa defined to employ " << KMethodTypeNames_[method_]
                    << " method, but thermo package not available"
                    << exit(FatalError);
            }

            break;
        }

The lines of code after the first if statement suggests that the this BC will look into the turbulenceProperties dictionary at the constant directory. Then select the turbulence model specified in turbulenceProperties, then evaluate the kappa = kappaEff. (Please correct me if I understand it incorrectly). So I suppose it will evaluated kappa automatically rather than jumping to the final error message under the else statement.

So can anybody give me some ideas on where has gone wrong, or do you have any idea how to apply a constant heat flux at the wall.


Many thanks,
Yeru

clapointe July 21, 2018 16:55

From the error message it looks like the bc would pull kappa from thermo. However, the boussinesq class of solvers does not actually create thermo. Additionally an incompressible turbulence model is created. So I'm not sure that you'll be able to use this bc with buoyantBoussinesqPimpleFoam.

Caelan

shang July 21, 2018 18:57

Hi Caelan,


Even though the solver doesn't create thermo, from the first few lines of source code of temperatureCoupledBase.C as shown in my thread, it should automatically evaluate kappa = kappaEff. I think your second point is very valid, as this BC may only work for compressible solver. So if I can't use this BC with buoyantBoussinesqPimpleFoam, do you know which BC can I use to set a constant heat flux?


Kind regards,
Yeru

clapointe July 21, 2018 20:03

I'd mentioned the thermo bit because the error mentioned thermo -- perhaps it didn't try to get kappaEff from the turbulence model because it's not a compressible one?

In any case, if it's a constant heat flux you can compute the associated temperature gradient using q = k*A*dt/dx.

Caelan

pete20r2 July 21, 2018 20:29

Quote:

Originally Posted by clapointe (Post 700030)
I'd mentioned the thermo bit because the error mentioned thermo -- perhaps it didn't try to get kappaEff from the turbulence model because it's not a compressible one?

In any case, if it's a constant heat flux you can compute the associated temperature gradient using q = k*A*dt/dx.

Caelan

That would be a simple fixedGradient btw

shang July 22, 2018 07:35

Quote:

Originally Posted by pete20r2 (Post 700031)
That would be a simple fixedGradient btw

Thanks, Caelan and Peter,

Does is mean I just need to use fixedGradient at the wall for the temperature? Can you tell me which kappa I should use in the calculation, is it the the thermal diffusivity of the fluid? Or the kappaEff calcuated incorporating the turbulence?


Many thanks,
Yeru

clapointe July 22, 2018 10:05

Yes, this would mean that you could use a fixed temperature gradient. This is Fourier's Law (https://en.wikipedia.org/wiki/Thermal_conduction), where k is the fluid's thermal conductivity in this case. However, now that I think about it, this would only be appropriate if you are resolving the boundary layer (where conduction is the dominant mode of heat transfer).

Caelan

shang July 23, 2018 15:48

Hey Caelan,

Yes, I am solving the wall as I am running LES without wall modelling. I suppose my dT/dx should be negative as the heat flux is from the wall to the internal fluid?

Also, a silly question, I suppose conduction, based on Fourier's Law, is normally governing the heat transfer in the solid, why it is applicable here?

Yeru

clapointe July 23, 2018 16:43

I suppose it is often associated with solids, but on a macro scale conduction through a gas is still the same -- the thermal conductivity is just a lot lower. I agree that the gradient will be negative. This is the first thing I thought of to approximate a gradient -- If any one else has a better idea I'd invite them to step in.

Caelan

shang July 24, 2018 06:17

Thanks Caelan, I will try the fixedGradient for now. Yeru

kakkapriyesh December 2, 2018 14:58

Hi,Yeru did you get the correct constant wall heat flux using the k of fluid? also what can we use to calculate wall heat flux for a turbulent case here(for wall at constant temp), my alphat file is not genrating number = nut/prt . am i missing something. i am running buoyantBoussinesqPimpleFoam for LES, and wall is fully resolved so i have not used any wall functions here.

calf.Z January 14, 2019 08:50

Quote:

Originally Posted by clapointe (Post 700058)
Yes, this would mean that you could use a fixed temperature gradient. This is Fourier's Law (https://en.wikipedia.org/wiki/Thermal_conduction), where k is the fluid's thermal conductivity in this case. However, now that I think about it, this would only be appropriate if you are resolving the boundary layer (where conduction is the dominant mode of heat transfer).

Caelan

Is k not the thermo conductivity of metirials but fluid? The thermo conductivity of fluid(kappa) is not constant and I use wallHeatFlux to check heat flux after simulation, I found the result is not the same as the setting one.

So how can I really set the constant heat flux BC? Maybe kappaMethod:fluid is not suitable for my case.Thank you.

pete20r2 January 14, 2019 09:17

Could you use something a bit more derivative like patch mass flow, temp etc and do energy balance?

calf.Z January 14, 2019 09:25

Quote:

Originally Posted by pete20r2 (Post 721885)
Could you use something a bit more derivative like patch mass flow, temp etc and do energy balance?

I use (h*phi)out - (h*phi)int = q*s to check energy balance, but it is not correct. So I doubt that the actual q is not the same as the setting one and the result of using wallHeatFlux makes me more confused.

clapointe January 14, 2019 12:15

Let's back up. What solver are you using and what is your problem. Where are you checking the heat flux/energy balance? To your question, yes kappa would be the thermal conductivity of your fluid. In the absence of radiation (are you including it?), conduction would be the dominant mode of heat transfer in the boundary layer so setting a temperature gradient sounds like a good way to set a constant heat flux (how much is kappa of your fluid actually changing?).

Caelan

calf.Z January 17, 2019 22:47

Quote:

Originally Posted by clapointe (Post 721929)
Let's back up. What solver are you using and what is your problem. Where are you checking the heat flux/energy balance? To your question, yes kappa would be the thermal conductivity of your fluid. In the absence of radiation (are you including it?), conduction would be the dominant mode of heat transfer in the boundary layer so setting a temperature gradient sounds like a good way to set a constant heat flux (how much is kappa of your fluid actually changing?).

Caelan

Thank you for replying me.

I am using buoyantSimpleFoam to solve the heat tranfer of supercritical CO2 flows in a vertical pipe. The walls have 3 parts: the start and the end are isothermo walls and the middle wall is given constant heat flux q.

I use tabular method to get these thermoproperties e.g. kappa rho Cp H... so that kappa is changing with T and P and is read from tabulated tables.

I want to check the heat flux on the wall after simulation. I found the utility:wallHeatFlux gives different values in post-Processing and on-running, whcih makes me very confused.

Then I want to check the energy balance between INLET and OUTLET. So I calculated (h*phi)out - (h*phi)in and q*s and found that they are not equal.

The thermoproperties close to critical point of CO2 is changing rapidly.From 298.15K to 310K, kappa is changing from 0.0888 to 0.076.
I am using externalWallHeatFluxTemperature BC and not sure if kappaMethod:fluidThermo is suitable for my case.

I have no idea about these questions above. Any hint is highly appreciated.

clapointe January 17, 2019 23:26

Fair warning -- I have not worked with supercritical fluids before. However, I might be able to address a few points :

- for the wallHeatFlux utility : how much different are the values? I am not sure why they would be different, but a quick scan of the code suggests they shouldn't be.

- for the energy balance : I'd recommend writing down energy terms at each boundary and making sure everything is all accounted for.

Caelan

calf.Z January 18, 2019 02:56

Quote:

Originally Posted by clapointe (Post 722255)
Fair warning -- I have not worked with supercritical fluids before. However, I might be able to address a few points :

- for the wallHeatFlux utility : how much different are the values? I am not sure why they would be different, but a quick scan of the code suggests they shouldn't be.

- for the energy balance : I'd recommend writing down energy terms at each boundary and making sure everything is all accounted for.

Caelan

I set q=26784W/m2, when multiplied by area, it is 16.83W.
If I use postProcess -func wallHeatFlux, I will get : min/max/integ(WALL) = 21240.6, 65211.9, 28.4312. 28.4312W >> 16.83W.
If I use #include wallHeatFlux to get value when running. It presents :WALL 1.725975e+04 3.073739e+04 1.693862e+01. 16.93W is closer to 16.83W.

So I am confused about the different results.

In my case, there are inlet and outlet and two interiors. I am not sure if openfoam will recognize interior and I think it will have no influence.
So (h*phi)out - (h*phi)in = q*s is the right method to check energy terms? are there other terms which may be ignored easily?

clapointe January 18, 2019 16:19

Are the runTime values from the end of your simulation? Re the energy balance is this a 2d simulation?

Caelan

calf.Z January 18, 2019 21:31

Quote:

Originally Posted by clapointe (Post 722345)
Are the runTime values from the end of your simulation? Re the energy balance is this a 2d simulation?

Caelan

I compared the runTime value of latestTime and the postProcess value of latestTime by using wallHeatFlux utility. The result is a lot different.

My case is 3D simulation. It is a vertical pipe with constant heat flux on the middle wall and the start and end of the wall are isoThermo walls.


All times are GMT -4. The time now is 00:54.