均一的边界条件如何设置?
-
可以试试
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 //#}; }