fvcSmooth: The alpha field discriminant parameters are now optional arguments

This commit is contained in:
Henry
2010-11-01 11:07:08 +00:00
parent f12b86310f
commit 03f0092cef
2 changed files with 32 additions and 18 deletions

View File

@ -123,7 +123,10 @@ void Foam::fvc::spread
( (
volScalarField& field, volScalarField& field,
const volScalarField& alpha, const volScalarField& alpha,
const label nLayers const label nLayers,
const scalar alphaDiff,
const scalar alphaMax,
const scalar alphaMin
) )
{ {
const fvMesh& mesh = field.mesh(); const fvMesh& mesh = field.mesh();
@ -153,11 +156,11 @@ void Foam::fvc::spread
if if
( (
(alpha[own] > 0.01 && alpha[own] < 0.99) (alpha[own] > alphaMin && alpha[own] < alphaMax)
|| (alpha[nbr] > 0.01 && alpha[nbr] < 0.99) || (alpha[nbr] > alphaMin && alpha[nbr] < alphaMax)
) )
{ {
if (mag(alpha[own] - alpha[nbr]) > 0.2) if (mag(alpha[own] - alpha[nbr]) > alphaDiff)
{ {
changedFaces.append(facei); changedFaces.append(facei);
changedFacesInfo.append changedFacesInfo.append
@ -185,11 +188,14 @@ void Foam::fvc::spread
if if
( (
(alpha[own] > 0.01 && alpha[own] < 0.99) (alpha[own] > alphaMin && alpha[own] < alphaMax)
|| (alphapn[patchFacei] > 0.01 && alphapn[patchFacei] < 0.99) || (
alphapn[patchFacei] > alphaMin
&& alphapn[patchFacei] < alphaMax
)
) )
{ {
if (mag(alpha[own] - alphapn[patchFacei]) > 0.2) if (mag(alpha[own] - alphapn[patchFacei]) > alphaDiff)
{ {
changedFaces.append(facei); changedFaces.append(facei);
changedFacesInfo.append(smoothData(field[own])); changedFacesInfo.append(smoothData(field[own]));
@ -227,7 +233,8 @@ void Foam::fvc::sweep
( (
volScalarField& field, volScalarField& field,
const volScalarField& alpha, const volScalarField& alpha,
const label nLayers const label nLayers,
const scalar alphaDiff
) )
{ {
const fvMesh& mesh = field.mesh(); const fvMesh& mesh = field.mesh();
@ -250,7 +257,7 @@ void Foam::fvc::sweep
const label own = owner[facei]; const label own = owner[facei];
const label nbr = neighbour[facei]; const label nbr = neighbour[facei];
if (mag(alpha[own] - alpha[nbr]) > 0.2) if (mag(alpha[own] - alpha[nbr]) > alphaDiff)
{ {
changedFaces.append(facei); changedFaces.append(facei);
changedFacesInfo.append changedFacesInfo.append
@ -275,7 +282,7 @@ void Foam::fvc::sweep
scalarField alphapn = scalarField alphapn =
alpha.boundaryField()[patchi].patchNeighbourField(); alpha.boundaryField()[patchi].patchNeighbourField();
if (mag(alpha[own] - alphapn[patchFacei]) > 0.2) if (mag(alpha[own] - alphapn[patchFacei]) > alphaDiff)
{ {
changedFaces.append(facei); changedFaces.append(facei);
changedFacesInfo.append changedFacesInfo.append

View File

@ -28,15 +28,18 @@ Description
Provides functions smooth spread and sweep which use the FaceCellWave Provides functions smooth spread and sweep which use the FaceCellWave
algorithm to smooth and redistribute the first field argument. algorithm to smooth and redistribute the first field argument.
smooth: smooths the field by ensuring the values in neighbouring smooth: smooths the field by ensuring the values in neighbouring cells are
cells are at least coeff* the cell value. at least coeff* the cell value.
spread: redistributes the field by spreading the maximum value within spread: redistributes the field by spreading the maximum value within the
the region defined by the value and gradient of alpha. region defined by the value (being between alphaMax and alphaMin)
and gradient of alpha (where the difference between the values in
neighbouring cells is larger than alphaDiff).
sweep: redistributes the field by sweeping the maximum value where the sweep: redistributes the field by sweeping the maximum value where the
gradient of alpha is large away from that starting point of the gradient of alpha is large (where the difference between the values
sweep. in neighbouring cells is larger than alphaDiff) away from that
starting point of the sweep.
SourceFiles SourceFiles
fvcSmooth.C fvcSmooth.C
@ -64,14 +67,18 @@ namespace fvc
( (
volScalarField& field, volScalarField& field,
const volScalarField& alpha, const volScalarField& alpha,
const label nLayers const label nLayers,
const scalar alphaDiff = 0.2,
const scalar alphaMax = 0.99,
const scalar alphaMin = 0.01
); );
void sweep void sweep
( (
volScalarField& field, volScalarField& field,
const volScalarField& alpha, const volScalarField& alpha,
const label nLayers const label nLayers,
const scalar alphaDiff = 0.2
); );
} }
} }