Skip to content
Permalink
Browse files

freestreamVelocity/Pressure BC: stabilise in the limit of mag(Up) = 0

  • Loading branch information...
Chris Greenshields
Chris Greenshields committed Feb 4, 2019
1 parent 015ad0a commit d3a02cff1e12d94010ee691b04f0ae54495a818b
@@ -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();
}

0 comments on commit d3a02cf

Please sign in to comment.
You can’t perform that action at this time.