# 均一的边界条件如何设置？

• 有没有人了解OF中非均一的边界条件如何设置？比如有一个竖直的壁面，壁面低端温度300K， 顶端温度800K， 壁面上温度线性变化，这种边界条件该如何设置呢？

• @搬运工不好当
我想设置通道表面热损失边界条件，和您的线性变化是一样的吗？？？该怎么设置呢？？

• 通道表面热损失边界条件

这个具体值得是什么边界条件？固定热通量流出？

• @赵一铭
CFX中是 通道表面热损失单位是W/m2

• @zhanghan

可以试试turbulentHeatFlux边界条件：

Fixed heat boundary condition to specify temperature gradient. Input heat source either specified in terms of an absolute power [W], or as a flux [W/m2].

Example usage:

hotWall
{
type            compressible::turbulentHeatFluxTemperature;
heatSource      flux;        // power [W]; flux [W/m2]
q               uniform 10;  // heat power or flux
kappa           fluidThermo; // calculate kappa=alphaEff*thermo.Cp
Qr              none;        // name of the radiative flux
value           uniform 300; // initial temperature value
}



• @赵一铭
感谢您，我打算试试！！

• @搬运工不好当

如果是OpenFOAM和OpenFOAM+，用codedFixedValue最方便：

    wall
{
type            codedFixedValue;
value           uniform 300; //default value
redirectType    linearTBC; //name of new BC type
code
#{
const vectorField& Cf = patch().Cf(); // get face center coordinate;
//assume the wall is a vertical wall
scalar ymax = max(Cf&vector(0,1,0)); // & is dot product
scalar ymin = min(Cf&vector(0,1,0));
// Info<<"ymax="<<ymax<<",ymin="<<ymin<<nl;

vectorField& vf = *this; // get the boundary field (List of vectors defined at face centers) to fill.
//temporal coordinate, type: scalar
scalar t =this->db().time().value(); // get time
// temporal term
// scalar tt = 1+0.1*sin(5*t);
scalar tt = 1.0;
forAll(Cf,faceI)
{
//spatial coordinates, type: scalar
//scalar x = Cf[faceI].x();
scalar y = Cf[faceI].y();
//scalar z = Cf[faceI].z();

vf[faceI] = ((y-ymin)/(ymax-ymin)*500+300)*tt;
}
#};

//I do not know why I need to add those things
//codeInclude
//#{
//    #include "fvCFD.H"
//#};

//codeOptions
//#{
//    -I\$(LIB_SRC)/finiteVolume/lnInclude
//#};
}