CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Bugs

thermalBaffle1D showing bad behavior

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 17, 2015, 10:20
Question thermalBaffle1D showing bad behavior
  #1
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Dear foamers,

Lately I have been trying to work with cylindrical baffles in a multiregion case. The solver I'm working with is chtMultiRegionSImpleFoam and I'm working with OpenFOAM 2.3.x. The case I'm currently working on aims to test the thermal behavior of the elements inside a furnace in vacuum conditions. As a consequence, I'm only interested in computing radiative and conductive heat fluxes since convection can be neglected. For this purpose, I set the thermal conductivity of the fluid region close to 0 by adjusting properly tha values of cp or Pr number in the "constant/fluidRegion/thermophysicalProperties" (I use constant transport and thermophysical properties). Furthermore, I activated the frozenFlow option in fvSolution file.

One of the regions that make up the whole system are a set of cylindrical heat shields that prevent from heat losses. Since these components have a small thickness compared to their length I decided to create them as baffles using the utility createBaffles and the BC named thermalBaffle1D, that develops the heat conduction equation in 1D and allows to include Qr in the balance as follows

Q_r + \frac{k_{w}}{\delta}(T_{i} - T_{p}) = \frac{k_{s}}{\delta_s} (T_p - nbrT_p)

being
k_w the thermal conductivity of the fluid near the patch (kappaEff)
\delta the distance between the center of the patch face to the center of the cell (\frac{1}{deltaCoeffs})
k_s the thermal conductivity of the the baffle
\delta_s the baffle thickness

In order to compute the mentioned balance, and according to the source code, the boundary condition (thermalBaffle1D) uses

f = \frac{alpha}{alpha+myKDelta}

refValue = \frac{KDeltaSolid * nbrT_p}{alpha}

refGrad = 0

with
myKDelta= \frac{k_w}{\delta}
KDeltaSolid= \frac{k_s}{\delta_s}
alpha=KDeltaSolid - \frac{Qr}{T_p}

On the paper it looked fantastic and I thought that I was going to get nice values by using this BC with the heat shields created as baffles. However, it wasn't that cool...

In my case, the balance at the patch was a little simpler since I don't have to compute the convection term (OpenFOAM does it anyway although tha values of convection heat transfer are small depending on the value of cp or Pr I choose in the thermophysicalProperties file). Bellow the equation without the convection term is shown.

Q_r  = \frac{k_{s}}{\delta_s} (T_p - nbrT_p)

The fact that k_w is close to 0 implies that

k_w=0 ===> myKDelta=0 ===> f=1

So far, it seems that the mentioned BC must work properly for my case. However, it was not like that...

After some tests I found out that the fact of setting low values of cp (or hign values of Pr instead) in the "constant/fluidRegion/thermophysicalProperties" file has a weird influence on the thermal distribution on the baffles once the solver has converged. More exactly, what is happening is that the lower value the cp (or higher value the Pr) has, the variation of the baffle temperature is smaller from the initial value. For instance, if I set a value of cp (for the air) of 1e-5 and an initial value for the temperature in the baffle surface of 500 K, once the solver has converged the temperature in the baffles is almost uniform of 500 K. If I increase the value of cp to, say, 1e-2, the final value of the baffle temperature shows a little more variation, say, it's in a range between 500.1 and 500.3 K. However, if I use a normal value for the cp of the air (1000), the baffle's temperature distribution looks quite physical and its values go from 492 to 548 K. Attached you can see a quarter of the cylindrical shield and its temperature distribution with a value of the cp for the air of 1000.

I cannot understand why the value of k_w makes that big difference over the value of the temperatures on the baffles, whereas the effect of the radiative heat flux has no influence when k_w has a very low value, because, according to the source code, it shouldn't be like that.

Another strange thing I noticed is that the value of the relaxation factor for the Qr is not taken inton account or, at least, is not shown properly. In this other post you can see how I define my baffles in the createBafflesDict file.

If I give a value different from 0 to the relaxation factor in the createBafflesDict file, say, a value of 0.5 as you can see below

Code:
"./0.org/include/1DBaffle/1DTemperatureMasterBafflePatches_shield"

