Commit dc9f4c77 authored by andy's avatar andy
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents a242ce72 630a4b0b
......@@ -2,7 +2,9 @@ scalar DiNum = -GREAT;
forAll(solidRegions, i)
{
#include "setRegionSolidFields.H"
//- Note: do not use setRegionSolidFields.H to avoid double registering Cp
//#include "setRegionSolidFields.H"
const solidThermo& thermo = thermos[i];
tmp<volScalarField> magKappa;
if (thermo.isotropic())
......@@ -14,6 +16,12 @@ forAll(solidRegions, i)
magKappa = mag(thermo.Kappa());
}
tmp<volScalarField> tcp = thermo.Cp();
const volScalarField& cp = tcp();
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = max
(
solidRegionDiffNo
......
......@@ -576,25 +576,30 @@ void writeMesh
(
const string& msg,
const meshRefinement& meshRefiner,
const bool writeLevel,
const label debug
const meshRefinement::debugType debugLevel,
const meshRefinement::writeType writeLevel
)
{
const fvMesh& mesh = meshRefiner.mesh();
meshRefiner.printMeshInfo(debug, msg);
meshRefiner.printMeshInfo(debugLevel, msg);
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
label flag = meshRefinement::MESH;
if (writeLevel)
{
flag |= meshRefinement::SCALARLEVELS;
}
if (debug & meshRefinement::OBJINTERSECTIONS)
{
flag |= meshRefinement::OBJINTERSECTIONS;
}
meshRefiner.write(flag, mesh.time().path()/meshRefiner.timeName());
//label flag = meshRefinement::MESH;
//if (writeLevel)
//{
// flag |= meshRefinement::SCALARLEVELS;
//}
//if (debug & meshRefinement::OBJINTERSECTIONS)
//{
// flag |= meshRefinement::OBJINTERSECTIONS;
//}
meshRefiner.write
(
debugLevel,
meshRefinement::writeType(writeLevel | meshRefinement::WRITEMESH),
mesh.time().path()/meshRefiner.timeName()
);
Info<< "Wrote mesh in = "
<< mesh.time().cpuTimeIncrement() << " s." << endl;
}
......@@ -837,16 +842,74 @@ int main(int argc, char *argv[])
// Debug
// ~~~~~
const label debug = meshDict.lookupOrDefault<label>("debug", 0);
if (debug > 0)
// Set debug level
meshRefinement::debugType debugLevel = meshRefinement::debugType
(
meshDict.lookupOrDefault<label>
(
"debug",
0
)
);
{
meshRefinement::debug = debug;
autoRefineDriver::debug = debug;
autoSnapDriver::debug = debug;
autoLayerDriver::debug = debug;
wordList flags;
if (meshDict.readIfPresent("debugFlags", flags))
{
debugLevel = meshRefinement::debugType
(
meshRefinement::readFlags
(
meshRefinement::IOdebugTypeNames,
flags
)
);
}
}
if (debugLevel > 0)
{
meshRefinement::debug = debugLevel;
autoRefineDriver::debug = debugLevel;
autoSnapDriver::debug = debugLevel;
autoLayerDriver::debug = debugLevel;
}
// Set file writing level
{
wordList flags;
if (meshDict.readIfPresent("writeFlags", flags))
{
meshRefinement::writeLevel
(
meshRefinement::writeType
(
meshRefinement::readFlags
(
meshRefinement::IOwriteTypeNames,
flags
)
)
);
}
}
const bool writeLevel = meshDict.lookupOrDefault<bool>("writeLevel", false);
// Set output level
{
wordList flags;
if (meshDict.readIfPresent("outputFlags", flags))
{
meshRefinement::outputLevel
(
meshRefinement::outputType
(
meshRefinement::readFlags
(
meshRefinement::IOoutputTypeNames,
flags
)
)
);
}
}
// Read geometry
......@@ -1047,11 +1110,12 @@ int main(int argc, char *argv[])
<< mesh.time().cpuTimeIncrement() << " s" << nl << endl;
// Some stats
meshRefiner.printMeshInfo(debug, "Initial mesh");
meshRefiner.printMeshInfo(debugLevel, "Initial mesh");
meshRefiner.write
(
debug & meshRefinement::OBJINTERSECTIONS,
meshRefinement::debugType(debugLevel&meshRefinement::OBJINTERSECTIONS),
meshRefinement::writeType(0),
mesh.time().path()/meshRefiner.timeName()
);
......@@ -1271,7 +1335,7 @@ int main(int argc, char *argv[])
);
if (!overwrite && !debug)
if (!overwrite && !debugLevel)
{
const_cast<Time&>(mesh.time())++;
}
......@@ -1289,8 +1353,8 @@ int main(int argc, char *argv[])
(
"Refined mesh",
meshRefiner,
writeLevel,
debug
debugLevel,
meshRefinement::writeLevel()
);
Info<< "Mesh refined in = "
......@@ -1308,7 +1372,7 @@ int main(int argc, char *argv[])
globalToSlavePatch
);
if (!overwrite && !debug)
if (!overwrite && !debugLevel)
{
const_cast<Time&>(mesh.time())++;
}
......@@ -1330,8 +1394,8 @@ int main(int argc, char *argv[])
(
"Snapped mesh",
meshRefiner,
writeLevel,
debug
debugLevel,
meshRefinement::writeLevel()
);
Info<< "Mesh snapped in = "
......@@ -1357,7 +1421,7 @@ int main(int argc, char *argv[])
);
if (!overwrite && !debug)
if (!overwrite && !debugLevel)
{
const_cast<Time&>(mesh.time())++;
}
......@@ -1376,8 +1440,8 @@ int main(int argc, char *argv[])
(
"Layer mesh",
meshRefiner,
writeLevel,
debug
debugLevel,
meshRefinement::writeLevel()
);
Info<< "Layers added in = "
......
......@@ -475,14 +475,22 @@ meshQualityControls
// Advanced
// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current mesh intersections as .obj files
// 8 : write information about explicit feature edge refinement
// 16 : write information about layers
debug 0;
//// Debug flags
//debugFlags
//(
// mesh // write intermediate meshes
// intersections // write current mesh intersections as .obj files
// featureSeeds, // write information about explicit feature edge refinement
// layerInfo // write information about layers
//);
//
//// Write flags
//writeFlags
//(
// scalarLevels // write volScalarField with cellLevel for postprocessing
// layerSets // write cellSets, faceSets of faces in layer
// layerFields // write volScalarField for layer coverage
//);
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
......
......@@ -46,12 +46,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addRegionOption.H"
argList::validArgs.append("faceZone");
argList::validArgs.append("outsidePoint");
# include "setRootCase.H"
# include "createTime.H"
# include "createPolyMesh.H"
# include "createNamedPolyMesh.H"
const word zoneName = args[1];
const point outsidePoint = args.argRead<point>(2);
......
......@@ -104,8 +104,8 @@ int main(int argc, char *argv[])
);
argList::addBoolOption
(
"sets",
"reconstruct cellSets, faceSets, pointSets"
"noSets",
"skip reconstructing cellSets, faceSets, pointSets"
);
argList::addBoolOption
(
......@@ -122,10 +122,23 @@ int main(int argc, char *argv[])
args.optionLookup("fields")() >> selectedFields;
}
const bool reconstructSets = args.optionFound("sets");
const bool noLagrangian = args.optionFound("noLagrangian");
if (noLagrangian)
{
Info<< "Skipping reconstructing lagrangian positions and fields"
<< nl << endl;
}
const bool noReconstructSets = args.optionFound("noSets");
if (noReconstructSets)
{
Info<< "Skipping reconstructing cellSets, faceSets and pointSets"
<< nl << endl;
}
const bool noLagrangian = args.optionFound("noLagrangian");
HashSet<word> selectedLagrangianFields;
if (args.optionFound("lagrangianFields"))
......@@ -682,7 +695,7 @@ int main(int argc, char *argv[])
}
if (reconstructSets)
if (!noReconstructSets)
{
// Scan to find all sets
HashTable<label> cSetNames;
......
......@@ -14,6 +14,12 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Specify how to map patches. There are three different options:
// - patch exists in the source case: specify mapping (patchMap)
// - patch should be interpolated from internal values in source case
// (cuttingPatches)
// - patch should not be mapped. Default if not in patchMap or cuttingPatches
// List of pairs of target/source patches for mapping
patchMap
(
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -25,6 +25,7 @@ License
#include "patchIdentifier.H"
#include "dictionary.H"
#include "ListOps.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
......@@ -79,6 +80,12 @@ Foam::patchIdentifier::~patchIdentifier()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::patchIdentifier::inGroup(const word& name) const
{
return findIndex(inGroups_, name) != -1;
}
void Foam::patchIdentifier::write(Ostream& os) const
{
if (physicalType_.size())
......
......@@ -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
......@@ -154,6 +154,8 @@ public:
return inGroups_;
}
//- Test if in group
bool inGroup(const word&) const;
//- Write patchIdentifier as a dictionary
void write(Ostream&) const;
......
......@@ -486,6 +486,57 @@ Foam::polyBoundaryMesh::groupPatchIDs() const
}
void Foam::polyBoundaryMesh::setGroup
(
const word& groupName,
const labelList& patchIDs
)
{
groupPatchIDsPtr_.clear();
polyPatchList& patches = *this;
boolList donePatch(patches.size(), false);
// Add to specified patches
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
polyPatch& pp = patches[patchI];
if (!pp.inGroup(groupName))
{
pp.inGroups().append(groupName);
}
donePatch[patchI] = true;
}
// Remove from other patches
forAll(patches, patchI)
{
if (!donePatch[patchI])
{
polyPatch& pp = patches[patchI];
label newI = 0;
if (pp.inGroup(groupName))
{
wordList& groups = pp.inGroups();
forAll(groups, i)
{
if (groups[i] != groupName)
{
groups[newI++] = groups[i];
}
}
groups.setSize(newI);
}
}
}
}
Foam::wordList Foam::polyBoundaryMesh::names() const
{
const polyPatchList& patches = *this;
......
......@@ -186,6 +186,9 @@ public:
//- Per patch group the patch indices
const HashTable<labelList, word>& groupPatchIDs() const;
//- Set/add group with patches
void setGroup(const word& groupName, const labelList& patchIDs);
//- Return the set of patch IDs corresponding to the given names
// By default warns if given names are not found. Optionally
// matches to patchGroups as well as patchNames
......
......@@ -2472,7 +2472,7 @@ void Foam::autoLayerDriver::getLayerCellsFaces
}
bool Foam::autoLayerDriver::writeLayerData
void Foam::autoLayerDriver::printLayerData
(
const fvMesh& mesh,
const labelList& patchIDs,
......@@ -2481,153 +2481,284 @@ bool Foam::autoLayerDriver::writeLayerData
const scalarField& faceRealThickness
) const
{
bool allOk = true;
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
// Find maximum length of a patch name, for a nicer output
label maxPatchNameLen = 0;
forAll(patchIDs, i)
{
label nAdded = 0;
forAll(cellNLayers, cellI)
label patchI = patchIDs[i];
word patchName = pbm[patchI].name();
maxPatchNameLen = max(maxPatchNameLen, label(patchName.size()));
}
Info<< nl
<< setf(ios_base::left) << setw(maxPatchNameLen) << "patch"
<< setw(0) << " faces layers overall thickness" << nl
<< setf(ios_base::left) << setw(maxPatchNameLen) << " "
<< setw(0) << " [m] [%]" << nl
<< setf(ios_base::left) << setw(maxPatchNameLen) << "-----"
<< setw(0) << " ----- ------ --- ---" << endl;
forAll(patchIDs, i)
{
label patchI = patchIDs[i];
const polyPatch& pp = pbm[patchI];
label sumSize = pp.size();
// Number of layers
const labelList& faceCells = pp.faceCells();
label sumNLayers = 0;
forAll(faceCells, i)
{
if (cellNLayers[cellI] > 0)
{
nAdded++;
}
sumNLayers += cellNLayers[faceCells[i]];
}
cellSet addedCellSet(mesh, "addedCells", nAdded);
forAll(cellNLayers, cellI)
// Thickness
scalarField::subField patchWanted = pbm[patchI].patchSlice
(