Commit 95040bc1 authored by Andrew Heather's avatar Andrew Heather
Browse files
parents 66aa2681 edfba8be
......@@ -40,4 +40,3 @@
// Momentum corrector
U -= fvc::grad(p)/AU;
U.correctBoundaryConditions();
......@@ -40,6 +40,10 @@ geometry
{
type triSurfaceMesh;
//tolerance 1E-6; // optional:non-default tolerance on intersections
//maxTreeDepth 10; // optional:depth of octree. Decrease only in case
// of memory limitations.
// Per region the patchname. If not provided will be <name>_<region>.
regions
{
......
......@@ -94,7 +94,7 @@ void backup
{
if (fromSet.size())
{
Pout<< " Backing up " << fromName << " into " << toName << endl;
Info<< " Backing up " << fromName << " into " << toName << endl;
topoSet::New(setType, mesh, toName, fromSet)().write();
}
......@@ -525,7 +525,7 @@ bool doCommand
{
topoSet& currentSet = currentSetPtr();
Pout<< " Set:" << currentSet.name()
Info<< " Set:" << currentSet.name()
<< " Size:" << currentSet.size()
<< " Action:" << actionName
<< endl;
......@@ -622,7 +622,7 @@ bool doCommand
+ ".vtk"
);
Pout<< " Writing " << currentSet.name()
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name()
......@@ -634,7 +634,7 @@ bool doCommand
}
else
{
Pout<< " Writing " << currentSet.name()
Info<< " Writing " << currentSet.name()
<< " (size " << currentSet.size() << ") to "
<< currentSet.instance()/currentSet.local()
/currentSet.name() << endl << endl;
......@@ -683,7 +683,7 @@ enum commandStatus
void printMesh(const Time& runTime, const polyMesh& mesh)
{
Pout<< "Time:" << runTime.timeName()
Info<< "Time:" << runTime.timeName()
<< " cells:" << mesh.nCells()
<< " faces:" << mesh.nFaces()
<< " points:" << mesh.nPoints()
......@@ -703,19 +703,19 @@ commandStatus parseType
{
if (setType.empty())
{
Pout<< "Type 'help' for usage information" << endl;
Info<< "Type 'help' for usage information" << endl;
return INVALID;
}
else if (setType == "help")
{
printHelp(Pout);
printHelp(Info);
return INVALID;
}
else if (setType == "list")
{
printAllSets(mesh, Pout);
printAllSets(mesh, Info);
return INVALID;
}
......@@ -726,7 +726,7 @@ commandStatus parseType
label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
Pout<< "Changing time from " << runTime.timeName()
Info<< "Changing time from " << runTime.timeName()
<< " to " << Times[nearestIndex].name()
<< endl;
......@@ -737,24 +737,24 @@ commandStatus parseType
{
case polyMesh::UNCHANGED:
{
Pout<< " mesh not changed." << endl;
Info<< " mesh not changed." << endl;
break;
}
case polyMesh::POINTS_MOVED:
{
Pout<< " points moved; topology unchanged." << endl;
Info<< " points moved; topology unchanged." << endl;
break;
}
case polyMesh::TOPO_CHANGE:
{
Pout<< " topology changed; patches unchanged." << nl
Info<< " topology changed; patches unchanged." << nl
<< " ";
printMesh(runTime, mesh);
break;
}
case polyMesh::TOPO_PATCH_CHANGE:
{
Pout<< " topology changed and patches changed." << nl
Info<< " topology changed and patches changed." << nl
<< " ";
printMesh(runTime, mesh);
......@@ -773,7 +773,7 @@ commandStatus parseType
}
else if (setType == "quit")
{
Pout<< "Quitting ..." << endl;
Info<< "Quitting ..." << endl;
return QUIT;
}
......@@ -864,7 +864,7 @@ int main(int argc, char *argv[])
printMesh(runTime, mesh);
// Print current sets
printAllSets(mesh, Pout);
printAllSets(mesh, Info);
......@@ -874,7 +874,7 @@ int main(int argc, char *argv[])
{
fileName batchFile(args.option("batch"));
Pout<< "Reading commands from file " << batchFile << endl;
Info<< "Reading commands from file " << batchFile << endl;
// we cannot handle .gz files
if (!isFile(batchFile, false))
......@@ -888,11 +888,11 @@ int main(int argc, char *argv[])
#if READLINE != 0
else if (!read_history(historyFile))
{
Pout<< "Successfully read history from " << historyFile << endl;
Info<< "Successfully read history from " << historyFile << endl;
}
#endif
Pout<< "Please type 'help', 'quit' or a set command after prompt." << endl;
Info<< "Please type 'help', 'quit' or a set command after prompt." << endl;
bool ok = true;
......@@ -916,7 +916,7 @@ int main(int argc, char *argv[])
{
if (!fileStreamPtr->good())
{
Pout<< "End of batch file" << endl;
Info<< "End of batch file" << endl;
break;
}
......@@ -924,7 +924,7 @@ int main(int argc, char *argv[])
if (rawLine.size())
{
Pout<< "Doing:" << rawLine << endl;
Info<< "Doing:" << rawLine << endl;
}
}
else
......@@ -945,7 +945,7 @@ int main(int argc, char *argv[])
}
# else
{
Pout<< "Command>" << flush;
Info<< "Command>" << flush;
std::getline(std::cin, rawLine);
}
# endif
......@@ -992,7 +992,7 @@ int main(int argc, char *argv[])
delete fileStreamPtr;
}
Pout<< "\nEnd\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -96,6 +96,7 @@ void checkPatch(const polyBoundaryMesh& bMesh, const word& name)
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addRegionOption.H"
argList::validArgs.append("masterPatch");
argList::validArgs.append("slavePatch");
......@@ -109,7 +110,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
# include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
......
......@@ -31,6 +31,14 @@ Description
Mainly used to convert binary mesh/field files to ASCII.
Problem: any zero-size List written binary gets written as '0'. When
reading the file as a dictionary this is interpreted as a label. This
is (usually) not a problem when doing patch fields since these get the
'uniform', 'nonuniform' prefix. However zone contents are labelLists
not labelFields and these go wrong. For now hacked a solution where
we detect the keywords in zones and redo the dictionary entries
to be labelLists.
\*---------------------------------------------------------------------------*/
#include "argList.H"
......@@ -56,6 +64,82 @@ namespace Foam
}
// Hack to do zones which have Lists in them. See above.
bool writeZones(const word& name, Time& runTime)
{
IOobject io
(
name,
runTime.timeName(),
polyMesh::meshSubDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
bool writeOk = false;
if (io.headerOk())
{
Info<< " Reading " << io.headerClassName()
<< " : " << name << endl;
// Switch off type checking (for reading e.g. faceZones as
// generic list of dictionaries).
const word oldTypeName = IOPtrList<entry>::typeName;
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
IOPtrList<entry> meshObject(io);
forAll(meshObject, i)
{
if (meshObject[i].isDict())
{
dictionary& d = meshObject[i].dict();
if (d.found("faceLabels"))
{
d.set("faceLabels", labelList(d.lookup("faceLabels")));
}
if (d.found("flipMap"))
{
d.set("flipMap", boolList(d.lookup("flipMap")));
}
if (d.found("cellLabels"))
{
d.set("cellLabels", labelList(d.lookup("cellLabels")));
}
if (d.found("pointLabels"))
{
d.set("pointLabels", labelList(d.lookup("pointLabels")));
}
}
}
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(meshObject.type()) = io.headerClassName();
Info<< " Writing " << name << endl;
// Force writing as ascii
writeOk = meshObject.regIOobject::writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
runTime.writeCompression()
);
}
return writeOk;
}
// Main program:
int main(int argc, char *argv[])
......@@ -76,9 +160,19 @@ int main(int argc, char *argv[])
writeMeshObject<labelIOList>("neighbour", runTime);
writeMeshObject<faceIOList>("faces", runTime);
writeMeshObject<pointIOField>("points", runTime);
writeMeshObject<IOPtrList<entry> >("cellZones", runTime);
writeMeshObject<IOPtrList<entry> >("faceZones", runTime);
writeMeshObject<IOPtrList<entry> >("pointZones", runTime);
writeMeshObject<labelIOList>("pointProcAddressing", runTime);
writeMeshObject<labelIOList>("faceProcAddressing", runTime);
writeMeshObject<labelIOList>("cellProcAddressing", runTime);
writeMeshObject<labelIOList>("boundaryProcAddressing", runTime);
if (runTime.writeFormat() == IOstream::ASCII)
{
// Only do zones when converting from binary to ascii
// The other way gives problems since working on dictionary level.
writeZones("cellZones", runTime);
writeZones("faceZones", runTime);
writeZones("pointZones", runTime);
}
// Get list of objects from the database
IOobjectList objects(runTime, runTime.timeName());
......
......@@ -1077,83 +1077,92 @@ int main(int argc, char *argv[])
{
const faceZone& pp = zones[zoneI];
const indirectPrimitivePatch ipp
(
IndirectList<face>(mesh.faces(), pp),
mesh.points()
);
writer.writePolygonalZone
(
pp.name(),
strandID++, //1+patchIDs.size()+zoneI, //strandID,
ipp,
allVarLocation
);
// Write coordinates
writer.writeField(ipp.localPoints().component(0)());
writer.writeField(ipp.localPoints().component(1)());
writer.writeField(ipp.localPoints().component(2)());
// Write all volfields
forAll(vsf, i)
if (pp.size() > 0)
{
writer.writeField
const indirectPrimitivePatch ipp
(
writer.getFaceField
(
linearInterpolate(vsf[i])(),
pp
)()
IndirectList<face>(mesh.faces(), pp),
mesh.points()
);
}
forAll(vvf, i)
{
writer.writeField
writer.writePolygonalZone
(
writer.getFaceField
(
linearInterpolate(vvf[i])(),
pp
)()
pp.name(),
strandID++, //1+patchIDs.size()+zoneI, //strandID,
ipp,
allVarLocation
);
}
forAll(vSpheretf, i)
{
writer.writeField
(
writer.getFaceField
// Write coordinates
writer.writeField(ipp.localPoints().component(0)());
writer.writeField(ipp.localPoints().component(1)());
writer.writeField(ipp.localPoints().component(2)());
// Write all volfields
forAll(vsf, i)
{
writer.writeField
(
linearInterpolate(vSpheretf[i])(),
pp
)()
);
}
forAll(vSymmtf, i)
{
writer.writeField
(
writer.getFaceField
writer.getFaceField
(
linearInterpolate(vsf[i])(),
pp
)()
);
}
forAll(vvf, i)
{
writer.writeField
(
linearInterpolate(vSymmtf[i])(),
pp
)()
);
writer.getFaceField
(
linearInterpolate(vvf[i])(),
pp
)()
);
}
forAll(vSpheretf, i)
{
writer.writeField
(
writer.getFaceField
(
linearInterpolate(vSpheretf[i])(),
pp
)()
);
}
forAll(vSymmtf, i)
{
writer.writeField
(
writer.getFaceField
(
linearInterpolate(vSymmtf[i])(),
pp
)()
);
}
forAll(vtf, i)
{
writer.writeField
(
writer.getFaceField
(
linearInterpolate(vtf[i])(),
pp
)()
);
}
writer.writeConnectivity(ipp);
}
forAll(vtf, i)
else
{
writer.writeField
(
writer.getFaceField
(
linearInterpolate(vtf[i])(),
pp
)()
);
Info<< " Skipping zero sized faceZone " << zoneI
<< "\t" << pp.name()
<< nl << endl;
}
writer.writeConnectivity(ipp);
}
}
......
......@@ -91,7 +91,7 @@ bool Foam::IOobject::readHeader(Istream& is)
<< "First token could not be read or is not the keyword 'FoamFile'"
<< nl << nl << "Check header is of the form:" << nl << endl;
writeHeader(SeriousError);
writeHeader(Info);
return false;
}
......
......@@ -77,6 +77,9 @@ public:
//- Apply and accumulate the effect of the given constraint direction
inline void applyConstraint(const vector& cd);
//- Combine constraints
inline void combine(const pointConstraint&);
//- Return the accumulated constraint transformation tensor
inline tensor constraintTransformation() const;
};
......
......@@ -69,6 +69,47 @@ void Foam::pointConstraint::applyConstraint(const vector& cd)
}
void Foam::pointConstraint::combine(const pointConstraint& pc)
{
if (first() == 0)
{
operator=(pc);
}
else if (first() == 1)
{
// Save single normal
vector n = second();
// Apply to supplied point constaint
operator=(pc);
applyConstraint(n);
}
else if (first() == 2)
{
if (pc.first() == 0)
{}
else if (pc.first() == 1)
{
applyConstraint(pc.second());
}
else if (pc.first() == 2)
{
// Both constrained to line. Same (+-)direction?
if (mag(second() & pc.second()) <= (1.0-1e-3))
{
// Different directions
first() = 3;
second() = vector::zero;
}
}
else
{
first() = 3;
second() = vector::zero;
}
}
}
Foam::tensor Foam::pointConstraint::constraintTransformation() const
{
if (first() == 0)
......
......@@ -132,7 +132,7 @@ public:
// associated with any faces
virtual const labelList& loneMeshPoints() const;
//- Return point unit normals. Not impelemented.
//- Return point unit normals. Not implemented.
virtual const vectorField& pointNormals() const;
};
......
......@@ -199,13 +199,20 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
const face& f = faces[faceI];
// 1. calculate a typical size of the face. Use maximum distance