Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2009-03-26 12:30:08 +00:00
19 changed files with 224 additions and 48 deletions

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
turbDyMFoam
pimpleDyMFoam.C
Description
Transient solver for incompressible, flow of Newtonian fluids

View File

@ -48,6 +48,7 @@ Description
#include "OFstream.H"
#include "IFstream.H"
#include "IOobjectList.H"
#include "SortableList.H"
using namespace Foam;
@ -107,6 +108,7 @@ int main(int argc, char *argv[])
{
// Not in memory. Load it.
pointSet set(*iter());
SortableList<label> pointLabels(set.toc());
label zoneID = mesh.pointZones().findZoneID(set.name());
if (zoneID == -1)
@ -120,7 +122,7 @@ int main(int argc, char *argv[])
new pointZone
(
set.name(), //name
set.toc(), //addressing
pointLabels, //addressing
sz, //index
mesh.pointZones() //pointZoneMesh
)
@ -131,7 +133,7 @@ int main(int argc, char *argv[])
{
Info<< "Overwriting contents of existing pointZone " << zoneID
<< " with that of set " << set.name() << "." << endl;
mesh.pointZones()[zoneID] = set.toc();
mesh.pointZones()[zoneID] = pointLabels;
mesh.pointZones().writeOpt() = IOobject::AUTO_WRITE;
}
}
@ -150,6 +152,7 @@ int main(int argc, char *argv[])
{
// Not in memory. Load it.
cellSet set(*iter());
SortableList<label> cellLabels(set.toc());
label zoneID = mesh.cellZones().findZoneID(set.name());
if (zoneID == -1)
@ -163,7 +166,7 @@ int main(int argc, char *argv[])
new cellZone
(
set.name(), //name
set.toc(), //addressing
cellLabels, //addressing
sz, //index
mesh.cellZones() //pointZoneMesh
)
@ -174,7 +177,7 @@ int main(int argc, char *argv[])
{
Info<< "Overwriting contents of existing cellZone " << zoneID
<< " with that of set " << set.name() << "." << endl;
mesh.cellZones()[zoneID] = set.toc();
mesh.cellZones()[zoneID] = cellLabels;
mesh.cellZones().writeOpt() = IOobject::AUTO_WRITE;
}
}
@ -193,6 +196,7 @@ int main(int argc, char *argv[])
{
// Not in memory. Load it.
faceSet set(*iter());
SortableList<label> faceLabels(set.toc());
DynamicList<label> addressing(set.size());
DynamicList<bool> flipMap(set.size());
@ -214,9 +218,9 @@ int main(int argc, char *argv[])
// Load corresponding cells
cellSet cells(mesh, setName);
forAllConstIter(faceSet, set, iter)
forAll(faceLabels, i)
{
label faceI = iter.key();
label faceI = faceLabels[i];
bool flip = false;
@ -273,9 +277,10 @@ int main(int argc, char *argv[])
else
{
// No flip map.
forAllConstIter(faceSet, set, iter)
forAll(faceLabels, i)
{
addressing.append(iter.key());
label faceI = faceLabels[i];
addressing.append(faceI);
flipMap.append(false);
}
}

View File

@ -50,6 +50,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
output0_ = NULL;
#ifdef VTKPV3FOAM_DUALPORT
// Add second output for the Lagrangian
this->SetNumberOfOutputPorts(2);
vtkMultiBlockDataSet *lagrangian = vtkMultiBlockDataSet::New();
@ -57,6 +58,7 @@ vtkPV3FoamReader::vtkPV3FoamReader()
this->GetExecutive()->SetOutputData(1, lagrangian);
lagrangian->Delete();
#endif
TimeStepRange[0] = 0;
TimeStepRange[1] = 0;
@ -319,15 +321,6 @@ int vtkPV3FoamReader::RequestData
)
);
vtkMultiBlockDataSet* lagrangianOutput = vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(1)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
if (Foam::vtkPV3Foam::debug)
{
cout<< "update output with "
@ -376,7 +369,21 @@ int vtkPV3FoamReader::RequestData
#else
foamData_->Update(output, lagrangianOutput);
#ifdef VTKPV3FOAM_DUALPORT
foamData_->Update
(
output,
vtkMultiBlockDataSet::SafeDownCast
(
outputVector->GetInformationObject(1)->Get
(
vtkMultiBlockDataSet::DATA_OBJECT()
)
);
);
#else
foamData_->Update(output, output);
#endif
if (ShowPatchNames)
{

View File

@ -465,7 +465,6 @@ void Foam::vtkPV3Foam::Update
cout<< "<beg> Foam::vtkPV3Foam::Update - output with "
<< output->GetNumberOfBlocks() << " and "
<< lagrangianOutput->GetNumberOfBlocks() << " blocks\n";
output->Print(cout);
lagrangianOutput->Print(cout);
printMemory();
@ -504,8 +503,10 @@ void Foam::vtkPV3Foam::Update
reader_->UpdateProgress(0.7);
}
#ifdef VTKPV3FOAM_DUALPORT
// restart port1 at block=0
blockNo = 0;
#endif
convertMeshLagrangian(lagrangianOutput, blockNo);
reader_->UpdateProgress(0.8);

View File

@ -71,6 +71,8 @@ SourceFiles
#include "PrimitivePatchInterpolation.H"
#include "volPointInterpolation.H"
#undef VTKPV3FOAM_DUALPORT
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection;

View File

@ -529,7 +529,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
}
else
{
IOWarningIn("dictionary::add(entry*)", (*this))
IOWarningIn("dictionary::add(entry*, bool)", (*this))
<< "problem replacing entry "<< entryPtr->keyword()
<< " in dictionary " << name() << endl;
@ -558,7 +558,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry)
}
else
{
IOWarningIn("dictionary::add(entry* entryPtr)", (*this))
IOWarningIn("dictionary::add(entry*, bool)", (*this))
<< "attempt to add entry "<< entryPtr->keyword()
<< " which already exists in dictionary " << name()
<< endl;
@ -574,11 +574,13 @@ void Foam::dictionary::add(const entry& e, bool mergeEntry)
add(e.clone(*this).ptr(), mergeEntry);
}
void Foam::dictionary::add(const keyType& k, const word& w, bool overwrite)
{
add(new primitiveEntry(k, token(w)), overwrite);
}
void Foam::dictionary::add
(
const keyType& k,
@ -589,16 +591,19 @@ void Foam::dictionary::add
add(new primitiveEntry(k, token(s)), overwrite);
}
void Foam::dictionary::add(const keyType& k, const label l, bool overwrite)
{
add(new primitiveEntry(k, token(l)), overwrite);
}
void Foam::dictionary::add(const keyType& k, const scalar s, bool overwrite)
{
add(new primitiveEntry(k, token(s)), overwrite);
}
void Foam::dictionary::add
(
const keyType& k,
@ -628,6 +633,7 @@ void Foam::dictionary::set(const entry& e)
set(e.clone(*this).ptr());
}
void Foam::dictionary::set(const keyType& k, const dictionary& d)
{
set(new dictionaryEntry(k, *this, d));
@ -770,7 +776,7 @@ bool Foam::dictionary::merge(const dictionary& dict)
bool changed = false;
forAllConstIter(IDLList<entry>, *this, iter)
forAllConstIter(IDLList<entry>, dict, iter)
{
HashTable<entry*>::iterator fnd = hashedEntries_.find(iter().keyword());

View File

@ -236,6 +236,7 @@ void processorPointPatch::initPatchPatchPoints()
);
toNeighbProc
<< ppmp.size() // number of points for checking
<< patchPatchPoints
<< patchPatchPointNormals;
@ -257,13 +258,33 @@ void Foam::processorPointPatch::calcPatchPatchPoints()
neighbProcNo()
);
label nbrNPoints(readLabel(fromNeighbProc));
labelListList patchPatchPoints(fromNeighbProc);
List<List<vector> > patchPatchPointNormals(fromNeighbProc);
pointBoundaryMesh& pbm = const_cast<pointBoundaryMesh&>(boundaryMesh());
const labelList& ppmp = meshPoints();
// Simple check for the very rare situation when not the same number
// of points on both sides. This can happen with decomposed cyclics.
// If on one side the cyclic shares a point with proc faces coming from
// internal faces it will have a different number of points from
// the situation where the cyclic and the 'normal' proc faces are fully
// separate.
if (nbrNPoints != ppmp.size())
{
WarningIn("processorPointPatch::calcPatchPatchPoints()")
<< "Processor patch " << name()
<< " has " << ppmp.size() << " points; coupled patch has "
<< nbrNPoints << " points." << endl
<< " (usually due to decomposed cyclics)."
<< " This might give problems" << endl
<< " when using point fields (interpolation, mesh motion)."
<< endl;
}
// Loop over the patches looking for other patches that share points
forAll(patchPatchPoints, patchi)
{

View File

@ -32,6 +32,7 @@ defineTypeNameAndDebug(Foam::dynamicFvMesh, 0);
defineRunTimeSelectionTable(Foam::dynamicFvMesh, IOobject);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
@ -45,4 +46,5 @@ Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io)
Foam::dynamicFvMesh::~dynamicFvMesh()
{}
// ************************************************************************* //

