CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Non uniform heat flux specification (http://www.cfd-online.com/Forums/openfoam-solving/59996-non-uniform-heat-flux-specification.html)

ankgupta8um March 26, 2006 01:22

Hello, I would like to spec
 
Hello,

I would like to specify a non-uniform heat flux on a boundary patch. The closest available boundary condition I could see in the documentation is that of "fixed gradient" specification. How can I implement non-uniform temperature gradient BC at the boundary ??
Thanks a lot in advance.

Regards,
Ankur

ankgupta8um March 26, 2006 19:17

Hello, I am stuck with my w
 
Hello,

I am stuck with my work at a point where I need to implement the non-uniform temperature gradients at my boundary patch. Any help in this regard would be highly appreciated.
Looking forward to the replies.

Regards,
Ankur

hjasak March 26, 2006 19:46

OK, so which bit don't you und
 
OK, so which bit don't you understand? If you just want to set it in the input file, do something like:

gradient nonuniform List<scalar>
30 (blah blah, 30 numbers);


If you want to set it from the code, just set the values, you've got one for each boundary face.

Enjoy,

Hrv

ankgupta8um March 27, 2006 02:28

Hello Hrv, Thank you for th
 
Hello Hrv,

Thank you for the input. I need to set the gradient directly in the code. In my case, the gradient is dependent on some variables. So, I want to get an expression for the gradient evaluated for all the boundary faces.
Basically, I am not able to figure out the variable name that I can use to set the temperature gradients. It would be great if you could please let me know the syntax that I can use to set the gradient (i.e., To set T, I can use T.boundaryField but I dont know what to use to set the temperature gradient).

Thanks,
Regards,
Ankur

eugene March 27, 2006 06:04

Guess you could could access i
 
Guess you could could access it via

T.boundaryField()[patchID].gradient() = <something>;

It might be necessary to cast the boundary to a fixedGradientFvPatchScalarField to be able to access the gradient member though.

IMO though, this is all a waste of time. You should reformulate this as a new boundary condition and add your function to the evaluate portion of the BC. Controlling the non-uniform heat-flux distribution through entries in the dictionary is much more general and elegant than hardcoding the lot into the top level code.

hjasak March 27, 2006 06:58

Aha, now I understand the ques
 
Aha, now I understand the question (thanks Eugene): yes, you do need a cast. It's done like this (for a scalar field):


fvPatchScalarFieldField& Tpatches = T.boundaryField();

if (isType<fixedgradientfvpatchscalarfield>(Tpatches[patchI].type()))
{
fixedGradientFvPatchScalarField& Tpatch =
refCast<fixedgradientfvpatchscalarfield>(Tpatches[patchI]);

Tpatch.gradient() = blah bla;

}

The explanation why you need to do this is pretty long but very very important and useful - please try to work it out (it's about virtual function interfaces).

Hope this helps,

Hrv

ankgupta8um March 27, 2006 11:55

Thanks Eugene and Hrv, I wi
 
Thanks Eugene and Hrv,

I will work on the suggestions and let you all know about it.

Thanks again!
Regards,
Ankur

sshyu June 4, 2006 23:24

Hrv, I have similar work to
 
Hrv,

I have similar work to be done. Except that the bc is for pressure, not temperature.
As my understanding, there are lots to be done. (Correct me if I am wrong.) So, would you possible to tell me which file that I can consult to?
I am using 1.2 version. Does what you wrote also apply to 1.2 version?
Thanx!

-Steven

hjasak June 5, 2006 09:02

Actually, this is all pretty e
 
Actually, this is all pretty easy and striaghtforward (at least for me) :-) You should still consider writing your own boundary conditions, because that is the proper way of solvung the problem.

Hrv

sshyu June 5, 2006 10:05

Hrv, Surely I'll write my o
 
Hrv,

Surely I'll write my own. Just thinking if there is an example available in OpenFoam source code.

Thanx!

ankgupta8um June 5, 2006 13:19

Hi Steven, You can pretty m
 
Hi Steven,

You can pretty much use the same block as written by Hrv above to implement the non-uniform gradients for pressure.
You will also need to include a couple of header files in your code to get that piece of code working.
Try it out.

-Ankur

sshyu June 5, 2006 21:47

Ankur, Thanx a million. I'
 
Ankur,

Thanx a million. I'll give it a try.

rafal October 1, 2006 14:40

small correction for this thre
 
small correction for this thread Hrv's post - Monday, March 27, 2006 - 03:58 am

instead of:
if (isType<fixedgradientfvpatchscalarfield>(Tpatches[patchI].type()))

there should be:

if(Tpatches[patchI].type() == "fixedGradient")

or nicer

if (isType<fixedgradientfvpatchscalarfield>(Tpatches[patchI]))

it took me some time to spot this mistake in my code. Hope my post will save some of your time.
PS.
fixedGradientFvPatchScalarField instead of fixedgradientfvpatchscalarfield above(something wrong with application that is formating posts-keep changing capital letters)

dinesh2n@gmail.com July 15, 2010 06:16

location of adding the code for variable heatWallFlux
 
Hi
I also need this variable wallHeatFlux concept. But I could not get where do I put that code mentioned by hjasak (post # 6 with some modification by rafal in post #13.).
Kindly somebody please let me know which file do I need to make modification and how to use (this variable heat loss across the wall) in the input file of any solver.

thank you
dinesh


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