T
{
    type   compressible::thermalBaffle1D<hConstSolidThermoPhysics>;

    thickness       uniform 0.002;  // thickness [m]
    Qr              Qr;
    relaxation      0.5;
    Qs              uniform 0;    // heat flux [W/m2]

    # include "1DbaffleSolidThermo_shield"

    value               uniform 500;
}
This is how it looks the "processor0/0/air/T" file once the baffle is created:

Code:
    

shieldBaffle1D_1_up_master
    {
        type            compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
        refValue        uniform 500;
        refGradient     uniform 0;
        valueFraction   uniform 0;
        value           uniform 500;
        sampleMode      nearestPatchFace;
        sampleRegion    air;
        samplePatch     shieldBaffle1D_1_up_slave;
        coupleGroup     shieldBaffle1D_1_up;
        thickness       uniform 0.002;
        Qs              uniform 0;
        specie
        {
            nMoles          1;
            molWeight       20;
        }
        equationOfState
        {
            rho             7930;
        }
        thermodynamics
        {
            Cp              460;
            Hf              0;
        }
        transport
        {
            kappa           21;
        }
        QrPrevious      uniform 0;
        Qr              Qr;
        QrRelaxation    0;
    }
    shieldBaffle1D_1_up_slave
    {
        type            compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
        refValue        uniform 500;
        refGradient     uniform 0;
        valueFraction   uniform 0;
        value           uniform 500;
        sampleMode      nearestPatchFace;
        sampleRegion    air;
        samplePatch     shieldBaffle1D_1_up_master;
        coupleGroup     shieldBaffle1D_1_up;
        QrPrevious      uniform 0;
        Qr              Qr;
        QrRelaxation    0;
    }
The same occurs in other times, not only in 0 time. Thus, either the relaxation factor is always 0 no matter what value you want to use, or it uses the value you set although it keeps showing a 0 somehow... Furthermore, I have tested createBaffles utility both in parallel and serial mode obtaining strange results.
  • createBaffles in serial and solved in parallel:
    • processor0/*/air/T: QrRelaxation=0
    • 0/air/T (after reconstruction): QrRelaxation=0.5
    • */air/T (after reconstruction): QrRelaxation=0
  • createBaffles in parallel, solved in parallel:
    • processor0/*/air/T: QrRelaxation=0
  • createBaffles in serial, solved in serial:
    • */air/T: QrRelaxation=0

At this stage, I don't have a clue where the problem is but I would like to know if I can do something in order to get good results using these BC in my case (without convection). Maybe both problems mentioned above are related, no idea...

Should I report this issue in the bug tracker? Any kind of help is much apprecaited.

Best regards,

Alex

PS: I apologize for the post's length...
Attached Images
File Type: jpg shield.jpg (14.0 KB, 74 views)
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!

Last edited by zfaraday; May 18, 2015 at 08:42. Reason: paths in the last list corrected. Image correctly attached
zfaraday is offline   Reply With Quote

Old   May 17, 2015, 15:27
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Alex,

You did very well in providing as much information as possible! Although, a few details are missing:
  1. A test case would come in handy to test what you're seeing.
  2. I think you mentioned an attached image... and I can't see any.

The first problem I can spot is this: Did you check what values "alpha" has got? Namely in the equation for "f".


The second problem is regarding "createBafflesDict", because this line:
Code:
relaxation      0.5;
will not be automatically interpreted to this:
Code:
QrRelaxation    0;
the names are different, therefore they are not the same.


The third problem... is just a suspicion. If you are getting one situation where you get:
Code:
QrRelaxation    0.5;
and all others are "0.0", then you possibly are not setting up the case in the same exact way for all situations. In other words, you might not be relying on scripts to set-up the case for you and perhaps you're manually editing some files?


Like I wrote above, having a good test case would make it easier to diagnose the problem. And I hope you're using "Allrun" scripts to help run the case.
In addition, I strongly suggest you first try solving a 2D problem case, so that you can do the tests faster and the mathematics are easier to do manually, in order to double check what might be going wrong.

And if there is a bug in createBaffles, then we definitely need a test case, in order to isolate the problem.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 18, 2015, 09:19
Smile
  #3
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Thanks for your quick answer Bruno, your insight is much appreciated.

Quote:
Originally Posted by wyldckat View Post
Greetings Alex,

