Skip to content

Commit

Permalink
MULES: Added optional boundaryExtremaCoeff
Browse files Browse the repository at this point in the history
This provides more flexibility in specifying the allowed internal and boundary
extrema.

For driftFluxFoam and other settling problems it is beneficial to set the
boundaryExtremaCoeff to 1 to allow rapid accumulation of the partials on the
bottom wall (which was the previous default behaviour) but this is not suitable
for many Euler-Euler cases for which a uniform etrema coefficient is preferable,
either 0 or a small value.

Now by default boundaryExtremaCoeff is set to extremaCoeff which defaults to 0
which provides the behaviour before

OpenFOAM-dev commit cb2bc60

and the driftFluxFoam tutorials have been updated adding

        boundaryExtremaCoeff 1;

to the MULES controls in fvSolution so reproduce the previous behaviour.
  • Loading branch information
Henry Weller committed Sep 27, 2018
1 parent 314336c commit 441b7e0
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 8 deletions.
24 changes: 24 additions & 0 deletions src/OpenFOAM/primitives/one/oneI.H
Expand Up @@ -41,6 +41,30 @@ public:
typedef arg2 type; typedef arg2 type;
}; };


template<class Type>
inline const Type& operator+(const Type& t, const one&)
{
return t + 1;
}

template<class Type>
inline const Type& operator+(const one&, const Type& t)
{
return 1 + t;
}

template<class Type>
inline const Type& operator-(const Type& t, const one&)
{
return t - 1;
}

template<class Type>
inline const Type& operator-(const one&, const Type& t)
{
return 1 - t;
}

inline const one& operator*(const one& o, const one&) inline const one& operator*(const one& o, const one&)
{ {
return o; return o;
Expand Down
30 changes: 26 additions & 4 deletions src/finiteVolume/fvMatrices/solvers/MULES/CMULESTemplates.C
Expand Up @@ -233,6 +233,20 @@ void Foam::MULES::limiterCorr
MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0) MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0)
); );


const scalar boundaryExtremaCoeff
(
MULEScontrols.lookupOrDefault<scalar>
(
"boundaryExtremaCoeff",
extremaCoeff
)
);

const scalar boundaryDeltaExtremaCoeff
(
max(boundaryExtremaCoeff - extremaCoeff, 0)
);

const labelUList& owner = mesh.owner(); const labelUList& owner = mesh.owner();
const labelUList& neighb = mesh.neighbour(); const labelUList& neighb = mesh.neighbour();
tmp<volScalarField::Internal> tVsc = mesh.Vsc(); tmp<volScalarField::Internal> tVsc = mesh.Vsc();
Expand Down Expand Up @@ -331,12 +345,20 @@ void Foam::MULES::limiterCorr
} }
else else
{ {
forAll(phiCorrPf, pFacei) // Add the optional additional allowed boundary extrema
if (boundaryDeltaExtremaCoeff > 0)
{ {
const label pfCelli = pFaceCells[pFacei]; forAll(phiCorrPf, pFacei)
{
const label pfCelli = pFaceCells[pFacei];

const scalar extrema =
boundaryDeltaExtremaCoeff
*(psiMax[pfCelli] - psiMin[pfCelli]);


psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiMax[pfCelli]); psiMaxn[pfCelli] += extrema;
psiMinn[pfCelli] = min(psiMinn[pfCelli], psiMin[pfCelli]); psiMinn[pfCelli] -= extrema;
}
} }
} }


Expand Down
30 changes: 26 additions & 4 deletions src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C
Expand Up @@ -224,6 +224,20 @@ void Foam::MULES::limiter
MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0) MULEScontrols.lookupOrDefault<scalar>("extremaCoeff", 0)
); );


const scalar boundaryExtremaCoeff
(
MULEScontrols.lookupOrDefault<scalar>
(
"boundaryExtremaCoeff",
extremaCoeff
)
);

const scalar boundaryDeltaExtremaCoeff
(
max(boundaryExtremaCoeff - extremaCoeff, 0)
);

const scalarField& psi0 = psi.oldTime(); const scalarField& psi0 = psi.oldTime();


const labelUList& owner = mesh.owner(); const labelUList& owner = mesh.owner();
Expand Down Expand Up @@ -330,12 +344,20 @@ void Foam::MULES::limiter
} }
else else
{ {
forAll(phiCorrPf, pFacei) // Add the optional additional allowed boundary extrema
if (boundaryDeltaExtremaCoeff > 0)
{ {
const label pfCelli = pFaceCells[pFacei]; forAll(phiCorrPf, pFacei)
{
const label pfCelli = pFaceCells[pFacei];

const scalar extrema =
boundaryDeltaExtremaCoeff
*(psiMax[pfCelli] - psiMin[pfCelli]);


psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiMax[pfCelli]); psiMaxn[pfCelli] += extrema;
psiMinn[pfCelli] = min(psiMinn[pfCelli], psiMin[pfCelli]); psiMinn[pfCelli] -= extrema;
}
} }
} }


Expand Down
2 changes: 2 additions & 0 deletions tutorials/multiphase/driftFluxFoam/RAS/dahl/system/fvSolution
Expand Up @@ -26,6 +26,8 @@ solvers
nLimiterIter 3; nLimiterIter 3;
alphaApplyPrevCorr yes; alphaApplyPrevCorr yes;


boundaryExtremaCoeff 1;

solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
tolerance 1e-6; tolerance 1e-6;
Expand Down
Expand Up @@ -26,6 +26,8 @@ solvers
nLimiterIter 3; nLimiterIter 3;
alphaApplyPrevCorr yes; alphaApplyPrevCorr yes;


boundaryExtremaCoeff 1;

solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
tolerance 1e-6; tolerance 1e-6;
Expand Down
Expand Up @@ -26,6 +26,8 @@ solvers
nLimiterIter 3; nLimiterIter 3;
alphaApplyPrevCorr yes; alphaApplyPrevCorr yes;


boundaryExtremaCoeff 1;

solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
tolerance 1e-6; tolerance 1e-6;
Expand Down

0 comments on commit 441b7e0

Please sign in to comment.