View File

@ -26,7 +26,7 @@ Class
Foam::dynamicFvMesh
Description
The dynamicFvMesh is ..
Abstract base class for geometry and/or topology changing fvMesh.
SourceFiles
dynamicFvMesh.C

View File

@ -207,7 +207,20 @@ void Foam::attachDetach::attachInterface
mesh.faceZones()[modifiedFaceZone].whichFace(curFaceID)
];
}
label patchID = mesh.boundaryMesh().whichPatch(curFaceID);
label neiCell;
if (patchID == -1)
{
neiCell = nei[curFaceID];
}
else
{
neiCell = -1;
}
// Modify the face
ref.setAction
(
@ -216,9 +229,9 @@ void Foam::attachDetach::attachInterface
newFace, // modified face
curFaceID, // label of face being modified
own[curFaceID], // owner
nei[curFaceID], // neighbour
neiCell, // neighbour
false, // face flip
mesh.boundaryMesh().whichPatch(curFaceID),// patch for face
patchID, // patch for face
false, // remove from zone
modifiedFaceZone, // zone for face
modifiedFaceZoneFlip // face flip in zone

View File

@ -73,6 +73,37 @@ void Foam::attachDetach::detachInterface
const polyMesh& mesh = topoChanger().mesh();
const faceZoneMesh& zoneMesh = mesh.faceZones();
// Check that zone is in increasing order (needed since adding faces
// in same order - otherwise polyTopoChange face ordering will mess up
// correspondence)
if (debug)
{
const labelList& faceLabels = zoneMesh[faceZoneID_.index()];
if (faceLabels.size() > 0)
{
for (label i = 1; i < faceLabels.size(); i++)
{
if (faceLabels[i] <= faceLabels[i-1])
{
FatalErrorIn
(
"attachDetach::detachInterface"
"(polyTopoChange&) const"
) << "faceZone " << zoneMesh[faceZoneID_.index()].name()
<< " does not have mesh face labels in"
<< " increasing order." << endl
<< "Face label " << faceLabels[i]
<< " at position " << i
<< " is smaller than the previous value "
<< faceLabels[i-1]
<< exit(FatalError);
}
}
}
}
const primitiveFacePatch& masterFaceLayer = zoneMesh[faceZoneID_.index()]();
const pointField& points = mesh.points();
const labelListList& meshEdgeFaces = mesh.edgeFaces();
@ -109,14 +140,11 @@ void Foam::attachDetach::detachInterface
if (edgeIsInternal)
{
// Pout<< "Internal edge found: (" << mp[zoneLocalEdges[curEdgeID].start()] << " " << mp[zoneLocalEdges[curEdgeID].end()] << ")" << endl;
const edge& e = zoneLocalEdges[curEdgeID];
// Reset the point creation
addedPoints[zoneLocalEdges[curEdgeID].start()] =
mp[zoneLocalEdges[curEdgeID].start()];
addedPoints[zoneLocalEdges[curEdgeID].end()] =
mp[zoneLocalEdges[curEdgeID].end()];
addedPoints[e.start()] = mp[e.start()];
addedPoints[e.end()] = mp[e.end()];
}
}
// Pout << "addedPoints before point creation: " << addedPoints << endl;
@ -137,7 +165,10 @@ void Foam::attachDetach::detachInterface
true // supports a cell
)
);
// Pout << "Adding point " << points[mp[pointI]] << " for original point " << mp[pointI] << endl;
//Pout<< "Adding point " << addedPoints[pointI]
// << " coord1:" << points[mp[pointI]]
// << " coord2:" << masterFaceLayer.localPoints()[pointI]
// << " for original point " << mp[pointI] << endl;
}
}
@ -185,6 +216,7 @@ void Foam::attachDetach::detachInterface
);
// Add renumbered face into the slave patch
//label addedFaceI =
ref.setAction
(
polyAddFace
@ -201,7 +233,15 @@ void Foam::attachDetach::detachInterface
false // zone flip
)
);
// Pout << "Flip. Modifying face: " << faces[curFaceID].reverseFace() << " next to cell: " << nei[curFaceID] << " and adding face: " << newFace << " next to cell: " << own[curFaceID] << endl;
//{
// pointField newPts(ref.points());
//Pout<< "Flip. Modifying face: " << ref.faces()[curFaceID]
// << " fc:" << ref.faces()[curFaceID].centre(newPts)
// << " next to cell: " << nei[curFaceID]
// << " and adding face: " << newFace
// << " fc:" << ref.faces()[addedFaceI].centre(newPts)
// << " next to cell: " << own[curFaceID] << endl;
//}
}
else
{
@ -223,6 +263,7 @@ void Foam::attachDetach::detachInterface
);
// Add renumbered face into the slave patch
//label addedFaceI =
ref.setAction
(
polyAddFace
@ -239,7 +280,15 @@ void Foam::attachDetach::detachInterface
false // face flip in zone
)
);
// Pout << "No flip. Modifying face: " << faces[curFaceID] << " next to cell: " << own[curFaceID] << " and adding face: " << newFace << " next to cell: " << nei[curFaceID] << endl;
//{
// pointField newPts(ref.points());
//Pout<< "No flip. Modifying face: " << ref.faces()[curFaceID]
// << " fc:" << ref.faces()[curFaceID].centre(newPts)
// << " next to cell: " << own[curFaceID]
// << " and adding face: " << newFace
// << " fc:" << ref.faces()[addedFaceI].centre(newPts)
// << " next to cell: " << nei[curFaceID] << endl;
//}
}
}