You did very well in providing as much information as possible! Although, a few details are missing:
  1. A test case would come in handy to test what you're seeing.
  2. I think you mentioned an attached image... and I can't see any.
I will work in a simple test case and upload it as soon as I can. Regarding the image attached, something happened and it wasn't uploaded properly. Now you can watch it.

Quote:
Originally Posted by wyldckat View Post
The first problem I can spot is this: Did you check what values "alpha" has got? Namely in the equation for "f".
How can I check the value of alpha? I only checked the value of "f", that relies on the value of k_w, and the smaller this value is, the closer to 1 "f" gets to. For a value of cp of 1e-5 "f" is 1.

Quote:
Originally Posted by wyldckat View Post
The second problem is regarding "createBafflesDict", because this line:
Code:
relaxation      0.5;
will not be automatically interpreted to this:
Code:
QrRelaxation    0;
the names are different, therefore they are not the same.
Well, I think you are wrong here, or the code of the thermalBaffle1D is otherwise. If you take a look at the source code, you can see that in the line 105 of the file thermalBaffle1DFvPatchScalarField.C it is stated:
Code:
    QrRelaxation_(dict.lookupOrDefault<scalar>("relaxation", 0)),
so it looks for a field named relaxation, not QrRelaxation. Besides that, in the usage's example in the header file a field named relaxation is also used.

Quote:
Originally Posted by wyldckat View Post
The third problem... is just a suspicion. If you are getting one situation where you get:
Code:
QrRelaxation    0.5;
and all others are "0.0", then you possibly are not setting up the case in the same exact way for all situations. In other words, you might not be relying on scripts to set-up the case for you and perhaps you're manually editing some files?
I use Allrun scripts to set up the whole cases I work in, so I'm not manually editing any file. The baffle setup I used in my case is based on the setup used in the $FOAM_TUTORIALS/heatTransfer/buoyantSimpleFoam/circuitBoardCooling tutorial, since this is the only tutorial where thermalBaffle1D BC is used. Actually, I just tested the QrRelaxation issue in this tutorial case and it writes out a value of 0.5 in the 0 time but it doesn't in further times...

Quote:
Originally Posted by wyldckat View Post
Like I wrote above, having a good test case would make it easier to diagnose the problem. And I hope you're using "Allrun" scripts to help run the case.
In addition, I strongly suggest you first try solving a 2D problem case, so that you can do the tests faster and the mathematics are easier to do manually, in order to double check what might be going wrong.

And if there is a bug in createBaffles, then we definitely need a test case, in order to isolate the problem.

Best regards,
Bruno
I don't think the problem is in the createBaffles utility, but in thermalBaffle1D BC. As soon as I have the test case I will upload it.

Many thanks again for your advices.

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   May 18, 2015, 15:42
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Alex,

Earlier today, as soon as I saw that you had replied to my post and you stated that I was wrong, I remembered that yesterday I didn't manage to take a look into the source code of the BC. Since you provided the link in your post, I saw the code and the bug regarding the "relaxation" keyword and reported it here: http://www.openfoam.org/mantisbt/view.php?id=1696
The fix was up less than an hour later and is shown here: https://github.com/OpenFOAM/OpenFOAM...f72ad2fb034bf5


As for showing the "alpha" value, find the following piece of code in this boundary condition:
Code:
        scalarField KDeltaSolid(kappas/baffleThickness());

        scalarField alpha(KDeltaSolid - Qr/Tp);
Now append the following lines after the last line:
Code:
Info << "alpha: " << alpha << endl;
Info << "KDeltaSolid: " << KDeltaSolid << endl;
Info << "Qr: " << Qr << endl;
Info << "Tp: " << Tp << endl;
Then compile the library where the boundary condition is located... if I'm not mistaken:
Code:
wmake libso $FOAM_SRC/turbulenceModels/compressible/turbulenceModel
Then run the solver, to see what values it gives you on screen or in a log file.

My suspicion is that the "alpha" values you're getting are very small and that something like the following might be happening:
Code:
0.0001/(0.0001 + 0.01)
Best regards,
Bruno
zfaraday likes this.
wyldckat is offline   Reply With Quote

Old   May 18, 2015, 17:12
Default test case
  #5
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Thanks Bruno for reporting the bug! I just saw that it had been solved just some minutes before you posted your last post. However, I don't know if it solves my main problem, I will check it out soon!

