mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge commit 'OpenCFD/master' into olesenm
This commit is contained in:
@ -247,6 +247,7 @@ public:
|
||||
inline const_iterator begin() const;
|
||||
inline const const_iterator& end() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
//- iterator returned by end()
|
||||
@ -254,7 +255,6 @@ private:
|
||||
|
||||
//- const_iterator returned by end()
|
||||
static const_iterator endConstIter_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ void Foam::transform
|
||||
}
|
||||
else
|
||||
{
|
||||
rtf = vector::zero;
|
||||
rtf = tf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
|
||||
forAll (bm, patchI)
|
||||
{
|
||||
if (bm[patchI].start() != nextPatchStart)
|
||||
if (bm[patchI].start() != nextPatchStart && !boundaryError)
|
||||
{
|
||||
boundaryError = true;
|
||||
|
||||
@ -547,7 +547,9 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
|
||||
<< " of type " << bm[patchI].type()
|
||||
<< ". The patch should start on face no " << nextPatchStart
|
||||
<< " and the patch specifies " << bm[patchI].start()
|
||||
<< "." << endl;
|
||||
<< "." << endl
|
||||
<< "Possibly consecutive patches have this same problem."
|
||||
<< " Suppressing future warnings." << endl;
|
||||
}
|
||||
|
||||
nextPatchStart += bm[patchI].size();
|
||||
|
||||
@ -413,6 +413,16 @@ private:
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
//- Determines cell zone from cell region information.
|
||||
bool calcRegionToZone
|
||||
(
|
||||
const label surfZoneI,
|
||||
const label ownRegion,
|
||||
const label neiRegion,
|
||||
|
||||
labelList& regionToCellZone
|
||||
) const;
|
||||
|
||||
//- Finds zone per cell. Uses topological walk with all faces
|
||||
// marked in namedSurfaceIndex regarded as blocked.
|
||||
void findCellZoneTopo
|
||||
@ -423,6 +433,12 @@ private:
|
||||
labelList& cellToZone
|
||||
) const;
|
||||
|
||||
void makeConsistentFaceIndex
|
||||
(
|
||||
const labelList& cellToZone,
|
||||
labelList& namedSurfaceIndex
|
||||
) const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
meshRefinement(const meshRefinement&);
|
||||
|
||||
@ -1011,20 +1011,24 @@ void Foam::meshRefinement::findCellZoneGeometric
|
||||
}
|
||||
|
||||
labelList neiCellZone(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
for
|
||||
(
|
||||
label faceI = mesh_.nInternalFaces();
|
||||
faceI < mesh_.nFaces();
|
||||
faceI++
|
||||
)
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
label own = mesh_.faceOwner()[faceI];
|
||||
neiCellZone[faceI-mesh_.nInternalFaces()] = cellToZone[own];
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
label ownZone = cellToZone[mesh_.faceOwner()[faceI]];
|
||||
neiCellZone[faceI-mesh_.nInternalFaces()] = ownZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
@ -1061,6 +1065,64 @@ void Foam::meshRefinement::findCellZoneGeometric
|
||||
}
|
||||
|
||||
|
||||
bool Foam::meshRefinement::calcRegionToZone
|
||||
(
|
||||
const label surfZoneI,
|
||||
const label ownRegion,
|
||||
const label neiRegion,
|
||||
|
||||
labelList& regionToCellZone
|
||||
) const
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// Check whether inbetween different regions
|
||||
if (ownRegion != neiRegion)
|
||||
{
|
||||
// Jump. Change one of the sides to my type.
|
||||
|
||||
// 1. Interface between my type and unset region.
|
||||
// Set region to keepRegion
|
||||
|
||||
if (regionToCellZone[ownRegion] == -2)
|
||||
{
|
||||
if (regionToCellZone[neiRegion] == surfZoneI)
|
||||
{
|
||||
// Face between unset and my region. Put unset
|
||||
// region into keepRegion
|
||||
regionToCellZone[ownRegion] = -1;
|
||||
changed = true;
|
||||
}
|
||||
else if (regionToCellZone[neiRegion] != -2)
|
||||
{
|
||||
// Face between unset and other region.
|
||||
// Put unset region into my region
|
||||
regionToCellZone[ownRegion] = surfZoneI;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (regionToCellZone[neiRegion] == -2)
|
||||
{
|
||||
if (regionToCellZone[ownRegion] == surfZoneI)
|
||||
{
|
||||
// Face between unset and my region. Put unset
|
||||
// region into keepRegion
|
||||
regionToCellZone[neiRegion] = -1;
|
||||
changed = true;
|
||||
}
|
||||
else if (regionToCellZone[ownRegion] != -2)
|
||||
{
|
||||
// Face between unset and other region.
|
||||
// Put unset region into my region
|
||||
regionToCellZone[neiRegion] = surfZoneI;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
// Finds region per cell. Assumes:
|
||||
// - region containing keepPoint does not go into a cellZone
|
||||
// - all other regions can be found by crossing faces marked in
|
||||
@ -1152,59 +1214,75 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
// Internal faces
|
||||
|
||||
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
|
||||
{
|
||||
label surfI = namedSurfaceIndex[faceI];
|
||||
|
||||
if (surfI != -1)
|
||||
{
|
||||
// Get cell zone that surface cells are in
|
||||
label surfZoneI = surfaceToCellZone[surfI];
|
||||
// Calculate region to zone from cellRegions on either side
|
||||
// of internal face.
|
||||
bool changedCell = calcRegionToZone
|
||||
(
|
||||
surfaceToCellZone[surfI],
|
||||
cellRegion[mesh_.faceOwner()[faceI]],
|
||||
cellRegion[mesh_.faceNeighbour()[faceI]],
|
||||
regionToCellZone
|
||||
);
|
||||
|
||||
// Check whether inbetween different regions
|
||||
label ownRegion = cellRegion[mesh_.faceOwner()[faceI]];
|
||||
label neiRegion = cellRegion[mesh_.faceNeighbour()[faceI]];
|
||||
changed = changed | changedCell;
|
||||
}
|
||||
}
|
||||
|
||||
if (ownRegion != neiRegion)
|
||||
// Boundary faces
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Get coupled neighbour cellRegion
|
||||
labelList neiCellRegion(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
// Jump. Change one of the sides to my type.
|
||||
label faceI = pp.start()+i;
|
||||
neiCellRegion[faceI-mesh_.nInternalFaces()] =
|
||||
cellRegion[mesh_.faceOwner()[faceI]];
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh_, neiCellRegion, false);
|
||||
|
||||
// 1. Interface between my type and unset region.
|
||||
// Set region to keepRegion
|
||||
// Calculate region to zone from cellRegions on either side of coupled
|
||||
// face.
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (regionToCellZone[ownRegion] == -2)
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
|
||||
label surfI = namedSurfaceIndex[faceI];
|
||||
|
||||
if (surfI != -1)
|
||||
{
|
||||
if (regionToCellZone[neiRegion] == surfZoneI)
|
||||
{
|
||||
// Face between unset and my region. Put unset
|
||||
// region into keepRegion
|
||||
regionToCellZone[ownRegion] = -1;
|
||||
changed = true;
|
||||
}
|
||||
else if (regionToCellZone[neiRegion] != -2)
|
||||
{
|
||||
// Face between unset and other region.
|
||||
// Put unset region into my region
|
||||
regionToCellZone[ownRegion] = surfZoneI;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
else if (regionToCellZone[neiRegion] == -2)
|
||||
{
|
||||
if (regionToCellZone[ownRegion] == surfZoneI)
|
||||
{
|
||||
// Face between unset and my region. Put unset
|
||||
// region into keepRegion
|
||||
regionToCellZone[neiRegion] = -1;
|
||||
changed = true;
|
||||
}
|
||||
else if (regionToCellZone[ownRegion] != -2)
|
||||
{
|
||||
// Face between unset and other region.
|
||||
// Put unset region into my region
|
||||
regionToCellZone[neiRegion] = surfZoneI;
|
||||
changed = true;
|
||||
}
|
||||
bool changedCell = calcRegionToZone
|
||||
(
|
||||
surfaceToCellZone[surfI],
|
||||
cellRegion[mesh_.faceOwner()[faceI]],
|
||||
neiCellRegion[faceI-mesh_.nInternalFaces()],
|
||||
regionToCellZone
|
||||
);
|
||||
|
||||
changed = changed | changedCell;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1258,6 +1336,88 @@ void Foam::meshRefinement::findCellZoneTopo
|
||||
}
|
||||
|
||||
|
||||
// Make namedSurfaceIndex consistent with cellToZone - clear out any blocked
|
||||
// faces inbetween same cell zone.
|
||||
void Foam::meshRefinement::makeConsistentFaceIndex
|
||||
(
|
||||
const labelList& cellToZone,
|
||||
labelList& namedSurfaceIndex
|
||||
) const
|
||||
{
|
||||
const labelList& faceOwner = mesh_.faceOwner();
|
||||
const labelList& faceNeighbour = mesh_.faceNeighbour();
|
||||
|
||||
for (label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
|
||||
{
|
||||
label ownZone = cellToZone[faceOwner[faceI]];
|
||||
label neiZone = cellToZone[faceNeighbour[faceI]];
|
||||
|
||||
if (ownZone == neiZone && namedSurfaceIndex[faceI] != -1)
|
||||
{
|
||||
namedSurfaceIndex[faceI] = -1;
|
||||
}
|
||||
else if (ownZone != neiZone && namedSurfaceIndex[faceI] == -1)
|
||||
{
|
||||
FatalErrorIn("meshRefinement::zonify()")
|
||||
<< "Different cell zones on either side of face " << faceI
|
||||
<< " at " << mesh_.faceCentres()[faceI]
|
||||
<< " but face not marked with a surface."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Get coupled neighbour cellZone
|
||||
labelList neiCellZone(mesh_.nFaces()-mesh_.nInternalFaces());
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
neiCellZone[faceI-mesh_.nInternalFaces()] =
|
||||
cellToZone[mesh_.faceOwner()[faceI]];
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh_, neiCellZone, false);
|
||||
|
||||
// Use coupled cellZone to do check
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (pp.coupled())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label faceI = pp.start()+i;
|
||||
|
||||
label ownZone = cellToZone[faceOwner[faceI]];
|
||||
label neiZone = neiCellZone[faceI-mesh_.nInternalFaces()];
|
||||
|
||||
if (ownZone == neiZone && namedSurfaceIndex[faceI] != -1)
|
||||
{
|
||||
namedSurfaceIndex[faceI] = -1;
|
||||
}
|
||||
else if (ownZone != neiZone && namedSurfaceIndex[faceI] == -1)
|
||||
{
|
||||
FatalErrorIn("meshRefinement::zonify()")
|
||||
<< "Different cell zones on either side of face "
|
||||
<< faceI << " at " << mesh_.faceCentres()[faceI]
|
||||
<< " but face not marked with a surface."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Split off unreachable areas of mesh.
|
||||
@ -2166,36 +2326,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
);
|
||||
}
|
||||
|
||||
//{
|
||||
// Pout<< "** finding out blocked faces." << endl;
|
||||
//
|
||||
// cellSet zonedCellsGeom(mesh_, "zonedCellsGeom", 100);
|
||||
// forAll(cellToZone, cellI)
|
||||
// {
|
||||
// if (cellToZone[cellI] >= 0)
|
||||
// {
|
||||
// zonedCellsGeom.insert(cellI);
|
||||
// }
|
||||
// }
|
||||
// Pout<< "Writing zoned cells to " << zonedCellsGeom.objectPath()
|
||||
// << endl;
|
||||
// zonedCellsGeom.write();
|
||||
//
|
||||
//
|
||||
// faceSet zonedFaces(mesh_, "zonedFaces", 100);
|
||||
// forAll(namedSurfaceIndex, faceI)
|
||||
// {
|
||||
// label surfI = namedSurfaceIndex[faceI];
|
||||
//
|
||||
// if (surfI != -1)
|
||||
// {
|
||||
// zonedFaces.insert(faceI);
|
||||
// }
|
||||
// }
|
||||
// Pout<< "Writing zoned faces to " << zonedFaces.objectPath() << endl;
|
||||
// zonedFaces.write();
|
||||
//}
|
||||
|
||||
// Set using walking
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -2212,6 +2342,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
}
|
||||
|
||||
|
||||
// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
|
||||
makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
|
||||
|
||||
|
||||
// Topochange container
|
||||
polyTopoChange meshMod(mesh_);
|
||||
|
||||
@ -2314,6 +2448,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
|
||||
mesh_.clearOut();
|
||||
}
|
||||
|
||||
// None of the faces has changed, only the zones. Still...
|
||||
updateMesh(map, labelList());
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@ -108,13 +108,13 @@ spectEddyVisc::spectEddyVisc
|
||||
|
||||
tmp<volScalarField> spectEddyVisc::k() const
|
||||
{
|
||||
volScalarField Eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
|
||||
volScalarField eps = 2*nuEff()*magSqr(symm(fvc::grad(U())));
|
||||
|
||||
return
|
||||
cK1_*pow(delta(), 2.0/3.0)*pow(Eps, 2.0/3.0)
|
||||
*exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(Eps, 1.0/3.0))
|
||||
- cK3_*pow(Eps*nu(), 1.0/2.0)
|
||||
*erfc(cK4_*pow(delta(), -2.0/3.0)*pow(Eps, -1.0/6.0));
|
||||
cK1_*pow(delta()*eps, 2.0/3.0)
|
||||
*exp(-cK2_*pow(delta(), -4.0/3.0)*nu()/pow(eps, 1.0/3.0))
|
||||
- cK3_*sqrt(eps*nu())
|
||||
*erfc(cK4_*pow(delta(), -2.0/3.0)*sqrt(nu())*pow(eps, -1.0/6.0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user