mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: trackingInverseDistance: fix trackingInverseDistance. Fixes #736.
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,6 +48,7 @@ Description
|
|||||||
#include "MeshedSurfaces.H"
|
#include "MeshedSurfaces.H"
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
|
#include "fvMeshTools.H"
|
||||||
|
|
||||||
#include "extrudedMesh.H"
|
#include "extrudedMesh.H"
|
||||||
#include "extrudeModel.H"
|
#include "extrudeModel.H"
|
||||||
@ -78,59 +79,6 @@ static const Enum<ExtrudeMode> ExtrudeModeNames
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
|
||||||
{
|
|
||||||
// Create dummy system/fv*
|
|
||||||
{
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSchemes",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Testing:" << io.objectPath() << endl;
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(false))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
dictionary divDict;
|
|
||||||
dummyDict.add("divSchemes", divDict);
|
|
||||||
dictionary gradDict;
|
|
||||||
dummyDict.add("gradSchemes", gradDict);
|
|
||||||
dictionary laplDict;
|
|
||||||
dummyDict.add("laplacianSchemes", laplDict);
|
|
||||||
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSolution",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(false))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
label findPatchID(const polyBoundaryMesh& patches, const word& name)
|
label findPatchID(const polyBoundaryMesh& patches, const word& name)
|
||||||
{
|
{
|
||||||
const label patchID = patches.findPatchID(name);
|
const label patchID = patches.findPatchID(name);
|
||||||
@ -738,7 +686,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Create dummy fvSchemes, fvSolution
|
// Create dummy fvSchemes, fvSolution
|
||||||
createDummyFvMeshFiles(mesh, regionDir);
|
fvMeshTools::createDummyFvMeshFiles(mesh, regionDir, true);
|
||||||
|
|
||||||
// Create actual mesh from polyTopoChange container
|
// Create actual mesh from polyTopoChange container
|
||||||
autoPtr<mapPolyMesh> map = meshMod().makeMesh
|
autoPtr<mapPolyMesh> map = meshMod().makeMesh
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -353,59 +353,6 @@ void deleteEmptyPatches(fvMesh& mesh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void createDummyFvMeshFiles(const polyMesh& mesh, const word& regionName)
|
|
||||||
{
|
|
||||||
// Create dummy system/fv*
|
|
||||||
{
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSchemes",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Testing:" << io.objectPath() << endl;
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
dictionary divDict;
|
|
||||||
dummyDict.add("divSchemes", divDict);
|
|
||||||
dictionary gradDict;
|
|
||||||
dummyDict.add("gradSchemes", gradDict);
|
|
||||||
dictionary laplDict;
|
|
||||||
dummyDict.add("laplacianSchemes", laplDict);
|
|
||||||
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSolution",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check zone either all internal or all external faces
|
// Check zone either all internal or all external faces
|
||||||
void checkZoneInside
|
void checkZoneInside
|
||||||
(
|
(
|
||||||
@ -1642,7 +1589,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
// Create dummy fv* files
|
// Create dummy fv* files
|
||||||
createDummyFvMeshFiles(mesh, shellRegionName);
|
fvMeshTools::createDummyFvMeshFiles(mesh, shellRegionName, true);
|
||||||
|
|
||||||
|
|
||||||
word meshInstance;
|
word meshInstance;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -584,56 +584,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Create dummy system/fv*
|
// Create dummy system/fv*
|
||||||
{
|
fvMeshTools::createDummyFvMeshFiles(mesh, regionName, true);
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSchemes",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Testing:" << io.objectPath() << endl;
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
|
||||||
// if (!exists(io.objectPath()))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
dictionary divDict;
|
|
||||||
dummyDict.add("divSchemes", divDict);
|
|
||||||
dictionary gradDict;
|
|
||||||
dummyDict.add("gradSchemes", gradDict);
|
|
||||||
dictionary laplDict;
|
|
||||||
dummyDict.add("laplacianSchemes", laplDict);
|
|
||||||
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
"fvSolution",
|
|
||||||
mesh.time().system(),
|
|
||||||
regionName,
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!io.typeHeaderOk<IOdictionary>(true))
|
|
||||||
//if (!exists(io.objectPath()))
|
|
||||||
{
|
|
||||||
Info<< "Writing dummy " << regionName/io.name() << endl;
|
|
||||||
dictionary dummyDict;
|
|
||||||
IOdictionary(io, dummyDict).regIOobject::write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Neighbour cellRegion.
|
// Neighbour cellRegion.
|
||||||
labelList coupledRegion(mesh.nBoundaryFaces());
|
labelList coupledRegion(mesh.nBoundaryFaces());
|
||||||
|
|||||||
@ -53,7 +53,6 @@ wmake $targetType topoChangerFvMesh
|
|||||||
parallel/Allwmake $targetType $*
|
parallel/Allwmake $targetType $*
|
||||||
randomProcesses/Allwmake $targetType $*
|
randomProcesses/Allwmake $targetType $*
|
||||||
|
|
||||||
wmake $targetType overset
|
|
||||||
wmake $targetType ODE
|
wmake $targetType ODE
|
||||||
|
|
||||||
transportModels/Allwmake $targetType $*
|
transportModels/Allwmake $targetType $*
|
||||||
@ -67,6 +66,7 @@ wmake $targetType fvOptions
|
|||||||
wmake $targetType fvMotionSolver
|
wmake $targetType fvMotionSolver
|
||||||
|
|
||||||
mesh/Allwmake $targetType $*
|
mesh/Allwmake $targetType $*
|
||||||
|
wmake $targetType overset
|
||||||
renumber/Allwmake $targetType $*
|
renumber/Allwmake $targetType $*
|
||||||
fvAgglomerationMethods/Allwmake $targetType $*
|
fvAgglomerationMethods/Allwmake $targetType $*
|
||||||
wmake $targetType waveModels
|
wmake $targetType waveModels
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -667,4 +667,66 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fvMeshTools::createDummyFvMeshFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& mesh,
|
||||||
|
const word& regionName,
|
||||||
|
const bool verbose
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Create dummy system/fv*
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"fvSchemes",
|
||||||
|
mesh.time().system(),
|
||||||
|
regionName,
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!io.typeHeaderOk<IOdictionary>(false))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||||
|
}
|
||||||
|
dictionary dummyDict;
|
||||||
|
dictionary divDict;
|
||||||
|
dummyDict.add("divSchemes", divDict);
|
||||||
|
dictionary gradDict;
|
||||||
|
dummyDict.add("gradSchemes", gradDict);
|
||||||
|
dictionary laplDict;
|
||||||
|
dummyDict.add("laplacianSchemes", laplDict);
|
||||||
|
|
||||||
|
IOdictionary(io, dummyDict).regIOobject::write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IOobject io
|
||||||
|
(
|
||||||
|
"fvSolution",
|
||||||
|
mesh.time().system(),
|
||||||
|
regionName,
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!io.typeHeaderOk<IOdictionary>(false))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
|
{
|
||||||
|
Info<< "Writing dummy " << regionName/io.name() << endl;
|
||||||
|
}
|
||||||
|
dictionary dummyDict;
|
||||||
|
IOdictionary(io, dummyDict).regIOobject::write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -137,6 +137,14 @@ public:
|
|||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const bool masterOnlyReading
|
const bool masterOnlyReading
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Create additional fv* files
|
||||||
|
static void createDummyFvMeshFiles
|
||||||
|
(
|
||||||
|
const objectRegistry& parent,
|
||||||
|
const word& regionName,
|
||||||
|
const bool verbose = false
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||||
|
-I$(LIB_SRC)/mesh/blockMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude \
|
-I$(LIB_SRC)/sampling/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
@ -15,4 +16,5 @@ EXE_INC = \
|
|||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-ldynamicFvMesh \
|
-ldynamicFvMesh \
|
||||||
-lsampling \
|
-lsampling \
|
||||||
|
-lblockMesh \
|
||||||
-ldecompositionMethods
|
-ldecompositionMethods
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -97,7 +97,12 @@ protected:
|
|||||||
|
|
||||||
//- Helper: create volScalarField for postprocessing.
|
//- Helper: create volScalarField for postprocessing.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<volScalarField> createField(const word& name, UList<Type>&) const;
|
static tmp<volScalarField> createField
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const UList<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -29,7 +29,12 @@ License
|
|||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::cellCellStencil::createField(const word& name, UList<Type>& psi) const
|
Foam::cellCellStencil::createField
|
||||||
|
(
|
||||||
|
const fvMesh& mesh,
|
||||||
|
const word& name,
|
||||||
|
const UList<Type>& psi
|
||||||
|
)
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tfld
|
tmp<volScalarField> tfld
|
||||||
(
|
(
|
||||||
@ -38,13 +43,13 @@ Foam::cellCellStencil::createField(const word& name, UList<Type>& psi) const
|
|||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
name,
|
name,
|
||||||
mesh_.time().timeName(),
|
mesh.time().timeName(),
|
||||||
mesh_,
|
mesh,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
),
|
),
|
||||||
mesh_,
|
mesh,
|
||||||
dimensionedScalar(dimless, Zero),
|
dimensionedScalar(dimless, Zero),
|
||||||
zeroGradientFvPatchScalarField::typeName
|
zeroGradientFvPatchScalarField::typeName
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2014-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2014-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -155,12 +155,12 @@ void Foam::cellCellStencils::cellVolumeWeight::walkFront
|
|||||||
{
|
{
|
||||||
allWeight[own] = fraction;
|
allWeight[own] = fraction;
|
||||||
|
|
||||||
if (debug)
|
//if (debug)
|
||||||
{
|
//{
|
||||||
Pout<< " setting cell "
|
// Pout<< " setting cell "
|
||||||
<< mesh_.cellCentres()[own]
|
// << mesh_.cellCentres()[own]
|
||||||
<< " to " << fraction << endl;
|
// << " to " << fraction << endl;
|
||||||
}
|
//}
|
||||||
allCellTypes[own] = INTERPOLATED;
|
allCellTypes[own] = INTERPOLATED;
|
||||||
newIsFront.set(mesh_.cells()[own]);
|
newIsFront.set(mesh_.cells()[own]);
|
||||||
}
|
}
|
||||||
@ -174,12 +174,12 @@ void Foam::cellCellStencils::cellVolumeWeight::walkFront
|
|||||||
{
|
{
|
||||||
allWeight[nei] = fraction;
|
allWeight[nei] = fraction;
|
||||||
|
|
||||||
if (debug)
|
//if (debug)
|
||||||
{
|
//{
|
||||||
Pout<< " setting cell "
|
// Pout<< " setting cell "
|
||||||
<< mesh_.cellCentres()[nei]
|
// << mesh_.cellCentres()[nei]
|
||||||
<< " to " << fraction << endl;
|
// << " to " << fraction << endl;
|
||||||
}
|
//}
|
||||||
|
|
||||||
allCellTypes[nei] = INTERPOLATED;
|
allCellTypes[nei] = INTERPOLATED;
|
||||||
newIsFront.set(mesh_.cells()[nei]);
|
newIsFront.set(mesh_.cells()[nei]);
|
||||||
@ -928,6 +928,16 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes", allCellTypes)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Use the patch types and weights to decide what to do
|
// Use the patch types and weights to decide what to do
|
||||||
forAll(allPatchTypes, cellI)
|
forAll(allPatchTypes, cellI)
|
||||||
{
|
{
|
||||||
@ -977,15 +987,44 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_patch", allCellTypes)
|
||||||
|
);
|
||||||
|
//tfld.ref().correctBoundaryConditions();
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mark unreachable bits
|
// Mark unreachable bits
|
||||||
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
|
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_hole", allCellTypes)
|
||||||
|
);
|
||||||
|
//tfld.ref().correctBoundaryConditions();
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add buffer interpolation layer around holes
|
// Add buffer interpolation layer around holes
|
||||||
scalarField allWeight(mesh_.nCells(), Zero);
|
scalarField allWeight(mesh_.nCells(), Zero);
|
||||||
walkFront(layerRelax, allCellTypes, allWeight);
|
walkFront(layerRelax, allCellTypes, allWeight);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_front", allCellTypes)
|
||||||
|
);
|
||||||
|
//tfld.ref().correctBoundaryConditions();
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
// Check previous iteration cellTypes_ for any hole->calculated changes
|
// Check previous iteration cellTypes_ for any hole->calculated changes
|
||||||
{
|
{
|
||||||
@ -1104,39 +1143,39 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// // Check previous iteration cellTypes_ for any hole->calculated changes
|
// // Check previous iteration cellTypes_ for any hole->calculated changes
|
||||||
// {
|
// {
|
||||||
// label nCalculated = 0;
|
// label nCalculated = 0;
|
||||||
//
|
//
|
||||||
// forAll(cellTypes_, celli)
|
// forAll(cellTypes_, celli)
|
||||||
// {
|
// {
|
||||||
// if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE)
|
// if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE)
|
||||||
// {
|
// {
|
||||||
// if (allStencil[celli].size() == 0)
|
// if (allStencil[celli].size() == 0)
|
||||||
// {
|
// {
|
||||||
// FatalErrorInFunction
|
// FatalErrorInFunction
|
||||||
// << "Cell:" << celli
|
// << "Cell:" << celli
|
||||||
// << " at:" << mesh_.cellCentres()[celli]
|
// << " at:" << mesh_.cellCentres()[celli]
|
||||||
// << " zone:" << zoneID[celli]
|
// << " zone:" << zoneID[celli]
|
||||||
// << " changed from hole to calculated"
|
// << " changed from hole to calculated"
|
||||||
// << " but there is no donor"
|
// << " but there is no donor"
|
||||||
// << exit(FatalError);
|
// << exit(FatalError);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// allCellTypes[celli] = INTERPOLATED;
|
// allCellTypes[celli] = INTERPOLATED;
|
||||||
// nCalculated++;
|
// nCalculated++;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if (debug)
|
// if (debug)
|
||||||
// {
|
// {
|
||||||
// Pout<< "Detected " << nCalculated << " cells changing from hole"
|
// Pout<< "Detected " << nCalculated << " cells changing from hole"
|
||||||
// << " to calculated. Changed these to interpolated"
|
// << " to calculated. Changed these to interpolated"
|
||||||
// << endl;
|
// << endl;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
cellTypes_.transfer(allCellTypes);
|
cellTypes_.transfer(allCellTypes);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -1998,8 +1998,10 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tfld(createField("allCellTypes", allCellTypes));
|
tmp<volScalarField> tfld
|
||||||
//tfld.ref().correctBoundaryConditions();
|
(
|
||||||
|
createField(mesh_, "allCellTypes", allCellTypes)
|
||||||
|
);
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2041,9 +2043,8 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
{
|
{
|
||||||
tmp<volScalarField> tfld
|
tmp<volScalarField> tfld
|
||||||
(
|
(
|
||||||
createField("allCellTypes_patch", allCellTypes)
|
createField(mesh_, "allCellTypes_patch", allCellTypes)
|
||||||
);
|
);
|
||||||
//tfld.ref().correctBoundaryConditions();
|
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2054,9 +2055,8 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
{
|
{
|
||||||
tmp<volScalarField> tfld
|
tmp<volScalarField> tfld
|
||||||
(
|
(
|
||||||
createField("allCellTypes_hole", allCellTypes)
|
createField(mesh_, "allCellTypes_hole", allCellTypes)
|
||||||
);
|
);
|
||||||
//tfld.ref().correctBoundaryConditions();
|
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -2066,8 +2066,10 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
{
|
{
|
||||||
stencilSize[celli] = allStencil[celli].size();
|
stencilSize[celli] = allStencil[celli].size();
|
||||||
}
|
}
|
||||||
tmp<volScalarField> tfld(createField("allStencil_hole", stencilSize));
|
tmp<volScalarField> tfld
|
||||||
//tfld.ref().correctBoundaryConditions();
|
(
|
||||||
|
createField(mesh_, "allStencil_hole", stencilSize)
|
||||||
|
);
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2080,9 +2082,8 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
{
|
{
|
||||||
tmp<volScalarField> tfld
|
tmp<volScalarField> tfld
|
||||||
(
|
(
|
||||||
createField("allCellTypes_front", allCellTypes)
|
createField(mesh_, "allCellTypes_front", allCellTypes)
|
||||||
);
|
);
|
||||||
//tfld.ref().correctBoundaryConditions();
|
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2227,14 +2228,20 @@ bool Foam::cellCellStencils::inverseDistance::update()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tmp<volScalarField> tfld(createField("maxMagWeight", maxMagWeight));
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "maxMagWeight", maxMagWeight)
|
||||||
|
);
|
||||||
tfld.ref().correctBoundaryConditions();
|
tfld.ref().correctBoundaryConditions();
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump cell types
|
// Dump cell types
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tfld(createField("cellTypes", cellTypes_));
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "cellTypes", cellTypes_)
|
||||||
|
);
|
||||||
tfld.ref().correctBoundaryConditions();
|
tfld.ref().correctBoundaryConditions();
|
||||||
tfld().write();
|
tfld().write();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -441,55 +441,55 @@ Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance
|
|||||||
inverseDistance(mesh, dict, false),
|
inverseDistance(mesh, dict, false),
|
||||||
globalCells_(mesh_.nCells())
|
globalCells_(mesh_.nCells())
|
||||||
{
|
{
|
||||||
|
// Initialise donor cell
|
||||||
|
globalDonor_.setSize(mesh_.nCells());
|
||||||
|
globalDonor_ = -1;
|
||||||
|
|
||||||
|
// Initialise mesh partitions
|
||||||
|
const labelIOList& zoneID = this->zoneID();
|
||||||
|
label nZones = gMax(zoneID)+1;
|
||||||
|
|
||||||
|
labelList nCellsPerZone(nZones, Zero);
|
||||||
|
forAll(zoneID, celli)
|
||||||
|
{
|
||||||
|
nCellsPerZone[zoneID[celli]]++;
|
||||||
|
}
|
||||||
|
Pstream::listCombineGather(nCellsPerZone, plusEqOp<label>());
|
||||||
|
Pstream::listCombineScatter(nCellsPerZone);
|
||||||
|
|
||||||
|
meshParts_.setSize(nZones);
|
||||||
|
forAll(meshParts_, zonei)
|
||||||
|
{
|
||||||
|
meshParts_.set
|
||||||
|
(
|
||||||
|
zonei,
|
||||||
|
new fvMeshSubset(mesh_, zonei, zoneID)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Trigger early evaluation of mesh dimension
|
||||||
|
// (in case there are locally zero cells in mesh)
|
||||||
|
(void)meshParts_[zonei].subMesh().nGeometricD();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Print a bit
|
||||||
|
{
|
||||||
|
Info<< typeName << " : detected " << nZones
|
||||||
|
<< " mesh regions" << endl;
|
||||||
|
Info<< incrIndent;
|
||||||
|
forAll(nCellsPerZone, zonei)
|
||||||
|
{
|
||||||
|
Info<< indent<< "zone:" << zonei
|
||||||
|
<< " nCells:" << nCellsPerZone[zonei]
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
Info<< decrIndent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Do geometry update
|
||||||
if (doUpdate)
|
if (doUpdate)
|
||||||
{
|
{
|
||||||
// Initialise donor cell
|
|
||||||
globalDonor_.setSize(mesh_.nCells());
|
|
||||||
globalDonor_ = -1;
|
|
||||||
|
|
||||||
// Initialise mesh partitions
|
|
||||||
const labelIOList& zoneID = this->zoneID();
|
|
||||||
label nZones = gMax(zoneID)+1;
|
|
||||||
|
|
||||||
labelList nCellsPerZone(nZones, Zero);
|
|
||||||
forAll(zoneID, celli)
|
|
||||||
{
|
|
||||||
nCellsPerZone[zoneID[celli]]++;
|
|
||||||
}
|
|
||||||
Pstream::listCombineGather(nCellsPerZone, plusEqOp<label>());
|
|
||||||
Pstream::listCombineScatter(nCellsPerZone);
|
|
||||||
|
|
||||||
meshParts_.setSize(nZones);
|
|
||||||
forAll(meshParts_, zonei)
|
|
||||||
{
|
|
||||||
meshParts_.set
|
|
||||||
(
|
|
||||||
zonei,
|
|
||||||
new fvMeshSubset(mesh_, zonei, zoneID)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Trigger early evaluation of mesh dimension
|
|
||||||
// (in case there are locally zero cells in mesh)
|
|
||||||
(void)meshParts_[zonei].subMesh().nGeometricD();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Print a bit
|
|
||||||
{
|
|
||||||
Info<< typeName << " : detected " << nZones
|
|
||||||
<< " mesh regions" << endl;
|
|
||||||
Info<< incrIndent;
|
|
||||||
forAll(nCellsPerZone, zonei)
|
|
||||||
{
|
|
||||||
Info<< indent<< "zone:" << zonei
|
|
||||||
<< " nCells:" << nCellsPerZone[zonei]
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
Info<< decrIndent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Do geometry update
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -550,12 +550,36 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
|
|||||||
meshSearches.set
|
meshSearches.set
|
||||||
(
|
(
|
||||||
zonei,
|
zonei,
|
||||||
new voxelMeshSearch(meshParts_[zonei].subMesh(), true)
|
new voxelMeshSearch
|
||||||
|
(
|
||||||
|
meshParts_[zonei].subMesh(),
|
||||||
|
true
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DebugInfo<< FUNCTION_NAME << " : Constructed cell voxel meshes" << endl;
|
DebugInfo<< FUNCTION_NAME << " : Constructed cell voxel meshes" << endl;
|
||||||
|
|
||||||
|
PtrList<fvMesh> voxelMeshes;
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
voxelMeshes.setSize(meshSearches.size());
|
||||||
|
forAll(meshSearches, zonei)
|
||||||
|
{
|
||||||
|
IOobject meshIO
|
||||||
|
(
|
||||||
|
word("voxelMesh" + Foam::name(zonei)),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ
|
||||||
|
);
|
||||||
|
|
||||||
|
Pout<< "Constructing voxel mesh " << meshIO.objectPath() << endl;
|
||||||
|
voxelMeshes.set(zonei, meshSearches[zonei].makeMesh(meshIO));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const boundBox& allBb(mesh_.bounds());
|
const boundBox& allBb(mesh_.bounds());
|
||||||
|
|
||||||
@ -657,6 +681,24 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
|
|||||||
}
|
}
|
||||||
DebugInfo<< FUNCTION_NAME << " : Calculated boundary voxel meshes" << endl;
|
DebugInfo<< FUNCTION_NAME << " : Calculated boundary voxel meshes" << endl;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
forAll(patchParts, zonei)
|
||||||
|
{
|
||||||
|
const labelList voxelTypes(patchParts[zonei].values());
|
||||||
|
const fvMesh& vm = voxelMeshes[zonei];
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField<label>
|
||||||
|
(
|
||||||
|
vm,
|
||||||
|
"patchTypes",
|
||||||
|
voxelTypes
|
||||||
|
)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Current best guess for cells
|
// Current best guess for cells
|
||||||
labelList allCellTypes(mesh_.nCells(), CALCULATED);
|
labelList allCellTypes(mesh_.nCells(), CALCULATED);
|
||||||
@ -698,7 +740,13 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
|
|||||||
srci,
|
srci,
|
||||||
allCellTypes
|
allCellTypes
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (label srci = 0; srci < meshParts_.size()-1; srci++)
|
||||||
|
{
|
||||||
|
for (label tgti = srci+1; tgti < meshParts_.size(); tgti++)
|
||||||
|
{
|
||||||
markDonors
|
markDonors
|
||||||
(
|
(
|
||||||
pBufs,
|
pBufs,
|
||||||
@ -727,6 +775,15 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
|
|||||||
DebugInfo<< FUNCTION_NAME << " : Determined holes and donor-acceptors"
|
DebugInfo<< FUNCTION_NAME << " : Determined holes and donor-acceptors"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes", allCellTypes)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Use the patch types and weights to decide what to do
|
// Use the patch types and weights to decide what to do
|
||||||
forAll(allPatchTypes, celli)
|
forAll(allPatchTypes, celli)
|
||||||
@ -753,15 +810,84 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
|
|||||||
}
|
}
|
||||||
DebugInfo<< FUNCTION_NAME << " : Removed bad donors" << endl;
|
DebugInfo<< FUNCTION_NAME << " : Removed bad donors" << endl;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_patch", allCellTypes)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Mark unreachable bits
|
// Mark unreachable bits
|
||||||
findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes);
|
findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes);
|
||||||
DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl;
|
DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_hole", allCellTypes)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
// Add buffer interpolation layer(s) around holes
|
// Add buffer interpolation layer(s) around holes
|
||||||
scalarField allWeight(mesh_.nCells(), Zero);
|
scalarField allWeight(mesh_.nCells(), Zero);
|
||||||
walkFront(layerRelax, allStencil, allCellTypes, allWeight);
|
walkFront(layerRelax, allStencil, allCellTypes, allWeight);
|
||||||
DebugInfo<< FUNCTION_NAME << " : Implemented layer relaxation" << endl;
|
DebugInfo<< FUNCTION_NAME << " : Implemented layer relaxation" << endl;
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
tmp<volScalarField> tfld
|
||||||
|
(
|
||||||
|
createField(mesh_, "allCellTypes_front", allCellTypes)
|
||||||
|
);
|
||||||
|
tfld().write();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Check previous iteration cellTypes_ for any hole->calculated changes
|
||||||
|
{
|
||||||
|
label nCalculated = 0;
|
||||||
|
|
||||||
|
forAll(cellTypes_, celli)
|
||||||
|
{
|
||||||
|
if (allCellTypes[celli] == CALCULATED && cellTypes_[celli] == HOLE)
|
||||||
|
{
|
||||||
|
if (allStencil[celli].size() == 0)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
//WarningInFunction
|
||||||
|
<< "Cell:" << celli
|
||||||
|
<< " at:" << mesh_.cellCentres()[celli]
|
||||||
|
<< " zone:" << zoneID[celli]
|
||||||
|
<< " changed from hole to calculated"
|
||||||
|
<< " but there is no donor"
|
||||||
|
//<< endl;
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pout<< "cell:" << mesh_.cellCentres()[celli]
|
||||||
|
<< " changed from hole to calculated"
|
||||||
|
<< " using donors:" << allStencil[celli]
|
||||||
|
<< endl;
|
||||||
|
allCellTypes[celli] = INTERPOLATED;
|
||||||
|
nCalculated++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Detected " << nCalculated << " cells changing from hole"
|
||||||
|
<< " to calculated. Changed to interpolated"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert cell-cell addressing to stencil in compact notation
|
// Convert cell-cell addressing to stencil in compact notation
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,7 +26,11 @@ License
|
|||||||
#include "voxelMeshSearch.H"
|
#include "voxelMeshSearch.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
|
#include "IOobject.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "block.H"
|
||||||
|
#include "emptyPolyPatch.H"
|
||||||
|
#include "fvMeshTools.H"
|
||||||
|
|
||||||
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
/* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
|
||||||
|
|
||||||
@ -340,6 +344,14 @@ bool Foam::voxelMeshSearch::update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "voxelMeshSearch : mesh:" << mesh_.name()
|
||||||
|
<< " nDivs:" << nDivs_
|
||||||
|
<< " localBb:" << localBb_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//// Small optimisation: make sure the cell centre at least always
|
//// Small optimisation: make sure the cell centre at least always
|
||||||
//// returns the cell itself
|
//// returns the cell itself
|
||||||
//const pointField& cellCentres = mesh_.cellCentres();
|
//const pointField& cellCentres = mesh_.cellCentres();
|
||||||
@ -429,4 +441,106 @@ Foam::label Foam::voxelMeshSearch::findCell(const point& p) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::fvMesh> Foam::voxelMeshSearch::makeMesh
|
||||||
|
(
|
||||||
|
const IOobject& io
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const cellModel& hex = cellModel::ref(cellModel::HEX);
|
||||||
|
|
||||||
|
cellShapeList cellShapes;
|
||||||
|
faceListList boundary;
|
||||||
|
pointField points;
|
||||||
|
{
|
||||||
|
//Info<< "Creating block" << endl;
|
||||||
|
|
||||||
|
block b
|
||||||
|
(
|
||||||
|
cellShape(hex, identity(8), false),
|
||||||
|
localBb_.points(),
|
||||||
|
blockEdgeList(),
|
||||||
|
blockFaceList(),
|
||||||
|
nDivs_,
|
||||||
|
List<gradingDescriptors>(12)
|
||||||
|
);
|
||||||
|
|
||||||
|
List<FixedList<label, 8>> bCells(b.cells());
|
||||||
|
cellShapes.setSize(bCells.size());
|
||||||
|
forAll(cellShapes, celli)
|
||||||
|
{
|
||||||
|
cellShapes[celli] =
|
||||||
|
cellShape(hex, labelList(bCells[celli]), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Info<< "Creating boundary faces" << endl;
|
||||||
|
|
||||||
|
boundary.setSize(b.boundaryPatches().size());
|
||||||
|
forAll(boundary, patchi)
|
||||||
|
{
|
||||||
|
faceList faces(b.boundaryPatches()[patchi].size());
|
||||||
|
forAll(faces, facei)
|
||||||
|
{
|
||||||
|
faces[facei] = face(b.boundaryPatches()[patchi][facei]);
|
||||||
|
}
|
||||||
|
boundary[patchi].transfer(faces);
|
||||||
|
}
|
||||||
|
|
||||||
|
points.transfer(const_cast<pointField&>(b.points()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Info<< "Creating patch dictionaries" << endl;
|
||||||
|
wordList patchNames(boundary.size());
|
||||||
|
forAll(patchNames, patchi)
|
||||||
|
{
|
||||||
|
patchNames[patchi] = "patch" + Foam::name(patchi);
|
||||||
|
}
|
||||||
|
|
||||||
|
PtrList<dictionary> boundaryDicts(boundary.size());
|
||||||
|
forAll(boundaryDicts, patchi)
|
||||||
|
{
|
||||||
|
boundaryDicts.set(patchi, new dictionary());
|
||||||
|
dictionary& patchDict = boundaryDicts[patchi];
|
||||||
|
patchDict.add("type", emptyPolyPatch::typeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Info<< "Creating polyMesh" << endl;
|
||||||
|
IOobject polyIO(io);
|
||||||
|
polyIO.readOpt() = IOobject::NO_READ;
|
||||||
|
polyMesh mesh
|
||||||
|
(
|
||||||
|
//IOobject
|
||||||
|
//(
|
||||||
|
// polyMesh::defaultRegion,
|
||||||
|
// runTime.constant(),
|
||||||
|
// runTime,
|
||||||
|
// IOobject::NO_READ
|
||||||
|
//),
|
||||||
|
polyIO,
|
||||||
|
std::move(points),
|
||||||
|
cellShapes,
|
||||||
|
boundary,
|
||||||
|
patchNames,
|
||||||
|
boundaryDicts,
|
||||||
|
"defaultFaces",
|
||||||
|
emptyPolyPatch::typeName,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
//Info<< "Writing polyMesh" << endl;
|
||||||
|
mesh.write();
|
||||||
|
|
||||||
|
//Info<< "Reading fvMesh" << endl;
|
||||||
|
|
||||||
|
fvMeshTools::createDummyFvMeshFiles
|
||||||
|
(
|
||||||
|
io.db(),
|
||||||
|
io.name()
|
||||||
|
);
|
||||||
|
IOobject fvIO(io);
|
||||||
|
fvIO.readOpt() = IOobject::MUST_READ;
|
||||||
|
|
||||||
|
return autoPtr<fvMesh>::New(fvIO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,6 +46,8 @@ namespace Foam
|
|||||||
// Forward declaration of friend functions and operators
|
// Forward declaration of friend functions and operators
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
class OBJstream;
|
class OBJstream;
|
||||||
|
class IOobject;
|
||||||
|
class fvMesh;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class voxelMeshSearch Declaration
|
Class voxelMeshSearch Declaration
|
||||||
@ -60,7 +62,7 @@ class voxelMeshSearch
|
|||||||
//- Local mesh bounding box
|
//- Local mesh bounding box
|
||||||
boundBox localBb_;
|
boundBox localBb_;
|
||||||
|
|
||||||
//- Number of points in all directions (for local mesh only)
|
//- Number of voxels in all directions (for local mesh only)
|
||||||
labelVector nDivs_;
|
labelVector nDivs_;
|
||||||
|
|
||||||
//- Voxel to seed cell
|
//- Voxel to seed cell
|
||||||
@ -185,6 +187,10 @@ public:
|
|||||||
const boundBox&,
|
const boundBox&,
|
||||||
const labelVector&
|
const labelVector&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Debug: construct fvMesh. Note: writes a dummy mesh to
|
||||||
|
// io.timeName()! TBD.
|
||||||
|
autoPtr<fvMesh> makeMesh(const IOobject&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -57,9 +57,11 @@ snGradSchemes
|
|||||||
oversetInterpolation
|
oversetInterpolation
|
||||||
{
|
{
|
||||||
method inverseDistance;
|
method inverseDistance;
|
||||||
|
|
||||||
searchBox (0 0 0)(0.01 0.01 0.01);
|
searchBox (0 0 0)(0.01 0.01 0.01);
|
||||||
searchBoxDivisions (100 100 1);
|
searchBoxDivisions (100 100 1);
|
||||||
|
|
||||||
|
//method trackingInverseDistance;
|
||||||
|
//searchBoxDivisions 2{(100 100 1)};
|
||||||
}
|
}
|
||||||
|
|
||||||
fluxRequired
|
fluxRequired
|
||||||
|
|||||||
Reference in New Issue
Block a user