My main problem was that when I deactivated the effect of convection (by setting a low value of Cp in the "air/thermophysicalProperties" file) in order to compute only radiation and conduction heat transfer, the thermal distribution on the baffle was not realistic since it remained constant (or almost constant) with the same value as the initial one. With this post I attach a simple test case where this effect can be noticed. This case is based on the original tutorial case "circuitBoardCooling", the only differences are:
  • one of the two baffles has been modified to be both of the same type (thermalBaffle1D). The one that has been modified is generating a superficial heat flux while the other one is not.
  • pressure has been diminished to 1e-2.
  • the effect of the radiation has been added (fvDOM)
  • the system has been closed so that no air flows through the patches
  • all external walls are now of type "externalWallHeatFluxTemperature", not taking into account Qr (1)

It's not exactly the same case I was struggling with in the first post of this thread because the other one was run with chtMultiRegionSimpleFoam solver, while this one is solved with buoyantSimpleFoam. Even so, I guess that the solver for the fluids in chtMultiRegion solvers does the same as buoyantSimpleFoam... I haven't checked the source code. Nonetheless, the effect I want to show is the same in both cases: when the thermal conductivity of the fluid region is diminished by giving a low value to the Cp, the baffle temperature doesn't show physical values (the lower the Cp is, the less changes the temperature from the initial value).

I also want to thank you for the good advice you gave me. I will add that piece of code to the BC source code in order to check where the error may be.

Best regards,

Alex

PS. Btw, I would like to understand why a relaxation factor for Qr is needed in this BC and it's not in other BC's (e.g. in externalWallHeatFluxTemperature among others)

__________________________________________________ ____________
(1) I have to dismiss the effect of Qr at the boundaries because when I try to take it into account the solver always crashes after some iterations. I found it out some time ago in a case solved with chtMultiRegionSimpleFoam. Maybe it is another bug to be reported...
Attached Files
File Type: zip circuitBoardCooling_rad.zip (35.8 KB, 39 views)
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!

Last edited by zfaraday; May 18, 2015 at 17:21. Reason: PS added.
zfaraday is offline   Reply With Quote

Old   May 22, 2015, 09:02
Default
  #6
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
After some tests, it seems to solve the problem!

Thanks Bruno for the report!

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   October 1, 2016, 17:05
Default
  #7
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Quote:
Originally Posted by zfaraday View Post
PS. Btw, I would like to understand why a relaxation factor for Qr is needed in this BC and it's not in other BC's (e.g. in externalWallHeatFluxTemperature among others)
__________________________________________________ ___________
(1) I have to dismiss the effect of Qr at the boundaries because when I try to take it into account the solver always crashes after some iterations. I found it out some time ago in a case solved with chtMultiRegionSimpleFoam. Maybe it is another bug to be reported...
You can specify the relax factor for Qr in system/fvSolution dictionary
Code:
//- system/fvSolution
relaxationFactors
{
    fields
    {
         Qr       0.1;
     }
}
The relaxation is performed just after new values for Qr field are computed. For example, using viewFactor radiation model it is done in viewFactor::calculate() function:
Code:
//-src/thermophysicalModels/radiation/radiationModels/viewFactor/viewFactor.C
void Foam::radiation::viewFactor::calculate()
{
...
    // Relax Qr if necessary
    Qr_.relax();
}
From my experience I can conclude that relaxating Qr is going to stabilize solution a lot. Try it.
Zeppo is offline   Reply With Quote

Reply

Tags
chtmultiregionsimplefoam, convection, createbaffles, radiation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad pressure distribution in pump oringo FLUENT 2 March 2, 2013 11:38
[ANSYS Meshing] Very thin plate (0.1mm) ICEM CFD bad meshing msormania ANSYS Meshing & Geometry 1 April 30, 2012 08:45
Allwmake path error kiski OpenFOAM Installation 20 March 22, 2012 13:45
Bad OpenGL Performance with FIRE GL2 using GAMBIT Volker Pawlik FLUENT 1 December 1, 2003 13:38
Problems of Duns Codes! Martin J Main CFD Forum 8 August 15, 2003 00:19


All times are GMT -4. The time now is 22:35.