CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   How to set the fixheatflux boundary condition (http://www.cfd-online.com/Forums/openfoam/81849-how-set-fixheatflux-boundary-condition.html)

LijieNPIC November 8, 2010 22:27

How to set the fixheatflux boundary condition
 
Hi all,
I know this topic has been discussed a lot before, but I still don't understand. I am going to set the fixedHeatFlux boundary.As you know, q=-k*Grad(T),where q is heat flux and k is thermal conductivity. Although q is known and the relationship between k and T is known, Grad(T) still cannot get. So the fixGradient boudary is useless for me. In this situation, how can I set the boundary condition?
Thanks a lot in advance.

alfa_8C November 10, 2010 06:43

hy,

This is the procedure:

- download the "groovyBC" contribution
- compile it

and insert the following as a T boundary condition:

WALL_HEATSOURCE (change it to the name of your BC )
{
type groovyBC;
value uniform 283;
valueExpression "283";
gradientExpression "gradT";
fractionExpression "0";
variables "heatFlux=2000;Cp0=1005;rho0=1.18;gradT=heatFl ux/(alphaEff * Cp0 * rho0);";
timelines (
);
}

- change the desired heatflux (a minus in front of the value would be a sink then)

- add the following lines to your controlDict:

libs ( "libOpenFOAM.so" "libgroovyBC.so" );

Thats it!

Have fun!

LijieNPIC November 10, 2010 10:00

Antonio Liggieri,
Thank you very much. I will have a try.

benk December 9, 2010 12:18

Code:

WALL_HEATSOURCE (change it to the name of your BC )
{
type groovyBC;
value uniform 283;
valueExpression "283";
gradientExpression "gradT";
fractionExpression "0";
variables "heatFlux=2000;Cp0=1005;rho0=1.18;gradT=heatFl ux/(alphaEff * Cp0 * rho0);";
timelines (
);
}

Is there a way to get groovyBC to read a dimensionedScalar? For example, instead of specifying Cp0 and rho0 in the "variables" string, I want to specify them in a Properties dictionary. I know groovyBC can access a volScalarField but I want to read in Cp0 and rho0 like:

Code:

dimensionedScalar Cp0(domainProperties.lookup("Cp0"));
and then have groovyBC access Cp0

Cyp December 9, 2010 14:15

hello!

is it possible to have a variable K with this BC ? If not, how can I do ??


Regards,
Cyp

benk December 9, 2010 14:23

Code:

is it possible to have a variable K with this BC ?
Yes. Just make your K a volScalarField and use:

Code:

variables "heatFlux=2000;Cp0=1005;rho0=1.18;gradT=heatFl ux/(K * Cp0 * rho0);";
I'm still interested in knowing if we can use dimensionedScalar with groovyBC though. A workaround is to create a volScalarField and populate it with the value of a dimensionedScalar, but this seems to be a bit of a waste.

alfa_8C December 10, 2010 10:21

Hello Ben,

yes that's possible. If I understand you aright, the thread I posted recently attached below, points out exactly your problem but with different fields... take a look at it..

************************************************** ******
since alphaEff = alphat (turbulent alpha) + alpha (laminar alpha),

and alphat as well as alpha is defined as volsclarfield in and thus present, the groovyBC expression can be modified as follows:

SURFACE_SOURCE
{
type groovyBC;
value uniform 283;
valueExpression "283";
gradientExpression "gradT";
fractionExpression "0";
variables "heatFlux=0.00000001;Cp0=1005;rho0=1.18;gradT= heat Flux/((alphat + alpha) * Cp0 * rho0);";
timelines (
);
}

Good Luck
Tony

benk December 10, 2010 12:16

Hi Tony, thanks. But what I want to do is have groovyBC read a dimensionedScalar not a volScalarField.


All times are GMT -4. The time now is 09:46.