#201921
之前,我们讨论过 inletOutlet 边界,提到, inletOutlet
基本上与 zeroGradient
相同,但是,如果该边界的网格的速度指向内部时,其设置为 fixedValue
(backward flow). fixedValue
的值是 inletValue
. 而 pressureInletVelocity
是指,在压力已知的边界上,入流速度是通过边界上的通量来计算的。设置的格式为
pB
{
type pressureInletVelocity;
phi phi;
rho rho;
value uniform 0; // 边界上压力的大小
}
最近,我们一直在聊边界的事,边界上四个系数是如何确定的呢?代码位于 src/finiteVolume/fields/fvPatchFields/derived/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
:
void Foam::pressureInletVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); // 法向量
const Field<scalar>& magS = patch().magSf();
if (phi.dimensions() == dimVelocity*dimArea) // 运算操作
{
operator==(n*phip/magS); // 法向量*通量/面积
}
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(n*phip/(rhop*magS)); // 法向量*通量/密度/面积
}
else
{
FatalErrorInFunction
<< "dimensions of phi are not correct"
<< "\n on patch " << this->patch().name()
<< " of field " << this->internalField().name()
<< " in file " << this->internalField().objectPath()
<< exit(FatalError);
}
fixedValueFvPatchVectorField::updateCoeffs();
}
但是从头文件看到,pressureInletVelocity
继承自 fixedValue
class pressureInletVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Flux field name
word phiName_;
//- Density field name
word rhoName_;
public:
//- Runtime type information
TypeName("pressureInletVelocity");
...