View Issue Details

IDProjectCategoryView StatusLast Update
0001991OpenFOAMBugpublic2020-11-21 19:53
Reporteremacchi Assigned Tohenry  
Status resolvedResolutionfixed 
PlatformGNU/LinuxOSUbuntuOS Version14.04
Product Versiondev 
Fixed in Versiondev 
Summary0001991: Problems with turbulentTemperatureCoupledBaffleMixed boundary condition
DescriptionWhile doing some CHT simulations (with low-Re RANS model) I noticed that the heat flux of a patch computed using the wallHeatFlux utility in either solid or fluid region is not the same. This is obviously not possible since the equality of heat fluxes is imposed through the boundary condition. The problems seems to appear only when performing variable properties simulations. I checked the output from the debug of the turbulentTemperatureCoupledBaffleMixed BC and in here the computation of the heat flux is correct. I did not check yet but I think the problem is connected to how the heat flux is computed in the utility: in particular it might be related to the conductivity/diffusivity coefficient. In the boundary conditions kappa is computed using directly the boundary values while in the utility fvc::interpolate(alpha) is used.
TagsNo tags attached.



2016-02-10 16:31

reporter   ~0005933

I tried computing the heat flux as follows but there is still the same problem...

surfaceScalarField snGradh

surfaceScalarField::GeometricBoundaryField& patchHeatFlux =

forAll(patchHeatFlux, patchi)


2016-02-10 17:07

reporter   ~0005934

Last edited: 2016-02-10 17:28

Ok, I think I found the problem: if I use temperature and effective conductivity to compute the heat flux the results are correct.

Thinking about it the turbulentTemperatureCoupledBaffleMixed BC starts from temperature and conductivity to impose the condition so it makes sense that the heat fluxes computed in this way are identical.

However I would not expect such differences (up to 5%) when using enthalpy. Is this due to the non-linearity of the h-T function I am using? I am modelling supercritical CO2 so the specific heat presents strong variations around the pseudo-critical temperature.

Unfortunately after this correction the error on the overall energy balance for the fluid region is larger...


2016-02-11 08:01

updater   ~0005935

Can you please provide a test case that reproduces this problem?

By the way, have you double-checked if the fixes made here: - worked as intended?


2016-02-11 09:54

reporter   ~0005936

Last edited: 2016-02-11 09:56

The turbulentTemperatureCoupledBaffleMixed BC calculates the heat flux: kappaEff*grad(T)

In the energy equations of chtMultiRegionFoam and wallHeatFlux utility the heat flux is calculated alphaEff*grad(he).

These are only equal if Cp is constant on between the wall face and the near wall cell. Otherwise there is an error in the energy balance between the regions.

This issue is explained in a bit more detail in this M.Sc. thesis:


2016-02-11 11:07

reporter   ~0005937

@ wyldckat: the previous issue was different and it was fixed in the dev (and 3.x) version

@ Juho: yes, I think that's exactly the problem. I will check the M.Sc. thesis. Thank you.


2016-02-23 12:25

reporter   ~0005978

Last edited: 2016-02-23 15:11

Yesterday I finally got some time to work on the boundary condition. I implemented a boundary condition based on alphaEff*grad(he) and computed the boundary temperature using Newton method (through assuming constant alpha during iterations). I think its more or less what's described in the MSc, thesis.

Very few Newton iterations are needed, however the heat flux computed on the two sides of the same patch is not identical; sometimes the difference is very small (practically negligible) but it seems that when the transients are important the error also becomes significant. It seems that the number of outer iterations must increased (>25-30) to solve the problem.

Any thoughts?


2016-02-26 07:15

reporter   ~0005980

It is probably just a consequence of the region-segregated solution algorithm. You need to iterate over the energy solutions of the regions to converge the inter-region heat transfer. Implicit coupling between the energy solutions of the the different regions would remove the need for these iterations.

You could probably speed-up the simulation a bit by splitting a nOuterEnergyCorr from the nOuterCorr.

Something like:
// --- PIMPLE loop
   for (int oCorr=0; oCorr<nOuterEnergyCorr; oCorr++)

if (oCorr >= nOuterCorr)
    frozenFlow = true;
    frozenFlow = false;

With something like:
nOuterCorr 3;
nOuterEnergyCorr 30;

