Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-03-12 10:39:22 +01:00
45 changed files with 1838 additions and 920 deletions

View File

@ -38,7 +38,8 @@ Foam::scalar Foam::compressibleCourantNo
scalar CoNum = 0.0;
scalar meanCoNum = 0.0;
if (mesh.nInternalFaces())
//- Can have fluid domains with 0 cells so do not test.
//if (mesh.nInternalFaces())
{
surfaceScalarField SfUfbyDelta =
mesh.surfaceInterpolation::deltaCoeffs()

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
turbFoam
pisoFoam
Description
Transient solver for incompressible flow.
@ -40,15 +40,14 @@ Description
int main(int argc, char *argv[])
{
#include "setRootCase.H"
# include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -56,8 +55,8 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readPISOControls.H"
# include "CourantNo.H"
#include "readPISOControls.H"
#include "CourantNo.H"
// Pressure-velocity PISO corrector
{
@ -120,7 +119,7 @@ int main(int argc, char *argv[])
}
}
# include "continuityErrs.H"
#include "continuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();

View File

@ -131,6 +131,12 @@ castellatedMeshControls
level (3 3);
}
}
// Optional angle to detect small-large cell situation perpendicular
// to the surface. Is the angle of face w.r.t the local surface
// normal. Use on flat(ish) surfaces only. Otherwise
// leave out or set to negative number.
//perpendicularAngle 10;
}
}
@ -317,9 +323,10 @@ meshQualityControls
minTriangleTwist -1;
//- if >0 : preserve single cells with all points on the surface if the
// resulting volume after snapping is larger than minVolFraction times old
// volume. If <0 : delete always.
minVolFraction 0.1;
// resulting volume after snapping (by approximation) is larger than
// minVolCollapseRatio times old volume (i.e. not collapsed to flat cell).
// If <0 : delete always.
//minVolCollapseRatio 0.5;
// Advanced

View File