View File

@ -1464,6 +1464,11 @@ void Foam::polyTopoChange::resetZones
addressing[zoneI][nPoints[zoneI]++] = iter.key();
}
// Sort the addressing
forAll(addressing, zoneI)
{
stableSort(addressing[zoneI]);
}
// So now we both have old zones and the new addressing.
// Invert the addressing to get pointZoneMap.
@ -1551,6 +1556,28 @@ void Foam::polyTopoChange::resetZones
addressing[zoneI][index] = faceI;
flipMode[zoneI][index] = faceZoneFlip_[faceI];
}
// Sort the addressing
forAll(addressing, zoneI)
{
labelList newToOld;
sortedOrder(addressing[zoneI], newToOld);
{
labelList newAddressing(addressing[zoneI].size());
forAll(newAddressing, i)
{
newAddressing[i] = addressing[zoneI][newToOld[i]];
}
addressing[zoneI].transfer(newAddressing);
}
{
boolList newFlipMode(flipMode[zoneI].size());
forAll(newFlipMode, i)
{
newFlipMode[i] = flipMode[zoneI][newToOld[i]];
}
flipMode[zoneI].transfer(newFlipMode);
}
}
// So now we both have old zones and the new addressing.
// Invert the addressing to get faceZoneFaceMap.
@ -1644,6 +1671,11 @@ void Foam::polyTopoChange::resetZones
addressing[zoneI][nCells[zoneI]++] = cellI;
}
}
// Sort the addressing
forAll(addressing, zoneI)
{
stableSort(addressing[zoneI]);
}
// So now we both have old zones and the new addressing.
// Invert the addressing to get cellZoneMap.

