mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -87,7 +87,7 @@
|
||||
forAll(Y, i)
|
||||
{
|
||||
Y[i] = Y0[i];
|
||||
h0 += Y0[i]*specieData[i].Hs(p[i], T0);
|
||||
h0 += Y0[i]*specieData[i].Hs(p[0], T0);
|
||||
}
|
||||
|
||||
thermo.he() = dimensionedScalar("h", dimEnergy/dimMass, h0);
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
EXE_INC = \
|
||||
-I../buoyantBoussinesqSimpleFoam \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
|
||||
@ -9,6 +12,8 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lsampling \
|
||||
-lmeshTools \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
|
||||
@ -11,12 +11,18 @@
|
||||
- fvm::laplacian(alphaEff, T)
|
||||
==
|
||||
radiation->ST(rhoCpRef, T)
|
||||
+ fvOptions(T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
fvOptions.constrain(TEqn);
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
radiation->correct();
|
||||
|
||||
fvOptions.correct(T);
|
||||
|
||||
rhok = 1.0 - beta*(T - TRef);
|
||||
}
|
||||
|
||||
@ -5,10 +5,14 @@
|
||||
fvm::ddt(U)
|
||||
+ fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
==
|
||||
fvOptions(U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
@ -23,4 +27,6 @@
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
|
||||
@ -48,8 +48,9 @@ Description
|
||||
#include "fvCFD.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "radiationModel.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,6 +62,7 @@ int main(int argc, char *argv[])
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createIncompressibleRadiationModel.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/RAS/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
@ -7,7 +10,9 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lsampling \
|
||||
-lmeshTools \
|
||||
-lfvOptions \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleTransportModels
|
||||
|
||||
@ -8,10 +8,17 @@
|
||||
(
|
||||
fvm::div(phi, T)
|
||||
- fvm::laplacian(alphaEff, T)
|
||||
==
|
||||
fvOptions(T)
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
|
||||
fvOptions.constrain(TEqn);
|
||||
|
||||
TEqn.solve();
|
||||
|
||||
fvOptions.correct(T);
|
||||
|
||||
rhok = 1.0 - beta*(T - TRef);
|
||||
}
|
||||
|
||||
@ -4,16 +4,20 @@
|
||||
(
|
||||
fvm::div(phi, U)
|
||||
+ turbulence->divDevReff(U)
|
||||
==
|
||||
fvOptions(U)
|
||||
);
|
||||
|
||||
UEqn().relax();
|
||||
|
||||
fvOptions.constrain(UEqn());
|
||||
|
||||
if (simple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
UEqn()
|
||||
==
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
@ -22,4 +26,6 @@
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
|
||||
@ -48,6 +48,7 @@ Description
|
||||
#include "fvCFD.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -59,6 +60,7 @@ int main(int argc, char *argv[])
|
||||
#include "createMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
@ -26,21 +26,18 @@ Application
|
||||
|
||||
Description
|
||||
Combination of heatConductionFoam and buoyantFoam for conjugate heat
|
||||
transfer between a solid region and fluid region. It includes
|
||||
porous media in the primary fluid region treated explicitly.
|
||||
transfer between solid regions and fluid regions. Both regions include
|
||||
the fvOptions framework.
|
||||
|
||||
It handles secondary fluid or solid circuits which can be coupled
|
||||
thermally with the main fluid region. i.e radiators, etc.
|
||||
|
||||
The secondary fluid region is
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "rhoThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "fixedGradientFvPatchFields.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "regionProperties.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "solidRegionDiffNo.H"
|
||||
|
||||
@ -30,7 +30,7 @@ Description
|
||||
|
||||
Sub-models include:
|
||||
- turbulence modelling, i.e. laminar, RAS or LES
|
||||
- run-time selectable finitie volume options, e.g. MRF, explicit porosity
|
||||
- run-time selectable finite volume options, e.g. MRF, explicit porosity
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@ -35,116 +35,6 @@ Description
|
||||
#include "meshTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
void checkConnectedAgglomeration
|
||||
(
|
||||
const lduMesh& mesh,
|
||||
const labelUList& restrict,
|
||||
const label nCoarse
|
||||
)
|
||||
{
|
||||
if (mesh.lduAddr().size() != restrict.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"checkConnectedAgglomeration(const lduMesh&, const labelList&)"
|
||||
) << "nCells:" << mesh.lduAddr().size()
|
||||
<< " agglom:" << restrict.size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Seed (master) for every region
|
||||
labelList regionToMaster(nCoarse, -1);
|
||||
labelList master(mesh.lduAddr().size(), -1);
|
||||
forAll(restrict, cellI)
|
||||
{
|
||||
label region = restrict[cellI];
|
||||
if (regionToMaster[region] == -1)
|
||||
{
|
||||
// Set cell to be master for region
|
||||
//Pout<< "For region " << region
|
||||
// << " allocating local master " << cellI
|
||||
// << endl;
|
||||
regionToMaster[region] = cellI;
|
||||
master[cellI] = cellI;
|
||||
}
|
||||
}
|
||||
|
||||
// Now loop and transport master through region
|
||||
const labelUList& lower = mesh.lduAddr().lowerAddr();
|
||||
const labelUList& upper = mesh.lduAddr().upperAddr();
|
||||
|
||||
while (true)
|
||||
{
|
||||
label nChanged = 0;
|
||||
|
||||
forAll(lower, faceI)
|
||||
{
|
||||
label own = lower[faceI];
|
||||
label nei = upper[faceI];
|
||||
|
||||
if (restrict[own] == restrict[nei])
|
||||
{
|
||||
// Region-internal face
|
||||
|
||||
if (master[own] != -1)
|
||||
{
|
||||
if (master[nei] == -1)
|
||||
{
|
||||
master[nei] = master[own];
|
||||
nChanged++;
|
||||
}
|
||||
else if (master[nei] != master[own])
|
||||
{
|
||||
FatalErrorIn("checkConnectedAgglomeration(..)")
|
||||
<< "problem" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
else if (master[nei] != -1)
|
||||
{
|
||||
master[own] = master[nei];
|
||||
nChanged++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nChanged, sumOp<label>());
|
||||
|
||||
if (nChanged == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check that master is set for all cells
|
||||
boolList singleRegion(nCoarse, true);
|
||||
label nSet = nCoarse;
|
||||
forAll(master, cellI)
|
||||
{
|
||||
if (master[cellI] == -1)
|
||||
{
|
||||
label region = restrict[cellI];
|
||||
if (singleRegion[region] == true)
|
||||
{
|
||||
singleRegion[region] = false;
|
||||
nSet--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label totalNCoarse = returnReduce(nCoarse, sumOp<label>());
|
||||
label totalNVisited = returnReduce(nSet, sumOp<label>());
|
||||
|
||||
if (totalNVisited < totalNCoarse)
|
||||
{
|
||||
WarningIn("checkConnectedAgglomeration(..)")
|
||||
<< "out of " << totalNCoarse
|
||||
<< " agglomerated cells have " << totalNCoarse-totalNVisited
|
||||
<< " cells that are not a single connected region" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -227,12 +117,28 @@ int main(int argc, char *argv[])
|
||||
<< " agglomerated size : "
|
||||
<< returnReduce(coarseSize, sumOp<label>()) << endl;
|
||||
|
||||
checkConnectedAgglomeration
|
||||
labelList newAddr;
|
||||
label newCoarseSize = 0;
|
||||
bool ok = GAMGAgglomeration::checkRestriction
|
||||
(
|
||||
agglom.meshLevel(level),
|
||||
newAddr,
|
||||
newCoarseSize,
|
||||
|
||||
agglom.meshLevel(level).lduAddr(),
|
||||
addr,
|
||||
coarseSize
|
||||
);
|
||||
if (!ok)
|
||||
{
|
||||
WarningIn(args.executable())
|
||||
<< "At level " << level
|
||||
<< " there are " << coarseSize
|
||||
<< " agglomerated cells but " << newCoarseSize
|
||||
<< " disconnected regions" << endl
|
||||
<< " This means that some agglomerations (coarse cells)"
|
||||
<< " consist of multiple disconnected regions."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
forAll(addr, fineI)
|
||||
|
||||
@ -116,17 +116,19 @@ int main(int argc, char *argv[])
|
||||
squareMatrix[2][1] = -43;
|
||||
squareMatrix[2][2] = 98;
|
||||
|
||||
const scalarSquareMatrix squareMatrixCopy = squareMatrix;
|
||||
Info<< nl << "Square Matrix = " << squareMatrix << endl;
|
||||
|
||||
scalarDiagonalMatrix rhs(3, 0);
|
||||
rhs[0] = 1;
|
||||
rhs[1] = 2;
|
||||
rhs[2] = 3;
|
||||
Info<< "det = " << det(squareMatrixCopy) << endl;
|
||||
|
||||
LUsolve(squareMatrix, rhs);
|
||||
labelList rhs(3, 0);
|
||||
label sign;
|
||||
LUDecompose(squareMatrix, rhs, sign);
|
||||
|
||||
Info<< "Decomposition = " << squareMatrix << endl;
|
||||
Info<< "Solution = " << rhs << endl;
|
||||
Info<< "Pivots = " << rhs << endl;
|
||||
Info<< "Sign = " << sign << endl;
|
||||
Info<< "det = " << detDecomposed(squareMatrix, sign) << endl;
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -254,6 +254,60 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells
|
||||
/Pstream::nProcs()
|
||||
);
|
||||
|
||||
// std::list<Cell_handle> infinite_cells;
|
||||
// Triangulation::incident_cells
|
||||
// (
|
||||
// Triangulation::infinite_vertex(),
|
||||
// std::back_inserter(infinite_cells)
|
||||
// );
|
||||
//
|
||||
// for
|
||||
// (
|
||||
// typename std::list<Cell_handle>::iterator vcit
|
||||
// = infinite_cells.begin();
|
||||
// vcit != infinite_cells.end();
|
||||
// ++vcit
|
||||
// )
|
||||
// {
|
||||
// Cell_handle cit = *vcit;
|
||||
//
|
||||
// // Index of infinite vertex in this cell.
|
||||
// int i = cit->index(Triangulation::infinite_vertex());
|
||||
//
|
||||
// Cell_handle c = cit->neighbor(i);
|
||||
//
|
||||
// if (c->unassigned())
|
||||
// {
|
||||
// c->cellIndex() = this->getNewCellIndex();
|
||||
//
|
||||
// if (checkProcBoundaryCell(c, circumsphereOverlaps))
|
||||
// {
|
||||
// cellToCheck.insert(c->cellIndex());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// for
|
||||
// (
|
||||
// Finite_cells_iterator cit = Triangulation::finite_cells_begin();
|
||||
// cit != Triangulation::finite_cells_end();
|
||||
// ++cit
|
||||
// )
|
||||
// {
|
||||
// if (cit->parallelDualVertex())
|
||||
// {
|
||||
// if (cit->unassigned())
|
||||
// {
|
||||
// if (checkProcBoundaryCell(cit, circumsphereOverlaps))
|
||||
// {
|
||||
// cellToCheck.insert(cit->cellIndex());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
for
|
||||
(
|
||||
All_cells_iterator cit = Triangulation::all_cells_begin();
|
||||
@ -315,12 +369,20 @@ void Foam::DistributedDelaunayMesh<Triangulation>::findProcessorBoundaryCells
|
||||
continue;
|
||||
}
|
||||
|
||||
checkProcBoundaryCell
|
||||
if
|
||||
(
|
||||
citNeighbor,
|
||||
circumsphereOverlaps
|
||||
);
|
||||
checkProcBoundaryCell
|
||||
(
|
||||
citNeighbor,
|
||||
circumsphereOverlaps
|
||||
)
|
||||
)
|
||||
{
|
||||
cellToCheck.insert(citNeighbor->cellIndex());
|
||||
}
|
||||
}
|
||||
|
||||
cellToCheck.unset(cit->cellIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -521,7 +583,6 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
<< originalParallelVertices[vI].procIndex()
|
||||
<< " " << originalParallelVertices[vI].index() << endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,12 +194,24 @@ void Foam::conformalVoronoiMesh::insertPoints
|
||||
}
|
||||
}
|
||||
|
||||
label preReinsertionSize(number_of_vertices());
|
||||
|
||||
rangeInsertWithInfo
|
||||
(
|
||||
vertices.begin(),
|
||||
vertices.end(),
|
||||
true
|
||||
false
|
||||
);
|
||||
|
||||
const label nReinserted = returnReduce
|
||||
(
|
||||
label(number_of_vertices()) - preReinsertionSize,
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< " Reinserted " << nReinserted << " vertices out of "
|
||||
<< returnReduce(vertices.size(), sumOp<label>())
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -787,8 +799,8 @@ Foam::face Foam::conformalVoronoiMesh::buildDualFace
|
||||
<< "Dual face uses circumcenter defined by a "
|
||||
<< "Delaunay tetrahedron with no internal "
|
||||
<< "or boundary points. Defining Delaunay edge ends: "
|
||||
<< topoint(vA->point()) << " "
|
||||
<< topoint(vB->point()) << nl
|
||||
<< vA->info() << " "
|
||||
<< vB->info() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -1034,6 +1046,18 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
)
|
||||
),
|
||||
decomposition_()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::conformalVoronoiMesh::~conformalVoronoiMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::conformalVoronoiMesh::initialiseForMotion()
|
||||
{
|
||||
if (foamyHexMeshControls().objOutput())
|
||||
{
|
||||
@ -1049,7 +1073,10 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
runTime_,
|
||||
rndGen_,
|
||||
geometryToConformTo_,
|
||||
foamyHexMeshDict.subDict("backgroundMeshDecomposition")
|
||||
foamyHexMeshControls().foamyHexMeshDict().subDict
|
||||
(
|
||||
"backgroundMeshDecomposition"
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1113,13 +1140,53 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
void Foam::conformalVoronoiMesh::initialiseForConformation()
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
decomposition_.reset
|
||||
(
|
||||
new backgroundMeshDecomposition
|
||||
(
|
||||
runTime_,
|
||||
rndGen_,
|
||||
geometryToConformTo_,
|
||||
foamyHexMeshControls().foamyHexMeshDict().subDict
|
||||
(
|
||||
"backgroundMeshDecomposition"
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Foam::conformalVoronoiMesh::~conformalVoronoiMesh()
|
||||
{}
|
||||
insertInitialPoints();
|
||||
|
||||
insertFeaturePoints();
|
||||
|
||||
// Improve the guess that the backgroundMeshDecomposition makes with the
|
||||
// initial positions. Use before building the surface conformation to
|
||||
// better balance the surface conformation load.
|
||||
distributeBackground(*this);
|
||||
|
||||
buildSurfaceConformation();
|
||||
|
||||
// The introduction of the surface conformation may have distorted the
|
||||
// balance of vertices, distribute if necessary.
|
||||
distributeBackground(*this);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
sync(decomposition_().procBounds());
|
||||
}
|
||||
|
||||
cellSizeMeshOverlapsBackground();
|
||||
|
||||
if (foamyHexMeshControls().printVertexInfo())
|
||||
{
|
||||
printVertexInfo(Info);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::conformalVoronoiMesh::move()
|
||||
{
|
||||
@ -1630,6 +1697,8 @@ void Foam::conformalVoronoiMesh::move()
|
||||
);
|
||||
}
|
||||
|
||||
DynamicList<Vertex_handle> pointsToRemove;
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
@ -1640,15 +1709,18 @@ void Foam::conformalVoronoiMesh::move()
|
||||
if
|
||||
(
|
||||
(vit->internalPoint() || vit->internalBoundaryPoint())
|
||||
&& !vit->referred()
|
||||
//&& !vit->referred()
|
||||
)
|
||||
{
|
||||
bool inside = geometryToConformTo_.inside
|
||||
(
|
||||
topoint(vit->point())
|
||||
);
|
||||
const Foam::point& pt = topoint(vit->point());
|
||||
|
||||
if (!inside)
|
||||
bool inside = geometryToConformTo_.inside(pt);
|
||||
|
||||
if
|
||||
(
|
||||
!inside
|
||||
|| !geometryToConformTo_.globalBounds().contains(pt)
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
@ -1658,13 +1730,16 @@ void Foam::conformalVoronoiMesh::move()
|
||||
{
|
||||
str().write(topoint(vit->point()));
|
||||
}
|
||||
remove(vit);
|
||||
|
||||
pointsToRemove.append(vit);
|
||||
internalPtIsOutside++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " " << internalPtIsOutside
|
||||
remove(pointsToRemove.begin(), pointsToRemove.end());
|
||||
|
||||
Info<< " " << returnReduce(internalPtIsOutside, sumOp<label>())
|
||||
<< " internal points were inserted outside the domain. "
|
||||
<< "They have been removed." << endl;
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ private:
|
||||
void insertPoints
|
||||
(
|
||||
List<Vb>& vertices,
|
||||
bool distribute = true
|
||||
bool distribute
|
||||
);
|
||||
|
||||
//- Create a point-pair at a ppDist distance either side of
|
||||
@ -764,6 +764,7 @@ private:
|
||||
pointIndexHitAndFeatureDynList& featureEdgeHits,
|
||||
DynamicList<label>& surfaceToTreeShape,
|
||||
DynamicList<label>& edgeToTreeShape,
|
||||
Map<scalar>& surfacePtToEdgePtDist,
|
||||
bool firstPass
|
||||
) const;
|
||||
|
||||
@ -1037,6 +1038,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
void initialiseForMotion();
|
||||
|
||||
void initialiseForConformation();
|
||||
|
||||
//- Move the vertices according to the controller, re-conforming to the
|
||||
// surface as required
|
||||
void move();
|
||||
|
||||
@ -1787,6 +1787,11 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
}
|
||||
}
|
||||
|
||||
OBJstream snapping1("snapToSurface1.obj");
|
||||
OBJstream snapping2("snapToSurface2.obj");
|
||||
OFstream tetToSnapTo("tetsToSnapTo.obj");
|
||||
label offset = 0;
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_cells_iterator cit = finite_cells_begin();
|
||||
@ -1892,6 +1897,88 @@ void Foam::conformalVoronoiMesh::indexDualVertices
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Snapping points far outside
|
||||
if (cit->boundaryDualVertex() && !cit->parallelDualVertex())
|
||||
{
|
||||
pointFromPoint dual = cit->dual();
|
||||
|
||||
pointIndexHit hitInfo;
|
||||
label surfHit;
|
||||
|
||||
// Find nearest surface point
|
||||
geometryToConformTo_.findSurfaceNearest
|
||||
(
|
||||
dual,
|
||||
sqr(targetCellSize(dual)),
|
||||
hitInfo,
|
||||
surfHit
|
||||
);
|
||||
|
||||
if (!hitInfo.hit())
|
||||
{
|
||||
// Project dual to nearest point on tet
|
||||
|
||||
tetPointRef tet
|
||||
(
|
||||
topoint(cit->vertex(0)->point()),
|
||||
topoint(cit->vertex(1)->point()),
|
||||
topoint(cit->vertex(2)->point()),
|
||||
topoint(cit->vertex(3)->point())
|
||||
);
|
||||
|
||||
pointFromPoint nearestPointOnTet =
|
||||
tet.nearestPoint(dual).rawPoint();
|
||||
|
||||
// Get nearest point on surface from tet.
|
||||
geometryToConformTo_.findSurfaceNearest
|
||||
(
|
||||
nearestPointOnTet,
|
||||
sqr(targetCellSize(nearestPointOnTet)),
|
||||
hitInfo,
|
||||
surfHit
|
||||
);
|
||||
|
||||
vector snapDir = nearestPointOnTet - dual;
|
||||
snapDir /= mag(snapDir) + SMALL;
|
||||
|
||||
drawDelaunayCell(tetToSnapTo, cit, offset);
|
||||
offset += 1;
|
||||
|
||||
vectorField norm(1);
|
||||
allGeometry_[surfHit].getNormal
|
||||
(
|
||||
List<pointIndexHit>(1, hitInfo),
|
||||
norm
|
||||
);
|
||||
norm[0] /= mag(norm[0]) + SMALL;
|
||||
|
||||
if
|
||||
(
|
||||
hitInfo.hit()
|
||||
&& (mag(snapDir & norm[0]) > 0.5)
|
||||
)
|
||||
{
|
||||
snapping1.write
|
||||
(
|
||||
linePointRef(dual, nearestPointOnTet)
|
||||
);
|
||||
|
||||
snapping2.write
|
||||
(
|
||||
linePointRef
|
||||
(
|
||||
nearestPointOnTet,
|
||||
hitInfo.hitPoint()
|
||||
)
|
||||
);
|
||||
|
||||
pts[cit->cellIndex()] = hitInfo.hitPoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cit->boundaryDualVertex())
|
||||
{
|
||||
if (cit->featureEdgeDualVertex())
|
||||
@ -2458,6 +2545,54 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
|| (vB->internalOrBoundaryPoint() && !vB->referred())
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
(vA->internalPoint() && vB->externalBoundaryPoint())
|
||||
|| (vB->internalPoint() && vA->externalBoundaryPoint())
|
||||
)
|
||||
{
|
||||
Cell_circulator ccStart = incident_cells(*eit);
|
||||
Cell_circulator cc1 = ccStart;
|
||||
Cell_circulator cc2 = cc1;
|
||||
|
||||
cc2++;
|
||||
|
||||
bool skipEdge = false;
|
||||
|
||||
do
|
||||
{
|
||||
if
|
||||
(
|
||||
cc1->hasFarPoint() || cc2->hasFarPoint()
|
||||
|| is_infinite(cc1) || is_infinite(cc2)
|
||||
)
|
||||
{
|
||||
Pout<< "Ignoring edge between internal and external: "
|
||||
<< vA->info()
|
||||
<< vB->info();
|
||||
|
||||
skipEdge = true;
|
||||
break;
|
||||
}
|
||||
|
||||
cc1++;
|
||||
cc2++;
|
||||
|
||||
} while (cc1 != ccStart);
|
||||
|
||||
|
||||
// Do not create faces if the internal point is outside!
|
||||
// This occurs because the internal point is not determined to
|
||||
// be outside in the inside/outside test. This is most likely
|
||||
// due to the triangle.nearestPointClassify test not returning
|
||||
// edge/point as the nearest type.
|
||||
|
||||
if (skipEdge)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
face newDualFace = buildDualFace(eit);
|
||||
|
||||
if (newDualFace.size() >= 3)
|
||||
|
||||
@ -298,6 +298,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
DynamicList<label> edgeToTreeShape(AtoV/4);
|
||||
DynamicList<label> surfaceToTreeShape(AtoV);
|
||||
|
||||
Map<scalar> surfacePtToEdgePtDist(AtoV/4);
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
@ -332,6 +334,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
featureEdgeHits,
|
||||
surfaceToTreeShape,
|
||||
edgeToTreeShape,
|
||||
surfacePtToEdgePtDist,
|
||||
true
|
||||
);
|
||||
}
|
||||
@ -463,6 +466,8 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
DynamicList<label> surfaceToTreeShape(AtoV/2);
|
||||
DynamicList<label> edgeToTreeShape(AtoV/4);
|
||||
|
||||
Map<scalar> surfacePtToEdgePtDist;
|
||||
|
||||
for
|
||||
(
|
||||
Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
|
||||
@ -507,6 +512,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
featureEdgeHits,
|
||||
surfaceToTreeShape,
|
||||
edgeToTreeShape,
|
||||
surfacePtToEdgePtDist,
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -552,6 +558,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
featureEdgeHits,
|
||||
surfaceToTreeShape,
|
||||
edgeToTreeShape,
|
||||
surfacePtToEdgePtDist,
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -569,7 +576,20 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
Vertex_handle vA = c->vertex(eit->second);
|
||||
Vertex_handle vB = c->vertex(eit->third);
|
||||
|
||||
if (vA->referred() || vB->referred())
|
||||
if
|
||||
(
|
||||
vA->referred()
|
||||
|| vB->referred()
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if
|
||||
(
|
||||
(vA->internalPoint() && vA->referred())
|
||||
|| (vB->internalPoint() && vB->referred())
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -617,6 +637,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation()
|
||||
featureEdgeHits,
|
||||
surfaceToTreeShape,
|
||||
edgeToTreeShape,
|
||||
surfacePtToEdgePtDist,
|
||||
false
|
||||
);
|
||||
}
|
||||
@ -2076,6 +2097,7 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
||||
pointIndexHitAndFeatureDynList& featureEdgeHits,
|
||||
DynamicList<label>& surfaceToTreeShape,
|
||||
DynamicList<label>& edgeToTreeShape,
|
||||
Map<scalar>& surfacePtToEdgePtDist,
|
||||
bool firstPass
|
||||
) const
|
||||
{
|
||||
@ -2182,48 +2204,35 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
|
||||
(
|
||||
pointIndexHitAndFeature(edHit, featureHit)
|
||||
);
|
||||
|
||||
// Info<< "Add " << existingEdgeLocations_.size() - 1
|
||||
// << " " << magSqr(edPt - surfPt) << endl;
|
||||
|
||||
surfacePtToEdgePtDist.insert
|
||||
(
|
||||
existingEdgeLocations_.size() - 1,
|
||||
magSqr(edPt - surfPt)
|
||||
);
|
||||
}
|
||||
else if (firstPass)
|
||||
{
|
||||
label hitIndex = nearestEdgeHit.index();
|
||||
|
||||
// Calc new edge location
|
||||
Foam::point newPt =
|
||||
0.5
|
||||
*(
|
||||
nearestEdgeHit.hitPoint()
|
||||
+ edHit.hitPoint()
|
||||
);
|
||||
|
||||
pointIndexHit pHitOld =
|
||||
edgeLocationTreePtr_().findNearest
|
||||
(
|
||||
nearestEdgeHit.hitPoint(), GREAT
|
||||
);
|
||||
|
||||
pointIndexHit pHitNew =
|
||||
edgeLocationTreePtr_().findNearest
|
||||
(
|
||||
edHit.hitPoint(), GREAT
|
||||
);
|
||||
// Info<< "Close to " << nearestEdgeHit << endl;
|
||||
|
||||
if
|
||||
(
|
||||
magSqr(pHitNew.hitPoint() - edHit.hitPoint())
|
||||
< magSqr
|
||||
(
|
||||
pHitOld.hitPoint()
|
||||
- nearestEdgeHit.hitPoint()
|
||||
)
|
||||
magSqr(edPt - surfPt)
|
||||
< surfacePtToEdgePtDist[hitIndex]
|
||||
)
|
||||
{
|
||||
edHit.setPoint(edHit.hitPoint());
|
||||
|
||||
featureEdgeHits[hitIndex] =
|
||||
pointIndexHitAndFeature(edHit, featureHit);
|
||||
|
||||
existingEdgeLocations_[hitIndex] =
|
||||
edHit.hitPoint();
|
||||
surfacePtToEdgePtDist[hitIndex] =
|
||||
magSqr(edPt - surfPt);
|
||||
|
||||
// Change edge location in featureEdgeHits
|
||||
// remove index from edge tree
|
||||
|
||||
@ -873,17 +873,7 @@ void Foam::conformalVoronoiMesh::reinsertFeaturePoints(bool distribute)
|
||||
{
|
||||
Info<< nl << "Reinserting stored feature points" << endl;
|
||||
|
||||
label preReinsertionSize(number_of_vertices());
|
||||
|
||||
insertPoints(featureVertices_, distribute);
|
||||
|
||||
const label nReinserted = returnReduce
|
||||
(
|
||||
label(number_of_vertices()) - preReinsertionSize,
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< " Reinserted " << nReinserted << " vertices" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -1458,8 +1448,6 @@ void Foam::conformalVoronoiMesh::createFeaturePoints(DynamicList<Vb>& pts)
|
||||
|
||||
forAll(feMeshes, i)
|
||||
{
|
||||
Info<< indent << "Edge mesh = " << feMeshes[i].name() << nl << endl;
|
||||
|
||||
const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
|
||||
|
||||
for
|
||||
|
||||
@ -101,7 +101,9 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
|
||||
// Supply offset as tet number
|
||||
offset *= 4;
|
||||
|
||||
os << "# cell index: " << label(c->cellIndex()) << endl;
|
||||
os << "# cell index: " << label(c->cellIndex())
|
||||
<< " INT_MIN = " << INT_MIN
|
||||
<< endl;
|
||||
|
||||
os << "# circumradius "
|
||||
<< mag(c->dual() - topoint(c->vertex(0)->point()))
|
||||
@ -112,7 +114,15 @@ void Foam::conformalVoronoiMesh::drawDelaunayCell
|
||||
os << "# index / type / procIndex: "
|
||||
<< label(c->vertex(i)->index()) << " "
|
||||
<< label(c->vertex(i)->type()) << " "
|
||||
<< label(c->vertex(i)->procIndex()) << endl;
|
||||
<< label(c->vertex(i)->procIndex())
|
||||
<< (is_infinite(c->vertex(i)) ? " # This vertex is infinite!" : "")
|
||||
<<
|
||||
(
|
||||
c->vertex(i)->uninitialised()
|
||||
? " # This vertex is uninitialised!"
|
||||
: ""
|
||||
)
|
||||
<< endl;
|
||||
|
||||
meshTools::writeOBJ(os, topoint(c->vertex(i)->point()));
|
||||
}
|
||||
|
||||
@ -706,8 +706,8 @@ Foam::Field<bool> Foam::conformationSurfaces::wellInside
|
||||
// Info<< surface.name() << " = "
|
||||
// << volumeType::names[surfaceVolumeTests[s][i]] << endl;
|
||||
|
||||
//if (surfaceVolumeTests[s][i] == volumeType::OUTSIDE)
|
||||
if (surfaceVolumeTests[s][i] != volumeType::INSIDE)
|
||||
if (surfaceVolumeTests[s][i] == volumeType::OUTSIDE)
|
||||
// if (surfaceVolumeTests[s][i] != volumeType::INSIDE)
|
||||
{
|
||||
insidePoint[i] = false;
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ List<Vb::Point> pointFile::initialPoints() const
|
||||
IOobject
|
||||
(
|
||||
pointFileName_.name(),
|
||||
foamyHexMesh_.time().constant(),
|
||||
foamyHexMesh_.time().timeName(),
|
||||
foamyHexMesh_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
|
||||
@ -45,12 +45,22 @@ int main(int argc, char *argv[])
|
||||
"check all surface geometry for quality"
|
||||
);
|
||||
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"conformationOnly",
|
||||
"conform to the initial points without any point motion"
|
||||
);
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
runTime.functionObjects().off();
|
||||
|
||||
const bool checkGeometry = args.optionFound("checkGeometry");
|
||||
const bool conformationOnly = args.optionFound("conformationOnly");
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
IOdictionary foamyHexMeshDict
|
||||
(
|
||||
@ -104,16 +114,33 @@ int main(int argc, char *argv[])
|
||||
conformalVoronoiMesh mesh(runTime, foamyHexMeshDict);
|
||||
|
||||
|
||||
while (runTime.loop())
|
||||
if (conformationOnly)
|
||||
{
|
||||
Info<< nl << "Time = " << runTime.timeName() << endl;
|
||||
mesh.initialiseForConformation();
|
||||
|
||||
mesh.move();
|
||||
if (!overwrite)
|
||||
{
|
||||
runTime++;
|
||||
}
|
||||
|
||||
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< endl;
|
||||
mesh.writeMesh(runTime.timeName());
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh.initialiseForMotion();
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< nl << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
mesh.move();
|
||||
|
||||
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "End" << nl << endl;
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
mesh.magSf()
|
||||
* mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* fvc::interpolate(RASModel->nuEff())
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -192,8 +192,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* (mag(phi)/mesh.magSf())*(runTime.deltaT()/nu)
|
||||
mag(phi)
|
||||
/(
|
||||
mesh.magSf()
|
||||
* mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* nu
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -317,8 +321,12 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* (mag(phi)/(mesh.magSf()))*(runTime.deltaT()/mu)
|
||||
mag(phi)
|
||||
/(
|
||||
mesh.magSf()
|
||||
* mesh.surfaceInterpolation::deltaCoeffs()
|
||||
* mu
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -330,26 +338,6 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// can also check how many cells exceed a particular Pe limit
|
||||
/*
|
||||
{
|
||||
label count = 0;
|
||||
label PeLimit = 200;
|
||||
forAll(PePtr(), i)
|
||||
{
|
||||
if (PePtr()[i] > PeLimit)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Info<< "Fraction > " << PeLimit << " = "
|
||||
<< scalar(count)/Pe.size() << endl;
|
||||
}
|
||||
*/
|
||||
|
||||
Info<< "Pe max : " << max(PePtr()).value() << endl;
|
||||
|
||||
if (writeResults)
|
||||
|
||||
@ -653,6 +653,36 @@ int main(int argc, char *argv[])
|
||||
Info<< "Checking self-intersection." << endl;
|
||||
|
||||
triSurfaceSearch querySurf(surf);
|
||||
|
||||
//{
|
||||
// OBJstream intStream("selfInter2.obj");
|
||||
// const indexedOctree<treeDataTriSurface>& tree = querySurf.tree();
|
||||
// forAll(surf.edges(), edgeI)
|
||||
// {
|
||||
// const edge& e = surf.edges()[edgeI];
|
||||
//
|
||||
// pointIndexHit hitInfo
|
||||
// (
|
||||
// tree.findLine
|
||||
// (
|
||||
// surf.points()[surf.meshPoints()[e[0]]],
|
||||
// surf.points()[surf.meshPoints()[e[1]]],
|
||||
// treeDataTriSurface::findSelfIntersectOp
|
||||
// (
|
||||
// tree,
|
||||
// edgeI
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (hitInfo.hit())
|
||||
// {
|
||||
// Pout<< "Found hit:" << hitInfo.hitPoint() << endl;
|
||||
// intStream.write(hitInfo.hitPoint());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
surfaceIntersection inter(querySurf);
|
||||
|
||||
if (inter.cutEdges().empty() && inter.cutPoints().empty())
|
||||
|
||||
Reference in New Issue
Block a user