mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
freestreamVelocity/Pressure BC: stabilise in the limit of mag(Up) = 0
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -131,13 +131,39 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
|
||||
UName_
|
||||
);
|
||||
|
||||
const Field<scalar> magUp = mag(Up);
|
||||
|
||||
const Field<vector>& nf = patch().nf();
|
||||
|
||||
Field<scalar>& vf = valueFraction();
|
||||
|
||||
if (supersonic_)
|
||||
{
|
||||
valueFraction() = 0.5 - 0.5*(Up & patch().nf())/mag(Up);
|
||||
forAll(vf, i)
|
||||
{
|
||||
if (magUp[i] > vSmall)
|
||||
{
|
||||
vf[i] = 0.5 - 0.5*(Up[i] & nf[i])/magUp[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
vf[i] = 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
valueFraction() = 0.5 + 0.5*(Up & patch().nf())/mag(Up);
|
||||
forAll(vf, i)
|
||||
{
|
||||
if (magUp[i] > vSmall)
|
||||
{
|
||||
vf[i] = 0.5 + 0.5*(Up[i] & nf[i])/magUp[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
vf[i] = 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mixedFvPatchField<scalar>::updateCoeffs();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -107,8 +107,23 @@ void Foam::freestreamVelocityFvPatchVectorField::updateCoeffs()
|
||||
}
|
||||
|
||||
const Field<vector>& Up = *this;
|
||||
const Field<scalar> magUp = mag(Up);
|
||||
|
||||
valueFraction() = 0.5 - 0.5*(Up & patch().nf())/mag(Up);
|
||||
const Field<vector>& nf = patch().nf();
|
||||
|
||||
Field<scalar>& vf = valueFraction();
|
||||
|
||||
forAll(vf, i)
|
||||
{
|
||||
if (magUp[i] > vSmall)
|
||||
{
|
||||
vf[i] = 0.5 - 0.5*(Up[i] & nf[i])/magUp[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
vf[i] = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
mixedFvPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user