Cumulative development and fixes. Vuko Vukcevic.

This commit is contained in:
Hrvoje Jasak 2019-01-30 14:46:17 +00:00
commit e1837adbf8
9 changed files with 59 additions and 405 deletions

View file

@ -2028,11 +2028,7 @@ void Foam::polyhedralRefinement::setCellsToRefine
// Get cell index // Get cell index
const label& cellI = refinementCellCandidates[i]; const label& cellI = refinementCellCandidates[i];
if if (roughCellCountAfterRefinement < maxCells_)
(
roughCellCountAfterRefinement < maxCells_
&& cellLevel_[cellI] < maxRefinementLevel_
)
{ {
// Mark cell for refinement // Mark cell for refinement
refineCell[cellI] = true; refineCell[cellI] = true;
@ -2049,6 +2045,15 @@ void Foam::polyhedralRefinement::setCellsToRefine
extendMarkedCellsAcrossFaces(refineCell); extendMarkedCellsAcrossFaces(refineCell);
} }
// Remove all cells that would exceed the maximum refinement level
forAll (refineCell, cellI)
{
if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_))
{
refineCell[cellI] = false;
}
}
// Make sure that the refinement is face consistent (2:1 consistency) and // Make sure that the refinement is face consistent (2:1 consistency) and
// point consistent (4:1 consistency) if necessary // point consistent (4:1 consistency) if necessary

View file

@ -2587,11 +2587,7 @@ void Foam::prismatic2DRefinement::setCellsToRefine
// Get cell index // Get cell index
const label& cellI = refinementCellCandidates[i]; const label& cellI = refinementCellCandidates[i];
if if (roughCellCountAfterRefinement < maxCells_)
(
roughCellCountAfterRefinement < maxCells_
&& cellLevel_[cellI] < maxRefinementLevel_
)
{ {
// Mark cell for refinement // Mark cell for refinement
refineCell[cellI] = true; refineCell[cellI] = true;
@ -2608,6 +2604,15 @@ void Foam::prismatic2DRefinement::setCellsToRefine
extendMarkedCellsAcrossFaces(refineCell); extendMarkedCellsAcrossFaces(refineCell);
} }
// Remove all cells that exceed the maximum refinement level
forAll (refineCell, cellI)
{
if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_))
{
refineCell[cellI] = false;
}
}
// Make sure that the refinement is face consistent (2:1 consistency) and // Make sure that the refinement is face consistent (2:1 consistency) and
// point consistent (4:1 consistency) if necessary // point consistent (4:1 consistency) if necessary

View file

@ -111,17 +111,9 @@ void Foam::refinement::extendMarkedCellsAcrossFaces
const label& own = owner[faceI]; const label& own = owner[faceI];
const label& nei = neighbour[faceI]; const label& nei = neighbour[faceI];
if (cellLevel_[own] < maxRefinementLevel_) // Mark owner and neighbour cells
{ markedCell[own] = true;
// Mark owner markedCell[nei] = true;
markedCell[own] = true;
}
if (cellLevel_[nei] < maxRefinementLevel_)
{
// Mark neighbour
markedCell[nei] = true;
}
} }
} }
@ -134,11 +126,8 @@ void Foam::refinement::extendMarkedCellsAcrossFaces
// exceeded // exceeded
const label& own = owner[faceI]; const label& own = owner[faceI];
if (cellLevel_[own] < maxRefinementLevel_) // Mark owner
{ markedCell[own] = true;
// Mark owner
markedCell[own] = true;
}
} }
} }
} }

View file

