mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -44,6 +44,12 @@
|
||||
fvc::interpolate(U) & mesh.Sf()
|
||||
);
|
||||
|
||||
if (args.optionFound("initialiseUBCs"))
|
||||
{
|
||||
U.correctBoundaryConditions();
|
||||
phi = fvc::interpolate(U) & mesh.Sf();
|
||||
}
|
||||
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
|
||||
@ -38,6 +38,11 @@ Description
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("writep", "write the final pressure field");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"initialiseUBCs",
|
||||
"initialise U boundary conditions"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -844,16 +844,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
List<faceList> patchFaceVerts;
|
||||
|
||||
labelList nrFaceCells(boundaryFaces.size(),0);
|
||||
HashTable<label,label> faceToCell[2];
|
||||
labelList own(boundaryFaces.size(), -1);
|
||||
labelList nei(boundaryFaces.size(), -1);
|
||||
HashTable<label, label> faceToCell[2];
|
||||
|
||||
{
|
||||
HashTable<label, face, Hash<face> > faceToFaceID(boundaryFaces.size());
|
||||
forAll(boundaryFaces, faceI)
|
||||
{
|
||||
SortableList<label> foo(boundaryFaces[faceI]);
|
||||
face theFace(foo);
|
||||
faceToFaceID.insert(theFace,faceI);
|
||||
SortableList<label> sortedVerts(boundaryFaces[faceI]);
|
||||
faceToFaceID.insert(face(sortedVerts), faceI);
|
||||
}
|
||||
|
||||
forAll(cellVerts, cellI)
|
||||
@ -861,31 +861,57 @@ int main(int argc, char *argv[])
|
||||
faceList faces = cellVerts[cellI].faces();
|
||||
forAll(faces, i)
|
||||
{
|
||||
SortableList<label> foo(faces[i]);
|
||||
face theFace(foo);
|
||||
if (faceToFaceID.found(theFace))
|
||||
SortableList<label> sortedVerts(faces[i]);
|
||||
HashTable<label, face, Hash<face> >::const_iterator fnd =
|
||||
faceToFaceID.find(face(sortedVerts));
|
||||
|
||||
if (fnd != faceToFaceID.end())
|
||||
{
|
||||
label faceI = faceToFaceID[theFace];
|
||||
if (nrFaceCells[faceI] < 2)
|
||||
label faceI = fnd();
|
||||
int stat = face::compare(faces[i], boundaryFaces[faceI]);
|
||||
|
||||
if (stat == 1)
|
||||
{
|
||||
faceToCell[nrFaceCells[faceI]].insert(faceI,cellI);
|
||||
// Same orientation. Cell is owner.
|
||||
own[faceI] = cellI;
|
||||
}
|
||||
else if (stat == -1)
|
||||
{
|
||||
// Opposite orientation. Cell is neighbour.
|
||||
nei[faceI] = cellI;
|
||||
}
|
||||
nrFaceCells[faceI]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label cnt = 0;
|
||||
forAll(nrFaceCells, faceI)
|
||||
label nReverse = 0;
|
||||
forAll(own, faceI)
|
||||
{
|
||||
assert(nrFaceCells[faceI] == 1 || nrFaceCells[faceI] == 2);
|
||||
if (nrFaceCells[faceI]>1)
|
||||
if (own[faceI] == -1 && nei[faceI] != -1)
|
||||
{
|
||||
// Boundary face with incorrect orientation
|
||||
boundaryFaces[faceI] = boundaryFaces[faceI].reverseFace();
|
||||
Swap(own[faceI], nei[faceI]);
|
||||
nReverse++;
|
||||
}
|
||||
}
|
||||
if (nReverse > 0)
|
||||
{
|
||||
Info << "Found " << nReverse << " reversed boundary faces out of "
|
||||
<< boundaryFaces.size() << endl;
|
||||
}
|
||||
|
||||
|
||||
label cnt = 0;
|
||||
forAll(own, faceI)
|
||||
{
|
||||
if (own[faceI] != -1 && nei[faceI] != -1)
|
||||
{
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cnt>0)
|
||||
if (cnt > 0)
|
||||
{
|
||||
Info << "Of " << boundaryFaces.size() << " so-called"
|
||||
<< " boundary faces " << cnt << " belong to two cells "
|
||||
@ -994,7 +1020,8 @@ int main(int argc, char *argv[])
|
||||
if (boundaryFaceToIndex.found(faceIndices[i]))
|
||||
{
|
||||
label bFaceI = boundaryFaceToIndex[faceIndices[i]];
|
||||
if (nrFaceCells[bFaceI] == 1)
|
||||
|
||||
if (own[bFaceI] != -1 && nei[bFaceI] == -1)
|
||||
{
|
||||
patchFaces[cnt] = boundaryFaces[bFaceI];
|
||||
cnt++;
|
||||
|
||||
@ -912,7 +912,7 @@ DimensionedConstants
|
||||
}
|
||||
electromagnetic
|
||||
{
|
||||
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
|
||||
e e [ 0 0 1 0 0 1 0 ] 1.60218e-19;
|
||||
}
|
||||
atomic
|
||||
{
|
||||
@ -942,7 +942,7 @@ DimensionedConstants
|
||||
}
|
||||
electromagnetic
|
||||
{
|
||||
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
|
||||
e e [ 0 0 1 0 0 1 0 ] 1.60218e-19;
|
||||
}
|
||||
atomic
|
||||
{
|
||||
|
||||
@ -35,8 +35,6 @@ defineTypeNameAndDebug(Foam::dlLibraryTable, 0);
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::dlLibraryTable::dlLibraryTable()
|
||||
:
|
||||
HashTable<fileName, void*, Hash<void*> >()
|
||||
{}
|
||||
|
||||
|
||||
@ -45,8 +43,6 @@ Foam::dlLibraryTable::dlLibraryTable
|
||||
const dictionary& dict,
|
||||
const word& libsEntry
|
||||
)
|
||||
:
|
||||
HashTable<fileName, void*, Hash<void*> >()
|
||||
{
|
||||
open(dict, libsEntry);
|
||||
}
|
||||
@ -56,17 +52,18 @@ Foam::dlLibraryTable::dlLibraryTable
|
||||
|
||||
Foam::dlLibraryTable::~dlLibraryTable()
|
||||
{
|
||||
forAllConstIter(dlLibraryTable, *this, iter)
|
||||
forAllReverse(libPtrs_, i)
|
||||
{
|
||||
if (libPtrs_[i])
|
||||
{
|
||||
// bug in dlclose - does not call static destructors of
|
||||
// loaded library when actually unloading the library.
|
||||
// See https://bugzilla.novell.com/show_bug.cgi?id=680125 and 657627.
|
||||
if (debug)
|
||||
{
|
||||
Info<< "dlLibraryTable::~dlLibraryTable() : closing " << iter()
|
||||
<< " with handle " << long(iter.key()) << endl;
|
||||
Info<< "dlLibraryTable::~dlLibraryTable() : closing "
|
||||
<< libNames_[i]
|
||||
<< " with handle " << long(libPtrs_[i]) << endl;
|
||||
}
|
||||
dlClose(libPtrs_[i]);
|
||||
}
|
||||
dlClose(iter.key());
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +92,7 @@ bool Foam::dlLibraryTable::open
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"dlLibraryTable::open(const fileName&)"
|
||||
"dlLibraryTable::open(const fileName&, const bool)"
|
||||
) << "could not load " << functionLibName
|
||||
<< endl;
|
||||
}
|
||||
@ -104,7 +101,9 @@ bool Foam::dlLibraryTable::open
|
||||
}
|
||||
else
|
||||
{
|
||||
return insert(functionLibPtr, functionLibName);
|
||||
libPtrs_.append(functionLibPtr);
|
||||
libNames_.append(functionLibName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -120,18 +119,30 @@ bool Foam::dlLibraryTable::close
|
||||
const bool verbose
|
||||
)
|
||||
{
|
||||
void* libPtr = findLibrary(functionLibName);
|
||||
if (libPtr)
|
||||
label index = -1;
|
||||
forAllReverse(libNames_, i)
|
||||
{
|
||||
if (libNames_[i] == functionLibName)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "dlLibraryTable::close : closing " << functionLibName
|
||||
<< " with handle " << long(libPtr) << endl;
|
||||
<< " with handle " << long(libPtrs_[index]) << endl;
|
||||
}
|
||||
|
||||
erase(libPtr);
|
||||
bool ok = dlClose(libPtrs_[index]);
|
||||
|
||||
if (!dlClose(libPtr))
|
||||
libPtrs_[index] = NULL;
|
||||
libNames_[index] = fileName::null;
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
@ -153,13 +164,20 @@ bool Foam::dlLibraryTable::close
|
||||
|
||||
void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName)
|
||||
{
|
||||
forAllConstIter(dlLibraryTable, *this, iter)
|
||||
label index = -1;
|
||||
forAllReverse(libNames_, i)
|
||||
{
|
||||
if (iter() == functionLibName)
|
||||
if (libNames_[i] == functionLibName)
|
||||
{
|
||||
return iter.key();
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
return libPtrs_[index];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +36,7 @@ SourceFiles
|
||||
#define dlLibraryTable_H
|
||||
|
||||
#include "label.H"
|
||||
#include "Hash.H"
|
||||
#include "HashTable.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -49,11 +48,14 @@ namespace Foam
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dlLibraryTable
|
||||
:
|
||||
public HashTable<fileName, void*, Hash<void*> >
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
DynamicList<void*> libPtrs_;
|
||||
|
||||
DynamicList<fileName> libNames_;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
dlLibraryTable(const dlLibraryTable&);
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
|
||||
dimensionedScalar
|
||||
(
|
||||
"mu0",
|
||||
dimensionSet(1, 2, -1, 0, 0, -2, 0),
|
||||
dimensionSet(1, 1, -2, 0, 0, -2, 0),
|
||||
4.0*constant::mathematical::pi*1e-07
|
||||
)
|
||||
)
|
||||
|
||||
@ -52,7 +52,7 @@ functions
|
||||
type fieldAverage;
|
||||
|
||||
// Where to load it from (if not already in solver)
|
||||
functionObjectLibs ("libfieldAverage.so");
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
|
||||
// Function object enabled flag
|
||||
enabled true;
|
||||
|
||||
@ -34,7 +34,7 @@ Description
|
||||
type fieldAverage;
|
||||
|
||||
// Where to load it from (if not already in solver)
|
||||
functionObjectLibs ("libfieldAverage.so");
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
|
||||
// Whether to perform a clean restart, or start from previous
|
||||
// averaging info if available
|
||||
|
||||
@ -10,7 +10,7 @@ FoamFile
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
object epsilon;
|
||||
object omega;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user