Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2011-02-15 16:55:05 +01:00
29 changed files with 2817 additions and 1571 deletions

View File

@ -2,8 +2,8 @@
word scheme("div(phi,alpha)");
word schemer("div(phir,alpha)");
surfaceScalarField phic(phi);
surfaceScalarField phir(phia - phib);
surfaceScalarField phic("phic", phi);
surfaceScalarField phir("phir", phia - phib);
if (g0.value() > 0.0)
{
@ -41,7 +41,7 @@
alphaEqn.relax();
alphaEqn.solve();
# include "packingLimiter.H"
#include "packingLimiter.H"
beta = scalar(1) - alpha;

View File

@ -210,7 +210,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
// Create some data. Use slightly perturbed positions.
Map<point> sparseData;
pointField fullData(mesh.nPoints(), point::max);
pointField fullData(mesh.nPoints(), point(GREAT, GREAT, GREAT));
forAll(localPoints, i)
{
@ -236,7 +236,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh,
fullData,
minMagSqrEqOp<point>(),
point::max
point(GREAT, GREAT, GREAT)
// true // apply separation
);
@ -246,7 +246,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
const point& fullPt = fullData[meshPointI];
if (fullPt != point::max)
if (fullPt != point(GREAT, GREAT, GREAT))
{
const point& sparsePt = sparseData[meshPointI];
@ -286,7 +286,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
// Create some data. Use slightly perturbed positions.
EdgeMap<point> sparseData;
pointField fullData(mesh.nEdges(), point::max);
pointField fullData(mesh.nEdges(), point(GREAT, GREAT, GREAT));
const edgeList& edges = allBoundary.edges();
const labelList meshEdges = allBoundary.meshEdges
@ -320,7 +320,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
mesh,
fullData,
minMagSqrEqOp<point>(),
point::max
point(GREAT, GREAT, GREAT)
);
// Compare.
@ -329,7 +329,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
{
const point& fullPt = fullData[meshEdgeI];
if (fullPt != point::max)
if (fullPt != point(GREAT, GREAT, GREAT))
{
const point& sparsePt = sparseData[mesh.edges()[meshEdgeI]];
@ -385,7 +385,7 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
mesh,
syncedPoints,
minMagSqrEqOp<point>(),
point::max
point(GREAT, GREAT, GREAT)
);
forAll(syncedPoints, pointI)
@ -461,7 +461,7 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
mesh,
syncedMids,
minMagSqrEqOp<point>(),
point::max
point(GREAT, GREAT, GREAT)
);
forAll(syncedMids, edgeI)

View File

@ -43,6 +43,7 @@ Description
#include "addPatchCellLayer.H"
#include "fvMesh.H"
#include "MeshedSurfaces.H"
#include "globalIndex.H"
#include "extrudedMesh.H"
#include "extrudeModel.H"
@ -261,6 +262,12 @@ int main(int argc, char *argv[])
sourceCasePath.expand();
fileName sourceRootDir = sourceCasePath.path();
fileName sourceCaseDir = sourceCasePath.name();
if (Pstream::parRun())
{
sourceCaseDir =
sourceCaseDir
/"processor" + Foam::name(Pstream::myProcNo());
}
wordList sourcePatches;
dict.lookup("sourcePatches") >> sourcePatches;
@ -279,54 +286,173 @@ int main(int argc, char *argv[])
sourceRootDir,
sourceCaseDir
);
#include "createMesh.H"
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Topo change container. Either copy an existing mesh or start
// with empty storage (number of patches only needed for checking)
autoPtr<polyTopoChange> meshMod
(
(
mode == MESH
? new polyTopoChange(mesh)
: new polyTopoChange(patches.size())
)
);
// Extrusion engine. Either adding to existing mesh or
// creating separate mesh.
addPatchCellLayer layerExtrude(mesh, (mode == MESH));
const labelList meshFaces(patchFaces(patches, sourcePatches));
indirectPrimitivePatch extrudePatch
(
IndirectList<face>
(
mesh.faces(),
patchFaces(patches, sourcePatches)
meshFaces
),
mesh.points()
);
// Determine extrudePatch normal
pointField extrudePatchPointNormals
(
PatchTools::pointNormals //calcNormals
(
mesh,
extrudePatch,
meshFaces
)
);
// Precalculate mesh edges for pp.edges.
const labelList meshEdges
(
extrudePatch.meshEdges
(
mesh.edges(),
mesh.pointEdges()
)
);
// Global face indices engine
const globalIndex globalFaces(mesh.nFaces());
// Determine extrudePatch.edgeFaces in global numbering (so across
// coupled patches)
labelListList edgeGlobalFaces
(
addPatchCellLayer::globalEdgeFaces
(
mesh,
globalFaces,
extrudePatch
)
);
// Determine what patches boundary edges need to get extruded into.
// This might actually cause edge-connected processors to become
// face-connected so might need to introduce new processor boundaries.
// Calculates:
// - per pp.edge the patch to extrude into
// - any additional processor boundaries (patchToNbrProc = map from
// new patchID to neighbour processor)
// - number of new patches (nPatches)
labelList sidePatchID;
label nPatches;
Map<label> nbrProcToPatch;
Map<label> patchToNbrProc;
addPatchCellLayer::calcSidePatch
(
mesh,
globalFaces,
edgeGlobalFaces,
extrudePatch,
sidePatchID,
nPatches,
nbrProcToPatch,
patchToNbrProc
);
// Add any patches.
label nAdded = nPatches - mesh.boundaryMesh().size();
reduce(nAdded, sumOp<label>());
Info<< "Adding overall " << nAdded << " processor patches." << endl;
if (nAdded > 0)
{
DynamicList<polyPatch*> newPatches(nPatches);
forAll(mesh.boundaryMesh(), patchI)
{
newPatches.append
(
mesh.boundaryMesh()[patchI].clone
(
mesh.boundaryMesh()
).ptr()
);
}
for
(
label patchI = mesh.boundaryMesh().size();
patchI < nPatches;
patchI++
)
{
label nbrProcI = patchToNbrProc[patchI];
word name =
"procBoundary"
+ Foam::name(Pstream::myProcNo())
+ "to"
+ Foam::name(nbrProcI);
Pout<< "Adding patch " << patchI
<< " name:" << name
<< " between " << Pstream::myProcNo()
<< " and " << nbrProcI
<< endl;
newPatches.append
(
new processorPolyPatch
(
name,
0, // size
mesh.nFaces(), // start
patchI, // index
mesh.boundaryMesh(),// polyBoundaryMesh
Pstream::myProcNo(),// myProcNo
nbrProcI // neighbProcNo
)
);
}
// Add patches. Do no parallel updates.
mesh.removeFvBoundary();
mesh.addFvPatches(newPatches, true);
}
// Only used for addPatchCellLayer into new mesh
labelList exposedPatchIDs;
labelList exposedPatchID;
if (mode == PATCH)
{
dict.lookup("exposedPatchName") >> backPatchName;
exposedPatchIDs.setSize
exposedPatchID.setSize
(
extrudePatch.size(),
findPatchID(patches, backPatchName)
);
}
// Determine points and extrusion
pointField layer0Points(extrudePatch.nPoints());
pointField displacement(extrudePatch.nPoints());
forAll(displacement, pointI)
{
const vector& patchNormal = extrudePatch.pointNormals()[pointI];
const vector& patchNormal = extrudePatchPointNormals[pointI];
// layer0 point
layer0Points[pointI] = model()
@ -373,15 +499,31 @@ int main(int argc, char *argv[])
// Layers per point
labelList nPointLayers(extrudePatch.nPoints(), model().nLayers());
// Displacement for first layer
vectorField firstLayerDisp(displacement*model().sumThickness(1));
vectorField firstLayerDisp = displacement*model().sumThickness(1);
// Expansion ratio not used.
scalarField ratio(extrudePatch.nPoints(), 1.0);
// Topo change container. Either copy an existing mesh or start
// with empty storage (number of patches only needed for checking)
autoPtr<polyTopoChange> meshMod
(
(
mode == MESH
? new polyTopoChange(mesh)
: new polyTopoChange(patches.size())
)
);
layerExtrude.setRefinement
(
globalFaces,
edgeGlobalFaces,
ratio, // expansion ratio
extrudePatch, // patch faces to extrude
exposedPatchIDs, // if new mesh: patches for exposed faces
sidePatchID, // if boundary edge: patch to use
exposedPatchID, // if new mesh: patches for exposed faces
nFaceLayers,
nPointLayers,
firstLayerDisp,
@ -401,7 +543,7 @@ int main(int argc, char *argv[])
model()
(
extrudePatch.localPoints()[pointI],
extrudePatch.pointNormals()[pointI],
extrudePatchPointNormals[pointI],
pPointI+1 // layer
)
);

View File

@ -1,25 +1,32 @@
EXE_LIBS = \
-lautoMesh \
-lbarotropicCompressibilityModel \
-lbasicSolidThermo \
-lbasicThermophysicalModels \
-lblockMesh \
-lchemistryModel \
-lcoalCombustion \
-lcombustionModels \
-lcompressibleLESModels \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lconversion \
-ldecompositionMethods \
-ldieselSpray \
-ldistributed \
-ldistributionModels \
-ldsmc \
-ldynamicFvMesh \
-ldynamicMesh \
-ledgeMesh \
-lengine \
-lerrorEstimation \
-lEulerianInterfacialModels \
-lextrudeModel \
-lfieldFunctionObjects \
-lfileFormats \
-lfiniteVolume \
-lfoamCalcFunctions \
-lforces \
-lfvMotionSolvers \
-lgenericPatchFields \
@ -29,6 +36,8 @@ EXE_LIBS = \
-lincompressibleTurbulenceModel \
-linterfaceProperties \
-lIOFunctionObjects \
-ljobControl \
-lkineticTheoryModel \
-llagrangian \
-llagrangianIntermediate \
-llaminarFlameSpeedModels \
@ -37,22 +46,29 @@ EXE_LIBS = \
-lliquidMixtureProperties \
-lliquidProperties \
-lmeshTools \
-lMGridGenGAMGAgglomeration \
-lmolecularMeasurements \
-lmolecule \
-lmultiphaseInterFoam \
-lODE \
-lOpenFOAM \
-ldistributionModels \
-lphaseModel \
-lpotential \
-lradiationModels \
-lrandomProcesses \
-lreactionThermophysicalModels \
-lreconstruct \
-lsampling \
-lSLGThermo \
-lsolidMixtureProperties \
-lsolidParticle \
-lsolidProperties \
-lsolid \
-lspecie \
-lsurfaceFilmModels \
-lsurfMesh \
-lsystemCall \
-ltabulatedWallFunctions \
-lthermalPorousZone \
-lthermophysicalFunctions \
-ltopoChangerFvMesh \

View File

@ -73,8 +73,8 @@ autoPtr<fvMesh> createMesh
const bool haveMesh
)
{
Pout<< "Create mesh for time = "
<< runTime.timeName() << nl << endl;
//Pout<< "Create mesh for time = "
// << runTime.timeName() << nl << endl;
IOobject io
(
@ -98,12 +98,12 @@ autoPtr<fvMesh> createMesh
xferCopy(labelList()),
false
);
Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath()
<< endl;
//Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath()
// << endl;
dummyMesh.write();
}
Pout<< "Reading mesh from " << io.objectPath() << endl;
//Pout<< "Reading mesh from " << io.objectPath() << endl;
autoPtr<fvMesh> meshPtr(new fvMesh(io));
fvMesh& mesh = meshPtr();
@ -201,9 +201,8 @@ autoPtr<fvMesh> createMesh
break;
}
Pout<< "Adding patch:" << nPatches
<< " name:" << name
<< " type:" << type << endl;
//Pout<< "Adding patch:" << nPatches
// << " name:" << name << " type:" << type << endl;
dictionary patchDict(e.dict());
patchDict.remove("nFaces");
@ -282,8 +281,7 @@ autoPtr<fvMesh> createMesh
if (!haveMesh)
{
// We created a dummy mesh file above. Delete it.
Pout<< "Removing dummy mesh " << io.objectPath()
<< endl;
//Pout<< "Removing dummy mesh " << io.objectPath() << endl;
rmDir(io.objectPath());
}
@ -351,17 +349,19 @@ scalar getMergeDistance
}
void printMeshData(Ostream& os, const polyMesh& mesh)
{
os << "Number of points: " << mesh.points().size() << nl
<< " faces: " << mesh.faces().size() << nl
<< " internal faces: " << mesh.faceNeighbour().size() << nl
<< " cells: " << mesh.cells().size() << nl
<< " boundary patches: " << mesh.boundaryMesh().size() << nl
<< " point zones: " << mesh.pointZones().size() << nl
<< " face zones: " << mesh.faceZones().size() << nl
<< " cell zones: " << mesh.cellZones().size() << nl;
}
//void printMeshData(Ostream& os, const polyMesh& mesh)
//{
// os << "Number of points: " << mesh.points().size() << nl
// << " faces: " << mesh.faces().size() << nl
// << " internal faces: " << mesh.faceNeighbour().size() << nl
// << " cells: " << mesh.cells().size() << nl
// << " boundary patches: " << mesh.boundaryMesh().size() << nl
// << " point zones: " << mesh.pointZones().size() << nl
// << " face zones: " << mesh.faceZones().size() << nl
// << " cell zones: " << mesh.cellZones().size() << nl;
//}
void printMeshData(const polyMesh& mesh)
{
// Collect all data on master
@ -525,6 +525,7 @@ void readFields
// Receive field
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
dictionary fieldDict(fromMaster);
fields.set
(
@ -540,7 +541,7 @@ void readFields
IOobject::AUTO_WRITE
),
mesh,
fromMaster
fieldDict
)
);
@ -916,8 +917,8 @@ int main(int argc, char *argv[])
// Mesh distribution engine
fvMeshDistribute distributor(mesh, tolDim);
Pout<< "Wanted distribution:"
<< distributor.countCells(finalDecomp) << nl << endl;
//Pout<< "Wanted distribution:"
// << distributor.countCells(finalDecomp) << nl << endl;
// Do actual sending/receiving of mesh
autoPtr<mapDistributePolyMesh> map = distributor.distribute(finalDecomp);
@ -987,7 +988,7 @@ int main(int argc, char *argv[])
Info<< endl;
Pout<< "End\n" << endl;
Info<< "End\n" << endl;
return 0;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,6 +36,7 @@ Description
#include "Time.H"
#include "surfaceFeatures.H"
#include "featureEdgeMesh.H"
#include "extendedFeatureEdgeMesh.H"
#include "treeBoundBox.H"
#include "meshTools.H"
#include "OFstream.H"
@ -298,20 +299,46 @@ int main(int argc, char *argv[])
// Extracting and writing a featureEdgeMesh
Pout<< nl << "Writing featureEdgeMesh to constant/featureEdgeMesh."
<< endl;
featureEdgeMesh feMesh
extendedFeatureEdgeMesh feMesh
(
newSet,
runTime,
surfFileName.lessExt().name() + ".featureEdgeMesh"
);
Info<< nl << "Writing extendedFeatureEdgeMesh to " << feMesh.objectPath()
<< endl;
feMesh.writeObj(surfFileName.lessExt().name());
feMesh.write();
// Write a featureEdgeMesh for backwards compatibility
{
featureEdgeMesh bfeMesh
(
IOobject
(
surfFileName.lessExt().name() + ".eMesh", // name
runTime.constant(), // instance
"triSurface",
runTime, // registry
IOobject::NO_READ,
IOobject::AUTO_WRITE,
false
),
feMesh.points(),
feMesh.edges()
);
Info<< nl << "Writing featureEdgeMesh to "
<< bfeMesh.objectPath() << endl;
bfeMesh.regIOobject::write();
}
Info<< "End\n" << endl;
return 0;