@ -102,6 +102,67 @@ Foam::label Foam::checkTopology
}
}
if (allTopology)
{
labelList nInternalFaces(mesh.nCells(), 0);
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
nInternalFaces[mesh.faceOwner()[faceI]]++;
nInternalFaces[mesh.faceNeighbour()[faceI]]++;
}
const polyBoundaryMesh& patches = mesh.boundaryMesh();
forAll(patches, patchI)
{
if (patches[patchI].coupled())
{
const unallocLabelList& owners = patches[patchI].faceCells();
forAll(owners, i)
{
nInternalFaces[owners[i]]++;
}
}
}
faceSet oneCells(mesh, "oneInternalFaceCells", mesh.nCells()/100);
faceSet twoCells(mesh, "twoInternalFacesCells", mesh.nCells()/100);
forAll(nInternalFaces, cellI)
{
if (nInternalFaces[cellI] <= 1)
{
oneCells.insert(cellI);
}
else if (nInternalFaces[cellI] == 2)
{
twoCells.insert(cellI);
}
}
label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
if (nOneCells > 0)
{
Info<< " <<Writing " << nOneCells
<< " cells with with single non-boundary face to set "
<< oneCells.name()
<< endl;
oneCells.write();
}
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
if (nTwoCells > 0)
{
Info<< " <<Writing " << nTwoCells
<< " cells with with single non-boundary face to set "
<< twoCells.name()
<< endl;
twoCells.write();
}
}
{
regionSplit rs(mesh);

View File

@ -65,10 +65,11 @@ SourceFiles
#include "className.H"
#include "fileName.H"
#include "volPointInterpolation.H"
#include "stringList.H"
#include "wordList.H"
#include "primitivePatch.H"
#include "PrimitivePatchInterpolation.H"
#include "volPointInterpolation.H"
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
@ -496,7 +497,6 @@ class vtkPV3Foam
void convertVolFields
(
const fvMesh&,
const volPointInterpolation&,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >&,
const IOobjectList&,
vtkMultiBlockDataSet* output
@ -507,7 +507,7 @@ class vtkPV3Foam
void convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>&,
const GeometricField<Type, pointPatchField, pointMesh>&,
autoPtr<GeometricField<Type, pointPatchField, pointMesh> >&,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>& decompLst

View File

@ -106,8 +106,6 @@ void Foam::vtkPV3Foam::convertVolFields
printMemory();
}
// Construct interpolation on the raw mesh
volPointInterpolation pInterp(mesh);
PtrList<PrimitivePatchInterpolation<primitivePatch> >
ppInterpList(mesh.boundaryMesh().size());
@ -127,23 +125,23 @@ void Foam::vtkPV3Foam::convertVolFields
convertVolFields<scalar>
(
mesh, pInterp, ppInterpList, objects, output
mesh, ppInterpList, objects, output
);
convertVolFields<vector>
(
mesh, pInterp, ppInterpList, objects, output
mesh, ppInterpList, objects, output
);
convertVolFields<sphericalTensor>
(
mesh, pInterp, ppInterpList, objects, output
mesh, ppInterpList, objects, output
);
convertVolFields<symmTensor>
(
mesh, pInterp, ppInterpList, objects, output
mesh, ppInterpList, objects, output
);
convertVolFields<tensor>
(
mesh, pInterp, ppInterpList, objects, output
mesh, ppInterpList, objects, output
);
if (debug)

View File

@ -34,6 +34,8 @@ InClass
#include "emptyFvPatchField.H"
#include "wallPolyPatch.H"
#include "faceSet.H"
#include "volPointInterpolation.H"
#include "vtkPV3FoamFaceField.H"
#include "vtkPV3FoamPatchField.H"
@ -43,7 +45,6 @@ template<class Type>
void Foam::vtkPV3Foam::convertVolFields
(
const fvMesh& mesh,
const volPointInterpolation& pInterp,
const PtrList<PrimitivePatchInterpolation<primitivePatch> >& ppInterpList,
const IOobjectList& objects,
vtkMultiBlockDataSet* output
@ -63,23 +64,22 @@ void Foam::vtkPV3Foam::convertVolFields
continue;
}
// Load field
GeometricField<Type, fvPatchField, volMesh> tf
(
*iter(),
mesh
);
tmp<GeometricField<Type, pointPatchField, pointMesh> > tptf
(
pInterp.interpolate(tf)
);
// Interpolated field (demand driven)
autoPtr<GeometricField<Type, pointPatchField, pointMesh> > ptfPtr;
// Convert activated internalMesh regions
convertVolFieldBlock
(
tf,
tptf(),
ptfPtr,
output,
partInfoVolume_,
regionPolyDecomp_
@ -89,7 +89,7 @@ void Foam::vtkPV3Foam::convertVolFields
convertVolFieldBlock
(
tf,
tptf(),
ptfPtr,
output,
partInfoCellZones_,
zonePolyDecomp_
@ -99,7 +99,7 @@ void Foam::vtkPV3Foam::convertVolFields
convertVolFieldBlock
(
tf,
tptf(),
ptfPtr,
output,
partInfoCellSets_,
csetPolyDecomp_
@ -258,46 +258,60 @@ void Foam::vtkPV3Foam::convertVolFields
}
}
template<class Type>
void Foam::vtkPV3Foam::convertVolFieldBlock
(
const GeometricField<Type, fvPatchField, volMesh>& tf,
const GeometricField<Type, pointPatchField, pointMesh>& ptf,
autoPtr<GeometricField<Type, pointPatchField, pointMesh> >& ptfPtr,
vtkMultiBlockDataSet* output,
const partInfo& selector,
const List<polyDecomp>& decompLst
)
{
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const label datasetNo = partDataset_[partId];
for (int partId = selector.start(); partId < selector.end(); ++partId)
{
const label datasetNo = partDataset_[partId];
if (datasetNo >= 0 && partStatus_[partId])
{
convertVolField
(
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
if (datasetNo >= 0 && partStatus_[partId])
{
convertVolField
(
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
convertPointField
(
ptf,
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
}
}
if (!ptfPtr.valid())
{
if (debug)
{
Info<< "convertVolFieldBlock interpolating:" << tf.name()
<< endl;
}
ptfPtr.reset
(
volPointInterpolation::New(tf.mesh()).interpolate(tf).ptr()
);
}
convertPointField
(
ptfPtr(),
tf,
output,
selector,
datasetNo,
decompLst[datasetNo]
);
}
}
}
template<class Type>
void Foam::vtkPV3Foam::convertVolField
(

View File

@ -115,7 +115,7 @@ int main(int argc, char *argv[])
}
Info<< "writing " << exportName;
if (scaleFactor > 0)
if (scaleFactor <= 0)
{
Info<< " without scaling" << endl;
}