View File

@ -343,7 +343,7 @@ bool Foam::movingConeTopoFvMesh::update()
// << endl;
{
OFstream str(thisDb().path()/"meshPoints.obj");
OFstream str(time().timePath()/"meshPoints.obj");
Pout<< "Writing mesh with meshPoints to " << str.name()
<< endl;
@ -361,7 +361,7 @@ bool Foam::movingConeTopoFvMesh::update()
}
}
{
OFstream str(thisDb().path()/"preMotionPoints.obj");
OFstream str(time().timePath()/"preMotionPoints.obj");
Pout<< "Writing mesh with preMotionPoints to " << str.name()
<< endl;

View File

@ -24,7 +24,7 @@ boundaryField
inlet
{
type turbulentMixingLengthDissipationRateInlet;
mixingLength 0.01;
mixingLength 0.01; // 1cm - half channel height
value uniform 1;
}

View File

@ -24,7 +24,7 @@ boundaryField
inlet
{
type turbulentIntensityKineticEnergyInlet;
intensity 0.05;
intensity 0.05; // 5% turbulent intensity
value uniform 1;
}

View File

@ -22,8 +22,14 @@ boundaryField
{
inlet
{
type totalPressure;
p0 uniform 100040;
//type totalPressure;
//p0 uniform 100040;
type timeVaryingTotalPressure;
p0 100040; // only used for restarts
outOfBounds clamp;
fileName "$FOAM_CASE/constant/p0vsTime";
U U;
phi phi;
rho none;

View File

@ -0,0 +1,4 @@
(
(0 100010)
(1 100040)
)

View File

@ -0,0 +1,20 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object turbulenceProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
simulationType RASModel;
// ************************************************************************* //

View File

@ -52,16 +52,24 @@ functions
probes
{
type probes;
name probes;
// Where to load it from
functionObjectLibs ( "libsampling.so" );
// Name of the directory for probe data
name probes;
probeLocations
(
( 1e-06 0 0.01 )
( 0.21 -0.20999 0.01 )
( 0.21 0.20999 0.01 )
( 0.21 0 0.01 )
( 1e-06 0 0.01 ) // at inlet
( 0.21 -0.20999 0.01 ) // at outlet1
( 0.21 0.20999 0.01 ) // at outlet2
( 0.21 0 0.01 ) // at central block
);
// Fields to be probed
fields ( p U );
// Write at same frequency as fields
outputControl outputTime;
outputInterval 1;
}
}