You could also add some kind of inter-region heat balance check to stop the extra energy corrector loop if they are below a set tolerance, so that they are only done when needed.


2016-02-26 12:21

reporter   ~0005981

Yeah, its also due to the segregated solution algorithm but I think that the "approximated" Newton method used while computing enthalpy based boundary condition plays a large role.

I could try to update also alpha during the Newton iteration but it's not that simple because both kappa(T) and Cp(T) are not simple functions (for example Cp(T) is something like a Gaussian function).

I was also thinking of adding additional iterations to compute only the fluid energy equation. In this way the alpha in the BC is updated without having to do a full outer correction. Implementing an inter-region heat balance to stop the energy corrector loop is good idea! I will do this shortly, thank you!

Last week, before adding the new BC I tried to use the regionCoupled functionality in OF-dev (src/regionCoupled and src/meshTools/regionCoupled/). I got it to run so the simulation setup should be ok but the results are not correct. Unfortunately there is almost no information about this functionality and I am not sure whether it is fully functional or not. I tried to check the source code (src/regionCoupled/derivedFvPatchFields/energyRegionCoupled/energyRegionCoupledFvPatchScalarField.C) but I don't understand how this works (it not that clear from "updateInterfaceMatrix"). However this seems for sure quite different from conjugateHeatFoam, the fully-coupled CHT solver of FOAM-extend.

Do you have any info about this?


2016-03-08 11:55

reporter   ~0006007

Last edited: 2016-03-08 12:05

Update about this problem:

adding an energyCorrector loop inside the outerCorrections loop (to solve the energy equation for all the regions) solves the problems. As suggested by Juho the number of iterations can be managed automatically based on an inter-region heat balance. The latter can be computed similarly to what is done in temperatureCoupled.. boundary conditions.


2020-06-25 17:59

reporter   ~0011411

Any updates on this issue? I am running exactly into this problem. I have created a test case based on $FOAM_TUTORIALS/heatTransfer/chtMultiRegionFoam/coolingSphere

The thermophysical proberties of vapor were fitted to the output of:*s&STUnit=N%2Fm

Is the boundary condition "turbulentTemperatureCoupledBaffleMixedMod" mentioned in the master thesis or the other developments available?

Thank you for any help


2020-11-21 19:53

manager   ~0011705

This should now be resolved in OpenFOAM-dev.

Issue History

Date Modified Username Field Change
2016-02-10 15:02 emacchi New Issue
2016-02-10 16:31 emacchi Note Added: 0005933
2016-02-10 17:07 emacchi Note Added: 0005934
2016-02-10 17:28 emacchi Note Edited: 0005934
2016-02-11 08:01 wyldckat Note Added: 0005935
2016-02-11 09:54 Juho Note Added: 0005936
2016-02-11 09:56 Juho Note Edited: 0005936
2016-02-11 11:07 emacchi Note Added: 0005937
2016-02-23 12:25 emacchi Note Added: 0005978
2016-02-23 14:19 emacchi Note Edited: 0005978
2016-02-23 14:55 emacchi Note Edited: 0005978
2016-02-23 15:11 emacchi Note Edited: 0005978
2016-02-23 15:11 emacchi Note Edited: 0005978
2016-02-26 07:15 Juho Note Added: 0005980
2016-02-26 12:21 emacchi Note Added: 0005981
2016-03-08 11:55 emacchi Note Added: 0006007
2016-03-08 11:59 wyldckat Summary Heat flux computed in wallHeatFlux not correct => Problems with turbulentTemperatureCoupledBaffleMixed boundary condition
2016-03-08 12:05 emacchi Note Edited: 0006007
2016-03-08 12:05 emacchi Note Edited: 0006007
2016-03-11 11:44 administrator Category 3.0.1 => (No Category)
2016-03-20 20:38 wyldckat Category (No Category) => Bug
2020-06-25 17:59 jherb File Added: modifiedCoolingSphere.tar.gz
2020-06-25 17:59 jherb Note Added: 0011411
2020-11-21 19:53 henry Assigned To => henry
2020-11-21 19:53 henry Status new => resolved
2020-11-21 19:53 henry Resolution open => fixed
2020-11-21 19:53 henry Fixed in Version => dev
2020-11-21 19:53 henry Note Added: 0011705