fvcAverage and fvcReconstruct: Return zero for 0-D cases
fvcAverage and fvcReconstruct both do divisions or inverses of surface summed fields. A single-cell zero-dimension case, has no genuine faces on which to sum, so surface sums are identically zero. This change detects this situation and returns a zero value instead of failing due to a divide by zero. This allows the multiphase test cases to be reduced to just one cell.
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -62,9 +62,15 @@ average
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
mesh,
|
mesh,
|
||||||
ssf.dimensions()
|
dimensioned<Type>("0", ssf.dimensions(), Zero)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!mesh.nGeometricD())
|
||||||
|
{
|
||||||
|
return taverage;
|
||||||
|
}
|
||||||
|
|
||||||
GeometricField<Type, fvPatchField, volMesh>& av = taverage.ref();
|
GeometricField<Type, fvPatchField, volMesh>& av = taverage.ref();
|
||||||
|
|
||||||
av.primitiveFieldRef() =
|
av.primitiveFieldRef() =
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -73,11 +73,19 @@ reconstruct
|
|||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
),
|
),
|
||||||
inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
|
mesh,
|
||||||
|
dimensioned<GradType>("0", ssf.dimensions()/dimArea, Zero),
|
||||||
extrapolatedCalculatedFvPatchField<GradType>::typeName
|
extrapolatedCalculatedFvPatchField<GradType>::typeName
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!mesh.nGeometricD())
|
||||||
|
{
|
||||||
|
return treconField;
|
||||||
|
}
|
||||||
|
|
||||||
|
treconField.ref() = inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
|
||||||
|
|
||||||
treconField.ref().correctBoundaryConditions();
|
treconField.ref().correctBoundaryConditions();
|
||||||
|
|
||||||
return treconField;
|
return treconField;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
@ -30,7 +30,7 @@ vertices
|
|||||||
|
|
||||||
blocks
|
blocks
|
||||||
(
|
(
|
||||||
hex (0 1 2 3 4 5 6 7) (1 2 1) simpleGrading (1 1 1)
|
hex (0 1 2 3 4 5 6 7) (1 1 1) simpleGrading (1 1 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
edges
|
edges
|
||||||
|
|||||||
Reference in New Issue
Block a user