mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
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
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -62,9 +62,15 @@ average
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
ssf.dimensions()
|
||||
dimensioned<Type>("0", ssf.dimensions(), Zero)
|
||||
)
|
||||
);
|
||||
|
||||
if (!mesh.nGeometricD())
|
||||
{
|
||||
return taverage;
|
||||
}
|
||||
|
||||
GeometricField<Type, fvPatchField, volMesh>& av = taverage.ref();
|
||||
|
||||
av.primitiveFieldRef() =
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -73,11 +73,19 @@ reconstruct
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
|
||||
mesh,
|
||||
dimensioned<GradType>("0", ssf.dimensions()/dimArea, Zero),
|
||||
extrapolatedCalculatedFvPatchField<GradType>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (!mesh.nGeometricD())
|
||||
{
|
||||
return treconField;
|
||||
}
|
||||
|
||||
treconField.ref() = inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
|
||||
|
||||
treconField.ref().correctBoundaryConditions();
|
||||
|
||||
return treconField;
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
@ -30,7 +30,7 @@ vertices
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user