|
[Sponsors] |
July 20, 2010, 05:40 |
Adding heat source to chtMultiRegionFoam
|
#1 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Dear FOAMers,
in order to simulate a conduction + convection problem with openFoam, I added a heat source to the standard chtMultiRegionFoam release. This was straightforward: in solveSolid.H I added the heat source H [W m-3] contribution to the general conduction equation: Code:
{ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) { tmp<fvScalarMatrix> TEqn ( fvm::ddt(rho*cp, T) - fvm::laplacian(K, T) - H ); TEqn().relax(); TEqn().solve(); } Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl; } After some more investigations, I noticed that the problem may be due to the coupling between interfaces. Indeed, the solidWallMixedTemperatureCoupled formulation calculates Twall as: Code:
scalarField Twall ( (myKDelta()*intFld() + nbrKDelta*nbrIntFld) / (myKDelta() + nbrKDelta) ); Code:
scalarField Twall ( (myKDelta()*intFld() + nbrKDelta*nbrIntFld + myHDelta()) / (myKDelta() + nbrKDelta) ); I am thinking that I need a more general review of solidWallMixedTemperatureCoupled.C, but I am asking for suggestions and hints before going further:
Regards, mad Last edited by maddalena; July 22, 2010 at 05:10. Reason: adding data |
|
July 21, 2010, 06:29 |
coupling conditions
|
#2 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Following a presentation of the coupling made by HRV, I ended up with the following.
In the case of coupling between two regions A and B, both of them with a heat source H, the coupling condition should be something like:
I was thinking to implement this as: Code:
tmp<scalarField> myHDelta = 2*H()/patch().deltaCoeffs(); this->refValue() = nbrIntFld; this->refGrad() = - myHDelta() / K(); this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta()); Is there anyone that can comment on that? Is this the right approach or am I on the wrong path? thank you mad. Last edited by maddalena; July 21, 2010 at 08:41. |
|
July 22, 2010, 05:09 |
comments? hints? ideas?
|
#3 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Ok, the ideas presented above were unsuccessful, probably due to my poor C++ and / or something on the math formulation of the problem that I am missing.
Someone else agrees with me that the solidWallMixedTemperatureCoupled is not general enough to allow a heat source inside one or more regions. Unfortunately, it seems like that everybody facing this problem has given up and turned to a fixedValue approach. That is what I probably will do as well, at least for the moment. On the other hand, I am really interested on a new coupling formulation, and I'd like to spend some of my time on it. However, I need some general ideas on how to approach the problem, since I am still not completely into it. The first step, for example, can be some comments on the ideas described above... regards, mad |
|
July 22, 2010, 05:28 |
|
#4 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi,
first I would suggest you to check if the problem is really the boundary condition, did you try to compute the continuity error? For "engineering" porpoise the coupling mixed condition gives good result, but maybe the source term is giving troubles, did you try to solve implicitly, using SuSp()? If the power source is generated also along the boundary, which maybe is unphysical, you should add it in the balancing eq. otherwise the original should do the trick. Andrea |
|
July 22, 2010, 06:00 |
|
#5 | |||
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hi Andrea and thank you for replying!
Quote:
Quote:
Quote:
cheers, mad |
||||
July 22, 2010, 06:39 |
|
#6 | |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi,
about source term read this: http://www.cfd-online.com/Forums/ope...r-details.html If you don't want source at boundary create a vol Field with 0 fixed value boundary condition and add it to the equation to be solved, maybe this is worth a try. To compute errors you should write your own little code... not too difficult. Quote:
Hope it helps Andrea Last edited by andrea; July 22, 2010 at 08:10. |
||
July 22, 2010, 09:58 |
|
#7 | |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hello,
Quote:
Code:
internalField uniform 500; boundaryField { SyCube { type symmetryPlane; value uniform 500; } FB { type empty; value uniform 0; } cube1_to_cube2 { type fixedValue; value uniform 0; } CyCube1 { type cyclic; } } I will try the SuSp() as soon as I understand where I should change the code.. cheers, mad |
||
July 23, 2010, 04:42 |
|
#8 | |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi,
ok then, I'm curious, how much this heat source is large? Have you tried to lower H's value and see if there's any hope to get convergence? Quote:
Code:
SuSp(H) Code:
H.SuSp() |
||
July 23, 2010, 08:08 |
|
#9 | ||
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hi Andrea,
Quote:
Some thoughts about that... Let us for a moment drop the heat source contribution and consider the (working) case if I impose a fixedValue temperature. From what I can understand, the solidWallMixedTemperatureValue copies the temperature value from the neighbour region, thus from the "cold" region, on my cell in the "warm" region. On the "cold" region, a zeroGradient BC is applied. In different (and easier) words the temperature of the "cold" region is diffused on the "warm" region and viceversa. This works fine if I do not have any heat source. When I add H, the contribution of the "cold" region on the "warm" region is not enough, since the temperature gradient obtained on the boundary cell by coping "cold" cell value onto the "warm" cell value is lower than the heat source contribution. In other words, the temperature diffusion in the "cold" region works fine, but not in the "warm" region. Therefore, the "warm" region is somewhat isolated from the outside, and its temperature increases until the simulation ends. This is, at least, the explanation I am giving to the weird results I am getting. Quote:
Code:
tmp<fvScalarMatrix> TEqn ( fvm::ddt(rho*cp, T) - fvm::laplacian(K, T) - fvm::Su(H) ); In the meanwhile, another question come into my mind. chtMultiRegionFoam is a compressible solver, while I want to consider my simulation as incompressible. May I get problems if I use it in my case? I would say no, but maybe there is something that I am missing. Thanks for your time, regards, mad Last edited by maddalena; July 23, 2010 at 08:10. Reason: typo |
|||
July 23, 2010, 09:01 |
|
#10 | |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi again,
maybe you know about that but there was a sort of "bug" in the coupling patch in previous releases of OF, in 1.5 was fixed. Quote:
I still would like to see the coupling error between the two patches, can you try something as Code:
Info << "error: "<<Ts[i].boundaryField()[patchNumber]-Tf[i].boundaryField()[patchNumber]<< endl; you're welcome, Andrea |
||
August 2, 2010, 06:05 |
|
#11 | ||||||
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hi Andrea,
Quote:
Quote:
Quote:
Quote:
Quote:
Still working on the heat source definition. This is the error I am getting when using fvm::Su(H, T): Quote:
regards, mad Last edited by maddalena; August 2, 2010 at 09:01. Reason: added error message |
|||||||
August 2, 2010, 08:51 |
|
#12 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi,
to check the coupling properly you should also check the heat flux, and for this you have to add two code lines , don't be too scared... If the heat is not flowing to the next regions of course the temperature will rise whatever the source implementation, I think you had a feeling about this too. I wait for some new updates, good luck! Andrea |
|
August 2, 2010, 09:01 |
|
#13 | ||
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Quote:
Quote:
In any case, where should I add the lines you suggested? In solidWallTemperatureCoupled.H or in chtMultiRegionFoam.H? Is Ts the solid temperature at the boundary and Tf the fluid temperature? If so, what does change if I add the lines or check the T value at the coupling region? mad |
|||
August 2, 2010, 10:24 |
|
#14 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Ok then,
from what I see it seems fine except for a little heat flux error, maybe not enough for a totally wrong simulation, is this error so little in the first time steps? The problem is that you get unrealistic too high values inside the source domain, right? I noticed that the coupling gives slower temperature rising than it should, maybe you "accumulate" too much heat in the beginning (I'm just thinking aloud now) Andrea |
|
August 2, 2010, 11:17 |
|
#15 | |||||
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hi andrea, and thank you to keep replying.
Quote:
Quote:
Quote:
1. the temperature is too high inside the source region. As a consequence, the temperature is too high inside the "cold" region as well. 2. The time vs temperature has not the theoretical tendency: in my simulation, I have a linear time vs temperature! Quote:
Quote:
1. from 0 to 25000 s with H = 5 W/m^3 2. from 25000 to 50000 s with H = 50 W/m^3 3. from 50000 to 100000 s with H = 500 W/m^3 no success. The only things that changes is the time vs temperature line angular coefficient. The theoretical curve rising is not matched. mad |
||||||
August 3, 2010, 05:54 |
|
#16 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Hi,
so the coupling seems to work, even if with the "small" enough error in heat flow that unlikely it is the problem. So what about the others boundary conditions? It seems that you possibly have a zeroGradient somewhere in the colder domain. Let me know. Bye Andrea |
|
August 3, 2010, 06:17 |
|
#17 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
Hello Andrea,
find attached a simple figure of my domain. I have zeroGradient BC on K, cp and H (heat source) both at the interface between cube1 and cube2 and on the other vertical patch. As you can see, the grid is rough: should this be a problem? I guess that the solution may be wrong to the poor grid quality, but not SO wrong... In the meanwhile, I found a working case. If I add the heat source to the multiRegionHeater tutorial, everything works as it should: time vs temperature is not linear but it has the well known curved tendency. Note that the grid is really really rough on the tutorial. I do not now if I should be happy with that (OF does not betray us) or not happy (there is something wrong with my model). In any case... In order to find what is wrong with it, I cross checked what changes between the two models (tutorial and my own model):
cheers, mad |
|
August 3, 2010, 06:43 |
|
#18 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
Well,
I agree with your analysis, and then the obviously thing to do is drop the cyclic patch type... then we can re-think on "why you cyclic?" fingers crossed Andrea |
|
August 3, 2010, 09:42 |
|
#19 |
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 |
So...
cheers, mad |
|
August 3, 2010, 09:59 |
|
#20 |
Member
Andrea Petronio
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 43
Rep Power: 17 |
ok,
don't loose your temper, the thing is weird but maybe we're still missing something. Can you post the case, along with the solution? I will take a look at it cheers Andrea |
|
Tags |
chtmultiregionfoam, coupling, heat source, interface |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Moving heat Source | AB | FLUENT | 2 | January 30, 2012 08:06 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
moving heat source | Mehdi | FLUENT | 0 | March 24, 2008 18:32 |
how to define volme heat source in udf ? | wanghong | FLUENT | 0 | February 24, 2006 04:53 |
heat source in a domain | aydin | FLUENT | 0 | January 3, 2003 08:01 |