@ -271,11 +271,15 @@ bool Foam::dynamicPolyRefinementFvMesh::update()
( (
refinementSelectionPtr_->refinementCellCandidates()() refinementSelectionPtr_->refinementCellCandidates()()
); );
Pout<< "Selected " << refCandidates.size()
<< " refinement candidates." if (debug)
<< endl; {
Pout<< "Selected " << refCandidates.size()
<< " refinement candidates."
<< endl;
}
} }
else else if (debug)
{ {
Pout<< "Skipping refinement for this time-step..." << endl; Pout<< "Skipping refinement for this time-step..." << endl;
} }
@ -297,11 +301,15 @@ bool Foam::dynamicPolyRefinementFvMesh::update()
( (
refinementSelectionPtr_->unrefinementPointCandidates()() refinementSelectionPtr_->unrefinementPointCandidates()()
); );
Pout<< "Selected " << unrefCandidates.size()
<< " unrefinement candidates." if (debug)
<< endl; {
Pout<< "Selected " << unrefCandidates.size()
<< " unrefinement candidates."
<< endl;
}
} }
else else if (debug)
{ {
Pout<< "Skipping unrefinement for this time-step..." << endl; Pout<< "Skipping unrefinement for this time-step..." << endl;
} }
@ -344,13 +352,13 @@ bool Foam::dynamicPolyRefinementFvMesh::update()
// some topo changes // some topo changes
if (sizeCellMap) if (sizeCellMap)
{ {
Pout<< "Successfully performed polyhedral refinement. " Info<< "Successfully performed polyhedral refinement. "
<< "Changed from " << nOldCells << " to " << sizeCellMap << "Changed from " << nOldCells << " to " << sizeCellMap
<< " cells." << endl; << " cells." << endl;
} }
else else
{ {
Pout<< "Refinement/unrefinement not performed in this time step " Info<< "Refinement/unrefinement not performed in this time step "
<< "since no cells were selected." << endl; << "since no cells were selected." << endl;
} }
@ -362,7 +370,9 @@ bool Foam::dynamicPolyRefinementFvMesh::update()
// per time step // per time step
curTimeIndex_ = time().timeIndex(); curTimeIndex_ = time().timeIndex();
} }
Pout<< "No refinement/unrefinement" << endl;
Info<< "No refinement/unrefinement" << endl;
// No refinement/unrefinement at this time step. Return false // No refinement/unrefinement at this time step. Return false
return false; return false;
} }

View file

@ -182,7 +182,9 @@ void pointPatchInterpolation::interpolate
} }
} }
// Coupled boundaries already updated. Nothing to do. VV, 4/Dec/2017. // Bugfix: Must update boundary conditions for e.g. fixedValue that changes
// within e.g. fvMotion solver. Dario Zivkovic, 21/Dec/2018.
pf.correctBoundaryConditions();
if (debug) if (debug)
{ {

View file

@ -743,10 +743,10 @@ void Foam::GeometricField<Type, PatchField, GeoMesh>::storeOldTimes() const
) )
{ {
storeOldTime(); storeOldTime();
// Correct time index. Bug fix, Zeljko Tukovic 14/Jun/2010
timeIndex_ = this->time().timeIndex();
} }
// Correct time index. Bug fix, Zeljko Tukovic 14/Jun/2010
timeIndex_ = this->time().timeIndex();
} }
// Store old-time field // Store old-time field

View file

@ -140,6 +140,12 @@ public:
//- write the mesh //- write the mesh
void writeMesh() const; void writeMesh() const;
//- Access to polyMeshGen member
const polyMeshGen& mesh() const
{
return mesh_;
}
}; };

View file

