#201920
symmetryPlane
是在 CFD 仿真分析中经常用到的一个边界,对于标量和向量场,均可以指定为 symmetryPlane
. 如:
boundaryA
{
type symmetryPlane;
}
symmetryPlane 的四个参数来自于 transformFvPatchField.C,但是其中的 snGrad() 和 snGradTransformDiag()
则是来自于 symmetryPlaneFvPatchField.C:
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::symmetryPlaneFvPatchField<Type>::snGrad() const
{
vector nHat(symmetryPlanePatch_.n());
const Field<Type> iF(this->patchInternalField());
return
(transform(I - 2.0*sqr(nHat), iF) - iF)
*(this->patch().deltaCoeffs()/2.0);
}
template<class Type>
void Foam::symmetryPlaneFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
if (!this->updated())
{
this->updateCoeffs();
}
vector nHat(symmetryPlanePatch_.n());
const Field<Type> iF(this->patchInternalField());
Field<Type>::operator=
(
(iF + transform(I - 2.0*sqr(nHat), iF))/2.0
);
transformFvPatchField<Type>::evaluate();
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::symmetryPlaneFvPatchField<Type>::snGradTransformDiag() const
{
vector nHat(symmetryPlanePatch_.n());
const vector diag
(
mag(nHat.component(vector::X)),
mag(nHat.component(vector::Y)),
mag(nHat.component(vector::Z))
);
return tmp<Field<Type>>
(
new Field<Type>
(
this->size(),
transformMask<Type>
(
//pow<vector, pTraits<Type>::rank>(diag)
pow
(
diag,
pTraits<typename powProduct<vector, pTraits<Type>::rank>
::type>::zero
)
)
)
);
}
transformFvPatchField.C
里面的代码:
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFvPatchField<Type>::valueInternalCoeffs
(
const tmp<scalarField>&
) const
{
return pTraits<Type>::one - snGradTransformDiag();
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFvPatchField<Type>::valueBoundaryCoeffs
(
const tmp<scalarField>&
) const
{
return
*this
- cmptMultiply
(
valueInternalCoeffs(this->patch().weights()),
this->patchInternalField()
);
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFvPatchField<Type>::gradientInternalCoeffs() const
{
return -this->patch().deltaCoeffs()*snGradTransformDiag();
}
template<class Type>
Foam::tmp<Foam::Field<Type>>
Foam::transformFvPatchField<Type>::gradientBoundaryCoeffs() const
{
return
snGrad()
- cmptMultiply(gradientInternalCoeffs(), this->patchInternalField());
}
对称面的 snGrad 为
[(\mathbf{I}-2\sqrt{\hat{n}})\varphi_c - \varphi_c]\times\frac{\text{deltaCoeffs()}}{2}
snGradTransformDiag 为
(\hat{n})^0
所以,symmetryPlane 边界的四个系数为
Coefficient | function | Expression |
---|---|---|
A_1 | valueInternalCoeffs | 1-\hat{n} |
B_1 | valueBoundaryCoeffs | \varphi_c - (1-\hat{n})\cdot\phi_c |
A_2 | gradientInternalCoeffs | -\text{deltaCoeffs()} \hat{n} |
B_2 | gradientBoundaryCoeffs | [(\mathbf{I}-2\sqrt{\hat{n}})\varphi_c - \varphi_c]\times\frac{\text{deltaCoeffs()}}{2} + (\text{deltaCoeffs()} \hat{n})\cdot\varphi_c |