fvOptions2014年12月17日 | |
はじめにfvOptions について。 バージョンOpenFOAM 2.3.0 fvOptionsfvOptions により、方程式に対して様々な修正を適用できる。設定は system/fvOptions で行う。
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
fixedVelocity
{
type vectorExplicitSetValue;
active true;
selectionMode cellSet;
cellSet c0;
vectorExplicitSetValueCoeffs
{
injectionRate
{
U (0 10 0);
}
}
}
"fixedVelocity" は名前で、好きにつけてよい。 type には以下のものが指定できる。
selectionMode には、以下のものを指定できる。
タイプにはそれぞれ設定が必要で、たとえば vectorExplicitSetValue であればタイプ名の最後に Coeffs を付けた "vectorExplicitSetValueCoeffs" が設定として参照される。 vectorExplicitSetValue値を設定する。
fixedVelocity
{
type vectorExplicitSetValue;
active true;
selectionMode cellSet;
cellSet c0;
vectorExplicitSetValueCoeffs
{
injectionRate
{
U (0 10 0);
}
}
}
![]() scalarExplicitSetValue なども同様。 vectorSemiImplicitSource方程式のソース項を設定する。
velocitySource
{
type vectorSemiImplicitSource;
active true;
selectionMode cellSet;
cellSet c0;
vectorSemiImplicitSourceCoeffs
{
volumeMode absolute;
injectionRateSuSp
{
U ((0 0.001 0) 0);
}
}
}
![]() volumeMode には以下のものを設定できる。
injectionRateSuSp のでは、(Su Sp) の形で値を指定する。ここで、ソース項は以下の形を想定している。 S(x) = Su + Sp x vectorCodedSourceソース項をコードにより設定する。
velocitySource
{
type vectorCodedSource;
active true;
selectionMode cellSet;
cellSet c0;
vectorCodedSourceCoeffs
{
fieldNames (U);
redirectType velocitySource;
codeCorrect
#{
#};
codeAddSup
#{
#};
codeSetValue
#{
cellSet selectedCells(mesh_, cellSetName_);
labelList cells = selectedCells.toc();
vectorField values(cells.size());
values = vector(0, 10, 0);
eqn.setValues(cells, values);
#};
code
#{
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
velocitySourceCoeffs
{
}
}
![]()
velocitySource
{
type vectorCodedSource;
active true;
selectionMode cellSet;
cellSet c0;
vectorCodedSourceCoeffs
{
fieldNames (U);
redirectType velocitySource;
codeCorrect
#{
#};
codeAddSup
#{
cellSet selectedCells(mesh_, cellSetName_);
labelList cells = selectedCells.toc();
scalar V = 0.0;
forAll(cells, i)
{
V += mesh_.V()[cells_[i]];
}
reduce(V, sumOp<scalar>());
DimensionedField<vector, volMesh> Su
(
IOobject
(
"Su",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<vector>
(
"zero",
eqn.dimensions()/dimVolume,
pTraits<vector>::zero
),
false
);
UIndirectList<vector>(Su, cells) = vector(0, 0.001, 0)/V;
eqn += Su;
#};
codeSetValue
#{
#};
code
#{
$codeCorrect
$codeAddSup
$codeSetValue
#};
}
velocitySourceCoeffs
{
}
}
![]() redirectType には好きな名前を付ける。 pressureGradientExplicitSource圧力勾配を設定する。
pressureGradient
{
type pressureGradientExplicitSource;
active true;
selectionMode cellSet;
cellSet c0;
pressureGradientExplicitSourceCoeffs
{
fieldNames (U); // name of velocity field
Ubar (20.0 0 0); // desired average velocity
gradPini gradPini [0 2 -2 0 0] 0; // initial pressure gradient
flowDir (1 0 0); // flow direction
}
}
![]() explicitPorositySource多孔質体抵抗を設定する。
porosity
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone c0;
explicitPorositySourceCoeffs
{
type DarcyForchheimer;
DarcyForchheimerCoeffs
{
d d [0 -2 0 0 0 0 0] (5e7 -1000 -1000);
f f [0 -1 0 0 0 0 0] (0 0 0);
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
}
}
}
}
}
![]()
porosity
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone c0;
explicitPorositySourceCoeffs
{
type fixedCoeff;
fixedCoeffCoeffs
{
alpha alpha [0 0 -1 0 0 0 0] (500 -1000 -1000);
beta beta [0 -1 0 0 0 0 0] (0 0 0);
rhoRef 1;
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
}
}
}
}
}
![]()
porosity
{
type explicitPorositySource;
active true;
selectionMode cellZone;
cellZone c0;
explicitPorositySourceCoeffs
{
type powerLaw;
powerLawCoeffs
{
C0 500;
C1 1;
coordinateSystem
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0.70710678 0.70710678 0);
e2 (0 0 1);
}
}
}
}
}
![]() selectionMode は cellZone である必要があるらしい。 多孔質体抵抗には以下のタイプがある。
DarcyForchheimer の抵抗は、次式の Darcy-Forchheimer 則で与えられる。 Si = -(μ D + 1/2 ρ |u| F) ui ここで Si は運動方程式のソース項の i 成分、μ は粘性係数、ρ は密度、u は速度ベクトル、ui は u の i 成分である。D と F は係数で、ユーザーが指定する。 fixedCoeff の抵抗は次式で表される。 Si = - rho_ref (alpha + beta |u|) ui rho_ref, alpha, beta は係数である。 powerLaw はべき乗則で、抵抗は次式で表される。 Si = -ρ C0 |u|^((C1 - 1)/2) C0, C1 が指定すべき係数である。 coordinateSystem は座標系の定義で、以下のタイプを指定できる。
coordinateRotation のタイプには以下のものがある。
axesRotation では (e1, e2) あるいは (e2, e3) あるいは (e3, e1) の指定が必要。 fixedTemperatureConstraint温度を固定する。
fixedTemperature
{
type fixedTemperatureConstraint;
active true;
selectionMode cellSet;
cellSet c0;
fixedTemperatureConstraintCoeffs
{
mode uniform;
temperature 500;
}
}
![]() boussinesq ソルバーでは使えないらしい。 mode には以下のものがある。
| |
| PENGUINITIS | |