Merge branch 'master' of ssh://opencfd:8007/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2013-10-30 23:13:42 +00:00
35 changed files with 642 additions and 235 deletions

View File

@ -70,7 +70,7 @@
(
IOobject
(
"rho*phi",
"rhoPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,

View File

@ -83,14 +83,14 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
(
IOobject
(
"rho*phi",
"rhoPhi",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("rho*phi", dimMass/dimTime, 0.0)
dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0)
),
alphas_

View File

@ -77,19 +77,26 @@ int main(int argc, char *argv[])
#include "setrDeltaT.H"
twoPhaseProperties.correct();
#define LTSSOLVE
#include "alphaEqnSubCycle.H"
#undef LTSSOLVE
interface.correct();
turbulence->correct();
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties.correct();
#define LTSSOLVE
#include "alphaEqnSubCycle.H"
#undef LTSSOLVE
interface.correct();
}
turbulence->correct();
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -81,15 +81,22 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
#include "zonePhaseVolumes.H"
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
#include "zonePhaseVolumes.H"
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -1,4 +1,4 @@
EXE_INC = \
EXE_INC = -ggdb3 \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \

View File

@ -6,9 +6,7 @@
phic = min(interface.cAlpha()*phic, max(phic));
surfaceScalarField phir(phic*interface.nHatf());
tmp<surfaceScalarField> tphiAlpha;
if (MULESCorr)
if (pimple.firstIter() && MULESCorr)
{
fvScalarMatrix alpha1Eqn
(

View File

@ -1,5 +1,3 @@
#include "alphaControls.H"
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();

View File

@ -62,13 +62,14 @@
(
IOobject
(
"rho*phi",
"rhoPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho1*phi
mesh,
dimensionedScalar("0", dimMass/dimTime, 0)
);

View File

@ -77,46 +77,56 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
interface.correct();
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
interface.correct();
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -1,6 +1,16 @@
#include "readTimeControls.H"
#include "readTimeControls.H"
bool correctPhi =
pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
bool checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
bool correctPhi
(
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
);
bool moveMeshOuterCorrectors
(
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
);

View File

@ -80,14 +80,21 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -63,7 +63,7 @@
(
IOobject
(
"rho*phi",
"rhoPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,

View File

@ -74,16 +74,23 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
threePhaseProperties.correct();
#include "alphaEqnsSubCycle.H"
interface.correct();
#define twoPhaseProperties threePhaseProperties
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
threePhaseProperties.correct();
#include "alphaEqnsSubCycle.H"
interface.correct();
#define twoPhaseProperties threePhaseProperties
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -83,14 +83,21 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
tmp<surfaceScalarField> tphiAlpha;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties.correct();
#include "alphaEqnSubCycle.H"
interface.correct();
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -1,18 +1,4 @@
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", dimMass/dimTime, 0)
);
{
#include "alphaControls.H"
surfaceScalarField phic(mag(phi/mesh.magSf()));
phic = min(interface.cAlpha()*phic, max(phic));

View File

@ -86,44 +86,64 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "../interFoam/interDyMFoam/correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
twoPhaseProperties->correct();
#include "alphaEqnSubCycle.H"
interface.correct();
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
mesh.update();
if (mesh.changing())
{
Info<< "Execution time for mesh.update() = "
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
<< " s" << endl;
gh = g & mesh.C();
ghf = g & mesh.Cf();
}
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "../interFoam/interDyMFoam/correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
#include "alphaControls.H"
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", dimMass/dimTime, 0)
);
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties->correct();
#include "alphaEqnSubCycle.H"
interface.correct();
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -83,14 +83,31 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
twoPhaseProperties->correct();
#include "alphaEqnSubCycle.H"
interface.correct();
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "alphaControls.H"
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("0", dimMass/dimTime, 0)
);
if (pimple.firstIter() || alphaOuterCorrectors)
{
twoPhaseProperties->correct();
#include "alphaEqnSubCycle.H"
interface.correct();
}
#include "UEqn.H"
// --- Pressure corrector loop

View File

@ -87,14 +87,14 @@ Foam::multiphaseMixture::multiphaseMixture
(
IOobject
(
"rho*phi",
"rhoPhi",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("rho*phi", dimMass/dimTime, 0.0)
dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0)
),
alphas_

View File

@ -54,7 +54,7 @@
(
IOobject
(
"rho*phi",
"rhoPhi",
runTime.timeName(),
mesh,
IOobject::NO_READ,

View File

@ -1253,6 +1253,9 @@ int main(int argc, char *argv[])
// Snap parameters
const snapParameters snapParams(snapDict);
// Layer addition parameters
const layerParameters layerParams(layerDict, mesh.boundaryMesh());
if (wantRefine)
{
@ -1346,9 +1349,6 @@ int main(int argc, char *argv[])
globalToSlavePatch
);
// Layer addition parameters
layerParameters layerParams(layerDict, mesh.boundaryMesh());
// Use the maxLocalCells from the refinement parameters
bool preBalance = returnReduce
(

View File

@ -304,11 +304,13 @@ addLayersControls
// size of the refined cell outside layer (true) or absolute sizes (false).
relativeSizes true;
// Layer thickness specification. This can be specified in one of four ways
// Layer thickness specification. This can be specified in one of following
// ways:
// - expansionRatio and finalLayerThickness (cell nearest internal mesh)
// - expansionRatio and firstLayerThickness (cell on surface)
// - overall thickness and firstLayerThickness
// - overall thickness and finalLayerThickness
// - overall thickness and expansionRatio
// Expansion factor for layer mesh
expansionRatio 1.0;

View File

@ -720,6 +720,20 @@ int main(int argc, char *argv[])
PtrList<faceSet> faceSets(fSetNames.size());
PtrList<pointSet> pointSets(pSetNames.size());
Info<< "Reconstructing sets:" << endl;
if (cSetNames.size())
{
Info<< " cellSets " << cSetNames.sortedToc() << endl;
}
if (fSetNames.size())
{
Info<< " faceSets " << fSetNames.sortedToc() << endl;
}
if (pSetNames.size())
{
Info<< " pointSets " << pSetNames.sortedToc() << endl;
}
// Load sets
forAll(procMeshes.meshes(), procI)
{

View File

@ -542,8 +542,11 @@ public:
//- Compact maps. Gets per field a bool whether it is used (locally)
// and works out itself what this side and sender side can remove
// from maps.
void compact(const boolList& elemIsUsed, const int tag);
void compact
(
const boolList& elemIsUsed,
const int tag = UPstream::msgType()
);
//- Distribute data. Note:schedule only used for Pstream::scheduled
// for now, all others just use send-to-all, receive-from-all.

View File

@ -1,4 +1,12 @@
const dictionary& alphaControls = mesh.solverDict(alpha1.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
Switch MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
bool alphaOuterCorrectors
(
alphaControls.lookupOrDefault<Switch>("alphaOuterCorrectors", false)
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -129,6 +129,9 @@ public:
//- Helper function to identify when to store the intial residuals
inline bool storeInitialResiduals() const;
//- Helper function to identify first PIMPLE (outer) iteration
inline bool firstIter() const;
//- Helper function to identify final PIMPLE (outer) iteration
inline bool finalIter() const;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -66,14 +66,20 @@ inline bool Foam::pimpleControl::correct()
inline bool Foam::pimpleControl::storeInitialResiduals() const
{
// start from second PIMPLE iteration
// Start from second PIMPLE iteration
return (corr_ == 2) && (corrPISO_ == 0) && (corrNonOrtho_ == 0);
}
inline bool Foam::pimpleControl::firstIter() const
{
return corr_ == 1;
}
inline bool Foam::pimpleControl::finalIter() const
{
return converged_ || (corr_ == nCorrPIMPLE_);
return converged_ || (corr_ == corrPISO_);
}

View File

@ -52,6 +52,7 @@ Description
#include "fixedValuePointPatchFields.H"
#include "calculatedPointPatchFields.H"
#include "cyclicSlipPointPatchFields.H"
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -110,6 +111,31 @@ void Foam::autoLayerDriver::dumpDisplacement
}
Foam::tmp<Foam::scalarField> Foam::autoLayerDriver::avgPointData
(
const indirectPrimitivePatch& pp,
const scalarField& pointFld
)
{
tmp<scalarField> tfaceFld(new scalarField(pp.size(), 0.0));
scalarField& faceFld = tfaceFld();
forAll(pp.localFaces(), faceI)
{
const face& f = pp.localFaces()[faceI];
if (f.size())
{
forAll(f, fp)
{
faceFld[faceI] += pointFld[f[fp]];
}
faceFld[faceI] /= f.size();
}
}
return tfaceFld;
}
// Check that primitivePatch is not multiply connected. Collect non-manifold
// points in pointSet.
void Foam::autoLayerDriver::checkManifold
@ -2391,19 +2417,21 @@ Foam::label Foam::autoLayerDriver::countExtrusion
}
// Collect layer faces and layer cells into bools for ease of handling
// Collect layer faces and layer cells into mesh fields for ease of handling
void Foam::autoLayerDriver::getLayerCellsFaces
(
const polyMesh& mesh,
const addPatchCellLayer& addLayer,
boolList& flaggedCells,
boolList& flaggedFaces
const scalarField& oldRealThickness,
labelList& cellNLayers,
scalarField& faceRealThickness
)
{
flaggedCells.setSize(mesh.nCells());
flaggedCells = false;
flaggedFaces.setSize(mesh.nFaces());
flaggedFaces = false;
cellNLayers.setSize(mesh.nCells());
cellNLayers = 0;
faceRealThickness.setSize(mesh.nFaces());
faceRealThickness = 0;
// Mark all faces in the layer
const labelListList& layerFaces = addLayer.layerFaces();
@ -2415,27 +2443,195 @@ void Foam::autoLayerDriver::getLayerCellsFaces
{
const labelList& added = addedCells[oldPatchFaceI];
forAll(added, i)
const labelList& layer = layerFaces[oldPatchFaceI];
if (layer.size())
{
flaggedCells[added[i]] = true;
forAll(added, i)
{
cellNLayers[added[i]] = layer.size()-1;
}
}
}
forAll(layerFaces, oldPatchFaceI)
{
const labelList& layer = layerFaces[oldPatchFaceI];
const scalar realThickness = oldRealThickness[oldPatchFaceI];
if (layer.size())
{
for (label i = 1; i < layer.size()-1; i++)
// Layer contains both original boundary face and new boundary
// face so is nLayers+1
forAll(layer, i)
{
flaggedFaces[layer[i]] = true;
faceRealThickness[layer[i]] = realThickness;
}
}
}
}
bool Foam::autoLayerDriver::writeLayerData
(
const fvMesh& mesh,
const labelList& patchIDs,
const labelList& cellNLayers,
const scalarField& faceWantedThickness,
const scalarField& faceRealThickness
) const
{
bool allOk = true;
{
label nAdded = 0;
forAll(cellNLayers, cellI)
{
if (cellNLayers[cellI] > 0)
{
nAdded++;
}
}
cellSet addedCellSet(mesh, "addedCells", nAdded);
forAll(cellNLayers, cellI)
{
if (cellNLayers[cellI] > 0)
{
addedCellSet.insert(cellI);
}
}
addedCellSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(addedCellSet.size(), sumOp<label>())
<< " added cells to cellSet "
<< addedCellSet.name() << endl;
bool ok = addedCellSet.write();
allOk = allOk & ok;
}
{
label nAdded = 0;
forAll(faceRealThickness, faceI)
{
if (faceRealThickness[faceI] > 0)
{
nAdded++;
}
}
faceSet layerFacesSet(mesh, "layerFaces", nAdded);
forAll(faceRealThickness, faceI)
{
if (faceRealThickness[faceI] > 0)
{
layerFacesSet.insert(faceI);
}
}
layerFacesSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(layerFacesSet.size(), sumOp<label>())
<< " faces inside added layer to faceSet "
<< layerFacesSet.name() << endl;
bool ok = layerFacesSet.write();
allOk = allOk & ok;
}
{
volScalarField fld
(
IOobject
(
"nSurfaceLayers",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("zero", dimless, 0),
fixedValueFvPatchScalarField::typeName
);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& pp = pbm[patchI];
const labelList& faceCells = pp.faceCells();
scalarField pfld(faceCells.size());
forAll(faceCells, i)
{
pfld[i] = cellNLayers[faceCells[i]];
}
fld.boundaryField()[patchI] == pfld;
}
Info<< "Writing volScalarField " << fld.name()
<< " with actual number of layers" << endl;
bool ok = fld.write();
allOk = allOk & ok;
}
{
volScalarField fld
(
IOobject
(
"wantedThickness",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("zero", dimless, 0),
fixedValueFvPatchScalarField::typeName
);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
fld.boundaryField()[patchI] == pbm[patchI].patchSlice
(
faceWantedThickness
);
}
Info<< "Writing volScalarField " << fld.name()
<< " with wanted thickness" << endl;
bool ok = fld.write();
allOk = allOk & ok;
}
{
volScalarField fld
(
IOobject
(
"thickness",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("zero", dimless, 0),
fixedValueFvPatchScalarField::typeName
);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
fld.boundaryField()[patchI] == pbm[patchI].patchSlice
(
faceRealThickness
);
}
Info<< "Writing volScalarField " << fld.name()
<< " with layer thickness" << endl;
bool ok = fld.write();
allOk = allOk & ok;
}
return allOk;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::autoLayerDriver::autoLayerDriver
@ -2618,7 +2814,7 @@ void Foam::autoLayerDriver::addLayers
labelList patchNLayers(pp().nPoints(), 0);
// Ideal number of cells added
label nIdealAddedCells = 0;
label nIdealTotAddedCells = 0;
// Whether to add edge for all pp.localPoints.
List<extrudeMode> extrudeStatus(pp().nPoints(), EXTRUDE);
@ -2637,7 +2833,7 @@ void Foam::autoLayerDriver::addLayers
patchDisp,
patchNLayers,
extrudeStatus,
nIdealAddedCells
nIdealTotAddedCells
);
// Precalculate mesh edge labels for patch edges
@ -2835,11 +3031,20 @@ void Foam::autoLayerDriver::addLayers
// Saved old points
pointField oldPoints(mesh.points());
// Last set of topology changes. (changing mesh clears out polyTopoChange)
// Current set of topology changes. (changing mesh clears out
// polyTopoChange)
polyTopoChange savedMeshMod(mesh.boundaryMesh().size());
// Per cell 0 or number of layers in the cell column it is part of
labelList cellNLayers;
// Per face actual overall layer thickness
scalarField faceRealThickness;
// Per face wanted overall layer thickness
scalarField faceWantedThickness(mesh.nFaces(), 0.0);
{
UIndirectList<scalar>(faceWantedThickness, pp().addressing()) =
avgPointData(pp, thickness);
}
boolList flaggedCells;
boolList flaggedFaces;
for (label iteration = 0; iteration < layerParams.nLayerIter(); iteration++)
{
@ -3088,35 +3293,52 @@ void Foam::autoLayerDriver::addLayers
(
newMesh,
addLayer,
flaggedCells,
flaggedFaces
avgPointData(pp, mag(patchDisp))(), // current thickness
cellNLayers,
faceRealThickness
);
// Count number of added cells
label nAddedCells = 0;
forAll(cellNLayers, cellI)
{
if (cellNLayers[cellI] > 0)
{
nAddedCells++;
}
}
if (debug&meshRefinement::MESH)
{
Info<< "Writing layer mesh to time " << meshRefiner_.timeName()
<< endl;
newMesh.write();
cellSet addedCellSet
(
newMesh,
"addedCells",
findIndices(flaggedCells, true)
);
cellSet addedCellSet(newMesh," addedCells", nAddedCells);
forAll(cellNLayers, cellI)
{
if (cellNLayers[cellI] > 0)
{
addedCellSet.insert(cellI);
}
}
addedCellSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(addedCellSet.size(), sumOp<label>())
<< " added cells to cellSet "
<< addedCellSet.name() << endl;
<< " added cells to cellSet " << addedCellSet.name() << endl;
addedCellSet.write();
faceSet layerFacesSet
(
newMesh,
"layerFaces",
findIndices(flaggedCells, true)
);
faceSet layerFacesSet(newMesh, "layerFaces", newMesh.nFaces()/100);
forAll(faceRealThickness, faceI)
{
if (faceRealThickness[faceI] > 0)
{
layerFacesSet.insert(faceI);
}
}
layerFacesSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(layerFacesSet.size(), sumOp<label>())
@ -3140,26 +3362,17 @@ void Foam::autoLayerDriver::addLayers
extrudeStatus
);
label nExtruded = countExtrusion(pp, extrudeStatus);
label nTotExtruded = countExtrusion(pp, extrudeStatus);
label nTotFaces = returnReduce(pp().size(), sumOp<label>());
label nAddedCells = 0;
{
forAll(flaggedCells, cellI)
{
if (flaggedCells[cellI])
{
nAddedCells++;
}
}
reduce(nAddedCells, sumOp<label>());
}
Info<< "Extruding " << nExtruded
label nTotAddedCells = returnReduce(nAddedCells, sumOp<label>());
Info<< "Extruding " << nTotExtruded
<< " out of " << nTotFaces
<< " faces (" << 100.0*nExtruded/nTotFaces << "%)."
<< " faces (" << 100.0*nTotExtruded/nTotFaces << "%)."
<< " Removed extrusion at " << nTotChanged << " faces."
<< endl
<< "Added " << nAddedCells << " out of " << nIdealAddedCells
<< " cells (" << 100.0*nAddedCells/nIdealAddedCells << "%)."
<< "Added " << nTotAddedCells << " out of " << nIdealTotAddedCells
<< " cells (" << 100.0*nTotAddedCells/nIdealTotAddedCells << "%)."
<< endl;
if (nTotChanged == 0)
@ -3217,6 +3430,8 @@ void Foam::autoLayerDriver::addLayers
meshRefiner_.updateMesh(map, labelList(0));
// Update numbering of faceWantedThickness
meshRefinement::updateList(map().faceMap(), 0.0, faceWantedThickness);
// Update numbering on baffles
forAll(baffles, i)
@ -3237,8 +3452,9 @@ void Foam::autoLayerDriver::addLayers
autoPtr<mapPolyMesh> map = meshRefiner_.mergeBaffles(baffles);
inplaceReorder(map().reverseCellMap(), flaggedCells);
inplaceReorder(map().reverseFaceMap(), flaggedFaces);
inplaceReorder(map().reverseCellMap(), cellNLayers);
inplaceReorder(map().reverseFaceMap(), faceWantedThickness);
inplaceReorder(map().reverseFaceMap(), faceRealThickness);
Info<< "Converted baffles in = "
<< meshRefiner_.mesh().time().cpuTimeIncrement()
@ -3272,29 +3488,23 @@ void Foam::autoLayerDriver::addLayers
);
// Re-distribute flag of layer faces and cells
map().distributeCellData(flaggedCells);
map().distributeFaceData(flaggedFaces);
map().distributeCellData(cellNLayers);
map().distributeFaceData(faceWantedThickness);
map().distributeFaceData(faceRealThickness);
}
// Write mesh
// ~~~~~~~~~~
// Write mesh data
// ~~~~~~~~~~~~~~~
cellSet addedCellSet(mesh, "addedCells", findIndices(flaggedCells, true));
addedCellSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(addedCellSet.size(), sumOp<label>())
<< " added cells to cellSet "
<< addedCellSet.name() << endl;
addedCellSet.write();
faceSet layerFacesSet(mesh, "layerFaces", findIndices(flaggedFaces, true));
layerFacesSet.instance() = meshRefiner_.timeName();
Info<< "Writing "
<< returnReduce(layerFacesSet.size(), sumOp<label>())
<< " faces inside added layer to faceSet "
<< layerFacesSet.name() << endl;
layerFacesSet.write();
writeLayerData
(
mesh,
patchIDs,
cellNLayers,
faceWantedThickness,
faceRealThickness
);
}

View File

@ -120,6 +120,13 @@ class autoLayerDriver
const List<extrudeMode>&
);
//- Average point wise data to face wise
static tmp<scalarField> avgPointData
(
const indirectPrimitivePatch&,
const scalarField& pointFld
);
//- Check that primitivePatch is not multiply connected.
// Collect non-manifold points in pointSet.
static void checkManifold
@ -367,10 +374,23 @@ class autoLayerDriver
(
const polyMesh&,
const addPatchCellLayer&,
boolList&,
boolList&
const scalarField& oldRealThickness,
labelList& cellStatus,
scalarField& faceRealThickness
);
//- Write cellSet,faceSet for layers
bool writeLayerData
(
const fvMesh& mesh,
const labelList& patchIDs,
const labelList& cellNLayers,
const scalarField& faceWantedThickness,
const scalarField& faceRealThickness
) const;
// Mesh shrinking (to create space for layers)
//- Average field (over all subset of mesh points) by

View File

@ -235,6 +235,12 @@ Foam::layerParameters::layerParameters
Info<< "Layer thickness specified as final layer and expansion ratio."
<< endl;
}
else if (haveTotal && haveExp)
{
layerSpec_ = TOTAL_AND_EXPANSION;
Info<< "Layer thickness specified as overall thickness"
<< " and expansion ratio." << endl;
}
if (layerSpec_ == ILLEGAL || nSpec != 2)
@ -253,7 +259,9 @@ Foam::layerParameters::layerParameters
<< " final layer thickness ('finalLayerThickness')"
<< " and expansion ratio ('expansionRatio') or" << nl
<< " final layer thickness ('finalLayerThickness')"
<< " and overall thickness ('thickness')"
<< " and overall thickness ('thickness') or" << nl
<< " overall thickness ('thickness')"
<< " and expansion ratio ('expansionRatio'"
<< exit(FatalIOError);
}
@ -354,6 +362,19 @@ Foam::layerParameters::layerParameters
);
break;
case TOTAL_AND_EXPANSION:
layerDict.readIfPresent
(
"thickness",
thickness_[patchI]
);
layerDict.readIfPresent
(
"expansionRatio",
expansionRatio_[patchI]
);
break;
default:
FatalIOErrorIn
(
@ -390,6 +411,7 @@ Foam::scalar Foam::layerParameters::layerThickness
{
case FIRST_AND_TOTAL:
case FINAL_AND_TOTAL:
case TOTAL_AND_EXPANSION:
{
return totalThickness;
}
@ -450,6 +472,7 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
{
case FIRST_AND_EXPANSION:
case FINAL_AND_EXPANSION:
case TOTAL_AND_EXPANSION:
{
return expansionRatio;
}
@ -524,6 +547,18 @@ Foam::scalar Foam::layerParameters::firstLayerThickness
}
break;
case TOTAL_AND_EXPANSION:
{
scalar r = finalLayerThicknessRatio
(
nLayers,
expansionRatio
);
scalar finalThickness = r*totalThickness;
return finalThickness/pow(expansionRatio, nLayers-1);
}
break;
default:
{
FatalErrorIn("layerParameters::layerThickness(..)")

View File

@ -64,13 +64,15 @@ public:
// - first and expansion ratio specified
// - final and total thickness specified
// - final and expansion ratio specified
// - total thickness and expansion ratio specified
enum layerSpecification
{
ILLEGAL,
FIRST_AND_TOTAL,
FIRST_AND_EXPANSION,
FINAL_AND_TOTAL,
FINAL_AND_EXPANSION
FINAL_AND_EXPANSION,
TOTAL_AND_EXPANSION
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,6 +31,15 @@ License
void Foam::processorMeshes::read()
{
forAll(databases_, procI)
{
meshes_.set(procI, NULL);
pointProcAddressing_.set(procI, NULL);
faceProcAddressing_.set(procI, NULL);
cellProcAddressing_.set(procI, NULL);
boundaryProcAddressing_.set(procI, NULL);
}
forAll(databases_, procI)
{
meshes_.set

View File

@ -47,8 +47,8 @@ runTimeModifiable yes;
adjustTimeStep yes;
maxCo 0.5;
maxAlphaCo 0.5;
maxCo 1;
maxAlphaCo 1;
maxDeltaT 1;

View File

@ -19,16 +19,25 @@ solvers
{
alpha.water
{
nAlphaCorr 1;
nAlphaSubCycles 2;
nAlphaCorr 2;
nAlphaSubCycles 1;
alphaOuterCorrectors yes;
cAlpha 1;
MULESCorr yes;
nLimiterIter 3;
solver PBiCG;
preconditioner DILU;
tolerance 1e-8;
relTol 0;
}
pcorr
{
solver PCG;
preconditioner DIC;
tolerance 1e-10;
tolerance 1e-5;
relTol 0;
}
@ -43,14 +52,13 @@ solvers
p_rghFinal
{
$p_rgh;
tolerance 1e-07;
relTol 0;
}
U
{
solver PBiCG;
preconditioner DILU;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-06;
relTol 0;
}
@ -58,10 +66,22 @@ solvers
PIMPLE
{
momentumPredictor no;
nCorrectors 3;
momentumPredictor no;
nOuterCorrectors 1;
nCorrectors 3;
nNonOrthogonalCorrectors 0;
}
relaxationFactors
{
fields
{
}
equations
{
".*" 1;
}
}
// ************************************************************************* //

View File

@ -39,7 +39,7 @@ FoamFile
bullet
{
type wall;
nFaces 37752;
nFaces 37743;
startFace 1133431;
}
)