@ -1,216 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "donorBasedLayeredFringe.H"
#include "oversetRegion.H"
#include "polyPatchID.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(donorBasedLayeredFringe, 0);
addToRunTimeSelectionTable
(
oversetFringe,
donorBasedLayeredFringe,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::donorBasedLayeredFringe::calcAddressing() const
{
if (fringeHolesPtr_ || acceptorsPtr_)
{
FatalErrorIn
(
"void Foam::donorBasedLayeredFringe::calcAddressing() const"
) << "Fringe addressing already calculated"
<< abort(FatalError);
}
// We need to wait for the fringe from donor region to finish the
// assembly. Simply create empty acceptor and fringe hole lists
acceptorsPtr_ = new labelList();
fringeHolesPtr_ = new labelList();
}
void Foam::donorBasedLayeredFringe::clearAddressing() const
{
deleteDemandDrivenData(fringeHolesPtr_);
deleteDemandDrivenData(acceptorsPtr_);
deleteDemandDrivenData(finalDonorAcceptorsPtr_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from dictionary
Foam::donorBasedLayeredFringe::donorBasedLayeredFringe
(
const fvMesh& mesh,
const oversetRegion& region,
const dictionary& dict
)
:
oversetFringe(mesh, region, dict),
fringeHolesPtr_(nullptr),
acceptorsPtr_(nullptr),
finalDonorAcceptorsPtr_(nullptr),
nLayers_(readLabel(dict.lookup("nLayers")))
{
// Sanity check for number of layers
if (nLayers_ < 1)
{
FatalErrorIn
(
"donorBasedLayeredFringe::donorBasedLayeredFringe\n"
"(\n"
" const fvMesh& mesh,\n"
" const oversetRegion& region,\n"
" const dictionary& dict,\n"
")\n"
) << "Invalid number of layers specified in donor based layered"
<< "fringe dictionary."
<< nl
<< "Please specify value between greater than 0."
<< endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::donorBasedLayeredFringe::~donorBasedLayeredFringe()
{
clearAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::donorBasedLayeredFringe::updateIteration
(
donorAcceptorList& donorAcceptorRegionData
) const
{
if (finalDonorAcceptorsPtr_)
{
FatalErrorIn("donorBasedLayeredFringe::updateIteration(donorAcceptorList&")
<< "finalDonorAcceptorPtr_ already allocated. Something went "
<< "wrong with the iteration procedure (flag was not updated)."
<< abort(FatalError);
}
// Get overset mesh
const oversetMesh& om = region().overset();
// Get list of donor regions of this overset region
const labelList& donorRegions = region().donorRegions();
// Check whether all donor regions have finished with the donor search
// Allocate the list by reusing the argument list
finalDonorAcceptorsPtr_ = new donorAcceptorList
(
donorAcceptorRegionData,
true
);
// Set the flag to true and return
updateSuitableOverlapFlag(true);
return foundSuitableOverlap();
}
const Foam::labelList& Foam::donorBasedLayeredFringe::fringeHoles() const
{
if (!fringeHolesPtr_)
{
calcAddressing();
}
return *fringeHolesPtr_;
}
const Foam::labelList& Foam::donorBasedLayeredFringe::candidateAcceptors() const
{
if (!acceptorsPtr_)
{
calcAddressing();
}
return *acceptorsPtr_;
}
Foam::donorAcceptorList& Foam::donorBasedLayeredFringe::finalDonorAcceptors() const
{
if (!finalDonorAcceptorsPtr_)
{
FatalErrorIn("donorBasedLayeredFringe::finalDonorAcceptors()")
<< "finalDonorAcceptorPtr_ not allocated. Make sure you have "
<< "called donorBasedLayeredFringe::updateIteration() before asking for "
<< "final set of donor/acceptor pairs."
<< abort(FatalError);
}
if (!foundSuitableOverlap())
{
FatalErrorIn("donorBasedLayeredFringe::finalDonorAcceptors()")
<< "Attemted to access finalDonorAcceptors but suitable overlap "
<< "has not been found. This is not allowed. "
<< abort(FatalError);
}
return *finalDonorAcceptorsPtr_;
}
void Foam::donorBasedLayeredFringe::update() const
{
if (updateFringe_)
{
Info<< "donorBasedLayeredFringe::update() const" << endl;
// Clear out
clearAddressing();
}
// Set flag to false and clear final donor/acceptors only
deleteDemandDrivenData(finalDonorAcceptorsPtr_);
updateSuitableOverlapFlag(false);
}
// ************************************************************************* //

View file

@ -1,147 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.1
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
donorBasedLayeredFringeFringe
Description
Fringe algorithm based on layered approach, where the acceptors of the
region are defined as neighbours of the donors toward the interior of the
region.
This is achieved by waiting for the acceptors of the donor region to be
found and then defining acceptors.
Author
Vuko Vukcevic, Wikki Ltd. All rights reserved.
SourceFiles
donorBasedLayeredFringeFringe.C
\*---------------------------------------------------------------------------*/
#ifndef donorBasedLayeredFringeFringe_H
#define donorBasedLayeredFringeFringe_H
#include "oversetFringe.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class donorBasedLayeredFringeFringe Declaration
\*---------------------------------------------------------------------------*/
class donorBasedLayeredFringeFringe
:
public oversetFringe
{
// Private data
//- Fringe hole cells
mutable labelList* fringeHolesPtr_;
//- Acceptor cells
mutable labelList* acceptorsPtr_;
//- Final donor/acceptor pairs for this region (fringe)
mutable donorAcceptorList* finalDonorAcceptorsPtr_;
//- Number of layers from donors to acceptors of this region
label nLayers_;
// Private Member Functions
//- Disallow default bitwise copy construct
donorBasedLayeredFringeFringe(const donorBasedLayeredFringeFringe&);
//- Disallow default bitwise assignment
void operator=(const donorBasedLayeredFringeFringe&);
// Calculate hole and acceptor addressing
void calcAddressing() const;
// Clear addressing
void clearAddressing() const;
public:
//- Runtime type information
TypeName("donorBasedLayeredFringe");
// Constructors
//- Construct from dictionary
donorBasedLayeredFringeFringe
(
const fvMesh& mesh,
const oversetRegion& region,
const dictionary& dict
);
// Destructor
virtual ~donorBasedLayeredFringeFringe();
// Member Functions
//- Update iteration. Note: invalidates parameter
virtual bool updateIteration
(
donorAcceptorList& donorAcceptorRegionData
) const;
//- Return list of deactivated (hole) cells
// Fringe hole cells are collected in addition to geometric hole
// cells, which fall outside of all donor regions
virtual const labelList& fringeHoles() const;
//- Return list of acceptor cells
virtual const labelList& candidateAcceptors() const;
//- Return list of final donor acceptor pairs. Note: caller may
// invalidate finalDonorAcceptorsPtr_ for optimisation purposes
virtual donorAcceptorList& finalDonorAcceptors() const;
//- Update the fringe
virtual void update() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //