こんにちわ
大学院修士1年の川崎と申します。
buoyantBoussinesqソルバーを用いて単相流RANS計算を行っています。
モデルは簡単に述べると、流路があり、一部を発熱領域(heatregion)としています。
fvOptionsのscalarcodedsourceを用い、heatregionに入熱をしたいのですが、発熱領域以外の場所にも入熱がされています。
以下にコードの一部を示します。
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website:
www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
heatSource
{
type scalarCodedSource;
name heatSource;
scalarCodedSourceCoeffs
{
selectionMode cellSet;
cellSet heatregion;
fields (T);
codeInclude
#{
#};
codeCorrect
#{
Pout<<"**codeCorrect**"<<endl;
#};
codeAddSup
#{
const scalarField& V = mesh_.V();
scalarField& TSource = eqn.source();
dimensionedScalar r
(
"r",
dimensionSet(0,1,0,0,0,0,0),
scalar(3.0)
) ;
const scalarField& cellx = sqrt((mesh_.C().component(0) + r)*(mesh_.C().component(0) + r)+(mesh_.C().component(1))*(mesh_.C().component(1)))-r;
forAll(cellx, i)
{
if ( cellx[i] < 0.015 )
{
TSource += - 6000*cellx[i]*V[i];
}
else
{
TSource += - 2000*cellx[i]*V[i];
}
};
#};
codeSetValue
#{
Pout<<"**codeSetValue**"<<endl;
#};
}
}
ネットで調べたところcodedsourceではselectionmodeをcellzoneに設定していても、allに適用されると書いてありました。
なにか良い方法はないでしょうか