Merge remote branch 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2010-12-07 15:20:19 +01:00
78 changed files with 3281 additions and 101119 deletions

View File

@ -104,6 +104,8 @@
taking film into account taking film into account
+ Parallel aware + Parallel aware
*** *New* ptscotch decomposition method *** *New* ptscotch decomposition method
*** *Updated* decomposePar maps polyPatches instead of recreating them so
polyPatches holding data can map the data.
*** *Updated* particle tracking algorithm *** *Updated* particle tracking algorithm
+ uses non-blocking parallel transfers + uses non-blocking parallel transfers
+ does 'minimum-tet' decomposition of face to work with warped faces (snappyHexMesh!) + does 'minimum-tet' decomposition of face to work with warped faces (snappyHexMesh!)
@ -150,7 +152,12 @@
OpenFOAM. OpenFOAM.
+ *New* wall functions: + *New* wall functions:
+ kappatJayatillekeWallFunction: incompressible RAS thermal wall function + kappatJayatillekeWallFunction: incompressible RAS thermal wall function
+ directMappedFixedValue:
+ takes interpolationScheme so can interpolate instead of always getting
cell value
+ takes optional fieldName to sample
+ directMapped patch added 'normal' method to calculate sample points
to e.g. sample fields just above wall (e.g. for streaklines)
* Utilities * Utilities
There have been some utilities added and updated in this release. There have been some utilities added and updated in this release.
*** *New* utilities *** *New* utilities
@ -172,8 +179,10 @@
*** Updated utilities *** Updated utilities
+ =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial). + =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial).
+ =blockMesh=: specify patches via dictionary instead of type only. This + =blockMesh=: specify patches via dictionary instead of type only. This
makes rereading the boundary superfluous. see makes rereading the boundary file superfluous. see
e.g. pitzDailyDirectMapped tutorial. e.g. pitzDailyDirectMapped tutorial.
+ =setSet=: allows time range (e.g. 0:100) in combination with -batch argument
to execute the commands for multiple times.
* Post-processing * Post-processing
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal + =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
field data. field data.
@ -181,6 +190,10 @@
mesh. Great for postprocessing. mesh. Great for postprocessing.
+ =steadyParticleTracks=: Generates VTK tracks from the output of the cloud + =steadyParticleTracks=: Generates VTK tracks from the output of the cloud
=ParticleTracks= post-processing sub-model =ParticleTracks= post-processing sub-model
+ Sampling:
+ =patchInternalField=: new sampledSurface - like 'patch' but samples
internal field instead of boundary field.
+ =ensight=: new output format for all sampledSurfaces.
+ Function objects: + Function objects:
+ =residualControl=: new function object to allow users to terminate steady + =residualControl=: new function object to allow users to terminate steady
state calculations when the defined residual levels are achieved state calculations when the defined residual levels are achieved
@ -190,6 +203,14 @@
specified time has been reached, e.g. to automagically change fvSchemes and specified time has been reached, e.g. to automagically change fvSchemes and
fvSolution during a calculation fvSolution during a calculation
+ =streamLine=: generate streamlines; ouputs both trajectory and field data + =streamLine=: generate streamlines; ouputs both trajectory and field data
+ =surfaceInterpolateFields=: constructs face interpolate of registered
volFields for any future functionObjects that need surfaceFields.
+ =readFields=: reads field if not yet registered. Makes functionObjects
useable through standalone execFlowFunctionObjects.
+ =faceSource=: can now calculate on a sampledSurface (e.g. flow through a
triSurfaceMesh).
+ =nearWallFields=: constructs field with on selected patches interpolated
internal field for further postprocessing.
* New tutorials * New tutorials
There is a large number of new tutorials for existing and new solvers in the There is a large number of new tutorials for existing and new solvers in the

View File

@ -129,15 +129,7 @@ int main(int argc, char *argv[])
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer()); mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
// Distribute complexData // Distribute complexData
mapDistribute::distribute mapDistribute::distribute(complexData);
(
Pstream::nonBlocking,
List<labelPair>(),
map.constructSize(),
map.subMap(),
map.constructMap(),
complexData
);
Pout<< "complexData:" << complexData << endl; Pout<< "complexData:" << complexData << endl;
} }

View File

@ -36,6 +36,7 @@ Description
------ local definitions ------ local definitions
\* ------------------------------------------------------------------------ */ \* ------------------------------------------------------------------------ */
#include "cyclicPolyPatch.H"
#include "argList.H" #include "argList.H"
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
@ -904,6 +905,13 @@ int main(int argc, char *argv[])
fluentToFoamType.insert("radiator", polyPatch::typeName); fluentToFoamType.insert("radiator", polyPatch::typeName);
fluentToFoamType.insert("porous-jump", polyPatch::typeName); fluentToFoamType.insert("porous-jump", polyPatch::typeName);
//- Periodic halves map directly into split cyclics. The problem is the
// initial matching since we require knowledge of the transformation.
// It is ok if the periodics are already ordered. We should read the
// periodic shadow faces section (section 18) to give use the ordering
// For now just disable.
//fluentToFoamType.insert("periodic", cyclicPolyPatch::typeName);
// Foam patch type for Fluent zone type // Foam patch type for Fluent zone type
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1039,15 +1047,59 @@ int main(int argc, char *argv[])
if (iter != fluentToFoamType.end()) if (iter != fluentToFoamType.end())
{ {
newPatches[patchi] = polyPatch::New // See if we have a periodic and can derive the other side.
( word neighbPatchName;
iter(), if (iter() == cyclicPolyPatch::typeName)
name, {
0, // Periodic
0, size_t n = name.rfind("-SIDE-1");
patchi,
mesh.boundaryMesh() if (n != string::npos)
).ptr(); {
neighbPatchName = name.substr(0, n) + "-SIDE-2";
}
else
{
n = name.rfind("-SIDE-2");
if (n != string::npos)
{
neighbPatchName = name.substr(0, n) + "-SIDE-1";
}
}
}
if (neighbPatchName.size())
{
Info<< "Adding cyclicPolyPatch for Fluent zone " << name
<< " with neighbour patch " << neighbPatchName
<< endl;
newPatches[patchi] = new cyclicPolyPatch
(
name,
0,
0,
patchi,
mesh.boundaryMesh(),
neighbPatchName,
cyclicPolyPatch::NOORDERING,
vector::zero,
vector::zero,
vector::zero
);
}
else
{
newPatches[patchi] = polyPatch::New
(
iter(),
name,
0,
0,
patchi,
mesh.boundaryMesh()
).ptr();
}
} }
else else
{ {

View File

@ -19,15 +19,17 @@ FoamFile
numberOfSubdomains 8; numberOfSubdomains 8;
//- Keep owner and neighbour on same processor for faces in zones: //- Keep owner and neighbour on same processor for faces in zones:
// preserveFaceZones (heater solid1 solid3); // preserveFaceZones (heater solid1 solid3);
//- Keep owner and neighbour on same processor for faces in patches: //- Keep owner and neighbour on same processor for faces in patches:
// (makes sense only for cyclic patches) // (makes sense only for cyclic patches)
//preservePatches (cyclic_half0 cyclic_half1); //preservePatches (cyclic_half0 cyclic_half1);
//- Use the volScalarField named here as a weight for each cell in the
// decomposition. For example, use a particle population field to decompose
// for a balanced number of particles in a lagrangian simulation.
// weightField dsmcRhoNMean;
method scotch; method scotch;
// method hierarchical; // method hierarchical;
@ -59,11 +61,8 @@ multiLevelCoeffs
} }
} }
// Desired output // Desired output
simpleCoeffs simpleCoeffs
{ {
n (2 1 1); n (2 1 1);

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "domainDecomposition.H" #include "domainDecomposition.H"
#include "Time.H"
#include "dictionary.H" #include "dictionary.H"
#include "labelIOList.H" #include "labelIOList.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
@ -341,10 +340,10 @@ bool Foam::domainDecomposition::writeDecomposition()
const labelList& curProcessorPatchStarts = const labelList& curProcessorPatchStarts =
procProcessorPatchStartIndex_[procI]; procProcessorPatchStartIndex_[procI];
const labelListList& curSubPatchIDs = const labelListList& curSubPatchIDs =
procProcessorPatchSubPatchIDs_[procI]; procProcessorPatchSubPatchIDs_[procI];
const labelListList& curSubStarts = const labelListList& curSubStarts =
procProcessorPatchSubPatchStarts_[procI]; procProcessorPatchSubPatchStarts_[procI];
const polyPatchList& meshPatches = boundaryMesh(); const polyPatchList& meshPatches = boundaryMesh();

View File

@ -41,6 +41,9 @@ SourceFiles
#include "SLList.H" #include "SLList.H"
#include "PtrList.H" #include "PtrList.H"
#include "point.H" #include "point.H"
#include "Time.H"
#include "volFields.H"
namespace Foam namespace Foam
{ {
@ -80,7 +83,7 @@ class domainDecomposition
// original face. In order to do this properly, all face // original face. In order to do this properly, all face
// indices will be incremented by 1 and the decremented as // indices will be incremented by 1 and the decremented as
// necessary to avoid the problem of face number zero having no // necessary to avoid the problem of face number zero having no
// sign. // sign.
List<DynamicList<label> > procFaceAddressing_; List<DynamicList<label> > procFaceAddressing_;
//- Labels of cells for each processor //- Labels of cells for each processor

View File

@ -114,7 +114,35 @@ void Foam::domainDecomposition::distributeCells()
if (sameProcFaces.empty()) if (sameProcFaces.empty())
{ {
cellToProc_ = decomposePtr().decompose(*this, cellCentres()); if (decompositionDict_.found("weightField"))
{
word weightName = decompositionDict_.lookup("weightField");
volScalarField weights
(
IOobject
(
weightName,
time().timeName(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
*this
);
cellToProc_ = decomposePtr().decompose
(
*this,
cellCentres(),
weights.internalField()
);
}
else
{
cellToProc_ = decomposePtr().decompose(*this, cellCentres());
}
} }
else else
{ {
@ -173,12 +201,49 @@ void Foam::domainDecomposition::distributeCells()
// Do decomposition on agglomeration // Do decomposition on agglomeration
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cellToProc_ = decomposePtr().decompose if (decompositionDict_.found("weightField"))
( {
*this, scalarField regionWeights(globalRegion.nRegions(), 0);
globalRegion,
regionCentres word weightName = decompositionDict_.lookup("weightField");
);
volScalarField weights
(
IOobject
(
weightName,
time().timeName(),
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
*this
);
forAll(globalRegion, cellI)
{
label regionI = globalRegion[cellI];
regionWeights[regionI] += weights.internalField()[cellI];
}
cellToProc_ = decomposePtr().decompose
(
*this,
globalRegion,
regionCentres,
regionWeights
);
}
else
{
cellToProc_ = decomposePtr().decompose
(
*this,
globalRegion,
regionCentres
);
}
} }
Info<< "\nFinished decomposition in " Info<< "\nFinished decomposition in "

View File

@ -6,6 +6,7 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lgenericPatchFields \
-ldecompositionMethods \ -ldecompositionMethods \
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \ -L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
-lmeshTools \ -lmeshTools \

View File

@ -86,9 +86,51 @@ autoPtr<fvMesh> createMesh
if (!haveMesh) if (!haveMesh)
{ {
// Create dummy mesh. Only used on procs that don't have mesh. // Create dummy mesh. Only used on procs that don't have mesh.
{
IOdictionary fvSolution
(
IOobject
(
"fvSolution",
runTime.system(),
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE
)
);
Pout<< "Writing dummy " << fvSolution.objectPath() << endl;
fvSolution.regIOobject::write();
}
{
IOdictionary fvSchemes
(
IOobject
(
"fvSchemes",
runTime.system(),
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE
)
);
fvSchemes.add("divSchemes", dictionary());
fvSchemes.add("gradSchemes", dictionary());
fvSchemes.add("laplacianSchemes", dictionary());
Pout<< "Writing dummy " << fvSchemes.objectPath() << endl;
fvSchemes.regIOobject::write();
}
Pout<< "Creating dummy mesh from " << io.objectPath() << endl;
fvMesh dummyMesh fvMesh dummyMesh
( (
io, IOobject
(
io.name(),
io.instance(),
io.db(),
IOobject::NO_READ
),
xferCopy(pointField()), xferCopy(pointField()),
xferCopy(faceList()), xferCopy(faceList()),
xferCopy(labelList()), xferCopy(labelList()),
@ -510,19 +552,22 @@ int main(int argc, char *argv[])
"specify the merge distance relative to the bounding box size " "specify the merge distance relative to the bounding box size "
"(default 1E-6)" "(default 1E-6)"
); );
// Create argList. This will check for non-existing processor dirs.
# include "setRootCase.H" # include "setRootCase.H"
//- Not useful anymore. See above. // Create processor directory if non-existing
//// Create processor directory if non-existing if (!Pstream::master() && !isDir(args.path()))
//if (!Pstream::master() && !isDir(args.path())) {
//{ Pout<< "Creating case directory " << args.path() << endl;
// Pout<< "Creating case directory " << args.path() << endl; mkDir(args.path());
// mkDir(args.path()); }
//}
// Switch timeStamp checking to one which does not do any
// parallel sync for same reason
regIOobject::fileModificationChecking = regIOobject::timeStamp;
# include "createTime.H" # include "createTime.H"
word regionName = polyMesh::defaultRegion; word regionName = polyMesh::defaultRegion;
fileName meshSubDir; fileName meshSubDir;

View File

@ -166,6 +166,18 @@ surfaces
// triangulate false; // triangulate false;
} }
movingNearWall_interpolated
{
// Sample cell values off patch. Does not need to be the near-wall
// cell, can be arbitrarily far away.
type patchInternalField;
patchName movingWall;
distance 0.0001;
interpolate true;
// Optional: whether to leave as faces (=default) or triangulate
// triangulate false;
}
interpolatedIso interpolatedIso
{ {
// Iso surface for interpolated values only // Iso surface for interpolated values only

File diff suppressed because it is too large Load Diff

View File

@ -57,8 +57,10 @@ runParallel()
then then
echo "$APP_RUN already run on $PWD: remove log file to run" echo "$APP_RUN already run on $PWD: remove log file to run"
else else
echo "Running $APP_RUN in parallel on $PWD using $1 processes" nProcs=$1
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 ) shift
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_RUN 2>&1 )
fi fi
} }

View File

@ -70,8 +70,12 @@ are READ_IF_MODIFIED. It means that slaves read exactly the same dictionary
as the master so cannot be used for dictionaries that contain e.g. mesh as the master so cannot be used for dictionaries that contain e.g. mesh
specific information. specific information.
- note: even if the file does not exist (e.g. when timeStampMaster) it
will still register a local file with the fileMonitor. This is so fileMonitor
stays synchronised. So take care when reading/creating non-parallel dictionary.
- inotify is a monitoring framework used to monitor changes in - inotify is a monitoring framework used to monitor changes in
lots of files (e.g. used in desktop searched like beagle). You specify lots of files (e.g. used in desktop search engines like beagle). You specify
files to monitor and then get warned for any changes to these files. files to monitor and then get warned for any changes to these files.
It does not need timestamps. There is no need for fileModificationSkew It does not need timestamps. There is no need for fileModificationSkew
to allow for time differences. (there can still temporarily be a difference to allow for time differences. (there can still temporarily be a difference

View File

@ -319,7 +319,7 @@ void Foam::fileMonitor::checkFiles() const
if (ready < 0) if (ready < 0)
{ {
FatalErrorIn("fileMonitor::updateStates()") FatalErrorIn("fileMonitor::checkFiles()")
<< "Problem in issuing select." << "Problem in issuing select."
<< abort(FatalError); << abort(FatalError);
} }
@ -335,7 +335,7 @@ void Foam::fileMonitor::checkFiles() const
if (nBytes < 0) if (nBytes < 0)
{ {
FatalErrorIn("fileMonitor::updateStates(const fileName&)") FatalErrorIn("fileMonitor::checkFiles()")
<< "read of " << watcher_->inotifyFd_ << "read of " << watcher_->inotifyFd_
<< " failed with " << label(nBytes) << " failed with " << label(nBytes)
<< abort(FatalError); << abort(FatalError);
@ -374,7 +374,7 @@ void Foam::fileMonitor::checkFiles() const
) )
{ {
// Correct directory and name // Correct directory and name
state_[i] = MODIFIED; localState_[i] = MODIFIED;
} }
} }
} }
@ -403,18 +403,17 @@ void Foam::fileMonitor::checkFiles() const
if (newTime == 0) if (newTime == 0)
{ {
state_[watchFd] = DELETED; localState_[watchFd] = DELETED;
} }
else else
{ {
if (newTime > (oldTime + regIOobject::fileModificationSkew)) if (newTime > (oldTime + regIOobject::fileModificationSkew))
{ {
watcher_->lastMod_[watchFd] = newTime; localState_[watchFd] = MODIFIED;
state_[watchFd] = MODIFIED;
} }
else else
{ {
state_[watchFd] = UNMODIFIED; localState_[watchFd] = UNMODIFIED;
} }
} }
} }
@ -422,12 +421,14 @@ void Foam::fileMonitor::checkFiles() const
} }
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fileMonitor::fileMonitor(const bool useInotify) Foam::fileMonitor::fileMonitor(const bool useInotify)
: :
useInotify_(useInotify), useInotify_(useInotify),
localState_(20),
state_(20), state_(20),
watchFile_(20), watchFile_(20),
freeWatchFds_(2), freeWatchFds_(2),
@ -476,6 +477,7 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
} }
else else
{ {
localState_(watchFd) = UNMODIFIED;
state_(watchFd) = UNMODIFIED; state_(watchFd) = UNMODIFIED;
watchFile_(watchFd) = fName; watchFile_(watchFd) = fName;
} }
@ -517,30 +519,26 @@ void Foam::fileMonitor::updateStates
{ {
if (Pstream::master() || !masterOnly) if (Pstream::master() || !masterOnly)
{ {
// Update the localState_
checkFiles(); checkFiles();
} }
if (syncPar) if (syncPar)
{ {
// Pack current state (might be on master only) // Pack local state (might be on master only)
PackedList<2> stats(state_.size(), MODIFIED); PackedList<2> stats(state_.size(), MODIFIED);
if (Pstream::master() || !masterOnly) if (Pstream::master() || !masterOnly)
{ {
forAll(state_, watchFd) forAll(state_, watchFd)
{ {
stats[watchFd] = static_cast<unsigned int>(state_[watchFd]); stats[watchFd] = static_cast<unsigned int>
(
localState_[watchFd]
);
} }
} }
// Save local state for warning message below
PackedList<2> thisProcStats;
if (!masterOnly)
{
thisProcStats = stats;
}
// Scatter or reduce to synchronise state // Scatter or reduce to synchronise state
if (masterOnly) if (masterOnly)
{ {
@ -573,43 +571,49 @@ void Foam::fileMonitor::updateStates
} }
// Update local state // Update synchronised state
forAll(state_, watchFd) forAll(state_, watchFd)
{ {
if (masterOnly) // Assign synchronised state
unsigned int stat = stats[watchFd];
state_[watchFd] = fileState(stat);
if (!masterOnly)
{ {
// No need to check for inconsistent state. Just assign. // Give warning for inconsistent state
unsigned int stat = stats[watchFd]; if (state_[watchFd] != localState_[watchFd])
state_[watchFd] = fileState(stat);
}
else
{
// Check for inconsistent state before assigning.
if (thisProcStats[watchFd] != UNMODIFIED)
{ {
if (stats[watchFd] == UNMODIFIED) if (debug)
{ {
WarningIn("fileMonitor::updateStates(const bool) const") Pout<< "fileMonitor : Delaying reading "
<< "Delaying reading " << watchFile_[watchFd] << watchFile_[watchFd]
<< " due to inconsistent " << " due to inconsistent "
"file time-stamps between processors" "file time-stamps between processors"
<< endl; << endl;
} }
else
{ WarningIn
unsigned int stat = stats[watchFd]; (
state_[watchFd] = fileState(stat); "fileMonitor::updateStates"
} "(const bool, const bool) const"
) << "Delaying reading " << watchFile_[watchFd]
<< " due to inconsistent "
"file time-stamps between processors" << endl;
} }
} }
} }
} }
else
{
state_ = localState_;
}
} }
void Foam::fileMonitor::setUnmodified(const label watchFd) void Foam::fileMonitor::setUnmodified(const label watchFd)
{ {
state_[watchFd] = UNMODIFIED; state_[watchFd] = UNMODIFIED;
localState_[watchFd] = UNMODIFIED;
if (!useInotify_) if (!useInotify_)
{ {

View File

@ -71,7 +71,7 @@ public:
{ {
UNMODIFIED = 0, UNMODIFIED = 0,
MODIFIED = 1, MODIFIED = 1,
DELETED = 2, DELETED = 2
}; };
static const NamedEnum<fileState, 3> fileStateNames_; static const NamedEnum<fileState, 3> fileStateNames_;
@ -82,7 +82,10 @@ private:
//- Whether to use inotify (requires -DFOAM_USE_INOTIFY, see above) //- Whether to use inotify (requires -DFOAM_USE_INOTIFY, see above)
const bool useInotify_; const bool useInotify_;
//- State for all watchFds //- State for all watchFds based on local files
mutable DynamicList<fileState> localState_;
//- State for all watchFds - synchronised
mutable DynamicList<fileState> state_; mutable DynamicList<fileState> state_;
//- Filename for all watchFds //- Filename for all watchFds
@ -97,7 +100,7 @@ private:
// Private Member Functions // Private Member Functions
//- Update state_ from any events. //- Update localState_ from any events.
void checkFiles() const; void checkFiles() const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct

View File

@ -537,7 +537,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
{ {
transform transform
( (
procPatch.reverseT(), procPatch.forwardT(),
receiveFaces.size(), receiveFaces.size(),
receiveFacesInfo receiveFacesInfo
); );

View File

@ -55,46 +55,59 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
close(); close();
} }
if (masterOnly) if (masterOnly && Pstream::parRun())
{ {
// Scatter master data // Scatter master data using communication scheme
if (Pstream::master())
{ const List<Pstream::commsStruct>& comms =
for (
( (Pstream::nProcs() < Pstream::nProcsSimpleSum)
int slave=Pstream::firstSlave(); ? Pstream::linearCommunication()
slave<=Pstream::lastSlave(); : Pstream::treeCommunication()
slave++ );
)
{
// Note: use ASCII for now - binary IO of dictionaries is // Get my communication order
// not currently supported const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
OPstream toSlave
( // Reveive from up
Pstream::scheduled, if (myComm.above() != -1)
slave,
0,
UPstream::msgType(),
IOstream::ASCII
);
IOdictionary::writeData(toSlave);
}
}
else
{ {
if (debug) if (debug)
{ {
Pout<< "IOdictionary : Reading " << objectPath() Pout<< "IOdictionary : Reading " << objectPath()
<< " from master processor " << Pstream::masterNo() << endl; << " from processor " << myComm.above() << endl;
} }
IPstream fromMaster
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
IPstream fromAbove
( (
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo(), myComm.above(),
0, 0,
IOstream::ASCII IOstream::ASCII
); );
IOdictionary::readData(fromMaster); IOdictionary::readData(fromAbove);
}
// Send to my downstairs neighbours
forAll(myComm.below(), belowI)
{
if (debug)
{
Pout<< "IOdictionary : Sending " << objectPath()
<< " to processor " << myComm.below()[belowI] << endl;
}
OPstream toBelow
(
Pstream::scheduled,
myComm.below()[belowI],
0,
Pstream::msgType(),
IOstream::ASCII
);
IOdictionary::writeData(toBelow);
} }
} }
} }

View File

@ -60,7 +60,6 @@ Foam::regIOobject::fileCheckTypes Foam::regIOobject::fileModificationChecking
debug::optimisationSwitches().lookup debug::optimisationSwitches().lookup
( (
"fileModificationChecking" "fileModificationChecking"
//Foam::regIOobject::timeStamp
) )
) )
); );

View File

@ -177,55 +177,69 @@ bool Foam::regIOobject::read()
regIOobject::fileModificationChecking == timeStampMaster regIOobject::fileModificationChecking == timeStampMaster
|| regIOobject::fileModificationChecking == inotifyMaster; || regIOobject::fileModificationChecking == inotifyMaster;
bool ok; bool ok = true;
if (Pstream::master() || !masterOnly) if (Pstream::master() || !masterOnly)
{ {
if (IFstream::debug)
{
Pout<< "regIOobject::read() : "
<< "reading object " << name()
<< " from file " << endl;
}
ok = readData(readStream(type())); ok = readData(readStream(type()));
close(); close();
} }
if (masterOnly) if (masterOnly && Pstream::parRun())
{ {
// Scatter master data // Scatter master data using communication scheme
if (Pstream::master())
{ const List<Pstream::commsStruct>& comms =
for (
( (Pstream::nProcs() < Pstream::nProcsSimpleSum)
int slave=Pstream::firstSlave(); ? Pstream::linearCommunication()
slave<=Pstream::lastSlave(); : Pstream::treeCommunication()
slave++ );
)
{
// Note: use ASCII for now - binary IO of dictionaries is // Get my communication order
// not currently supported const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
OPstream toSlave
( // Reveive from up
Pstream::scheduled, if (myComm.above() != -1)
slave,
0,
UPstream::msgType(),
IOstream::ASCII
);
writeData(toSlave);
}
}
else
{ {
if (IFstream::debug) if (IFstream::debug)
{ {
Pout<< "regIOobject::read() : " Pout<< "regIOobject::read() : "
<< "reading object " << name() << "reading object " << name()
<< " from master processor " << Pstream::masterNo() << " from processor " << myComm.above()
<< endl; << endl;
} }
IPstream fromMaster
// Note: use ASCII for now - binary IO of dictionaries is
// not currently supported
IPstream fromAbove
( (
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo(), myComm.above(),
0, 0,
IOstream::ASCII IOstream::ASCII
); );
ok = readData(fromMaster); ok = readData(fromAbove);
}
// Send to my downstairs neighbours
forAll(myComm.below(), belowI)
{
OPstream toBelow
(
Pstream::scheduled,
myComm.below()[belowI],
0,
Pstream::msgType(),
IOstream::ASCII
);
writeData(toBelow);
} }
} }
return ok; return ok;

View File

@ -31,6 +31,7 @@ License
#include "IOobject.H" #include "IOobject.H"
#include "JobInfo.H" #include "JobInfo.H"
#include "labelList.H" #include "labelList.H"
#include "regIOobject.H"
#include <cctype> #include <cctype>
@ -767,6 +768,16 @@ Foam::argList::argList
sigQuit_.set(bannerEnabled); sigQuit_.set(bannerEnabled);
sigSegv_.set(bannerEnabled); sigSegv_.set(bannerEnabled);
if (bannerEnabled)
{
Info<< "Monitoring run-time modified files using "
<< regIOobject::fileCheckTypesNames
[
regIOobject::fileModificationChecking
]
<< endl;
}
if (Pstream::master() && bannerEnabled) if (Pstream::master() && bannerEnabled)
{ {
Info<< endl; Info<< endl;

View File

@ -41,16 +41,20 @@ Foam::cyclicLduInterfaceField::~cyclicLduInterfaceField()
void Foam::cyclicLduInterfaceField::transformCoupleField void Foam::cyclicLduInterfaceField::transformCoupleField
( (
scalarField& pnf, scalarField& f,
const direction cmpt const direction cmpt
) const ) const
{ {
if (doTransform()) if (doTransform())
{ {
scalar forwardScale = if (forwardT().size() == 1)
pow(diag(forwardT()[0]).component(cmpt), rank()); {
f *= pow(diag(forwardT()[0]).component(cmpt), rank());
pnf *= forwardScale; }
else
{
f *= pow(diag(forwardT())().component(cmpt), rank());
}
} }
} }

View File

@ -43,9 +43,39 @@ static const Foam::List<Foam::word> subDictNames
); );
//! @endcond //! @endcond
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::solution::read(const dictionary& dict)
{
if (dict.found("cache"))
{
cache_ = dict.subDict("cache");
caching_ = cache_.lookupOrDefault("active", true);
}
if (dict.found("relaxationFactors"))
{
relaxationFactors_ = dict.subDict("relaxationFactors");
}
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
if (dict.found("solvers"))
{
solvers_ = dict.subDict("solvers");
upgradeSolverDict(solvers_);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName) Foam::solution::solution
(
const objectRegistry& obr,
const fileName& dictName
)
: :
IOdictionary IOdictionary
( (
@ -64,7 +94,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
defaultRelaxationFactor_(0), defaultRelaxationFactor_(0),
solvers_(ITstream("solvers", tokenList())()) solvers_(ITstream("solvers", tokenList())())
{ {
read(); read(solutionDict());
} }
@ -250,26 +280,7 @@ bool Foam::solution::read()
{ {
if (regIOobject::read()) if (regIOobject::read())
{ {
const dictionary& dict = solutionDict(); read(solutionDict());
if (dict.found("cache"))
{
cache_ = dict.subDict("cache");
caching_ = cache_.lookupOrDefault("active", true);
}
if (dict.found("relaxationFactors"))
{
relaxationFactors_ = dict.subDict("relaxationFactors");
}
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
if (dict.found("solvers"))
{
solvers_ = dict.subDict("solvers");
upgradeSolverDict(solvers_);
}
return true; return true;
} }

View File

@ -70,6 +70,9 @@ class solution
// Private Member Functions // Private Member Functions
//- Read settings from the dictionary
void read(const dictionary&);
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
solution(const solution&); solution(const solution&);
void operator=(const solution&); void operator=(const solution&);
@ -89,7 +92,11 @@ public:
// Constructors // Constructors
//- Construct for given objectRegistry and dictionary //- Construct for given objectRegistry and dictionary
solution(const objectRegistry& obr, const fileName& dictName); solution
(
const objectRegistry& obr,
const fileName& dictName
);
// Member Functions // Member Functions

View File

@ -1220,7 +1220,17 @@ void Foam::globalPoints::calculateSharedPoints
// Do one exchange iteration to get neighbour points. // Do one exchange iteration to get neighbour points.
{ {
PstreamBuffers pBufs(Pstream::defaultCommsType); // Note: to use 'scheduled' would have to intersperse send and receive.
// So for now just use nonBlocking. Also globalPoints itself gets
// constructed by mesh.globalData().patchSchedule() so creates a loop.
PstreamBuffers pBufs
(
(
Pstream::defaultCommsType == Pstream::scheduled
? Pstream::nonBlocking
: Pstream::defaultCommsType
)
);
sendPatchPoints sendPatchPoints
( (
mergeSeparated, mergeSeparated,
@ -1251,7 +1261,14 @@ void Foam::globalPoints::calculateSharedPoints
do do
{ {
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs
(
(
Pstream::defaultCommsType == Pstream::scheduled
? Pstream::nonBlocking
: Pstream::defaultCommsType
)
);
sendPatchPoints sendPatchPoints
( (
mergeSeparated, mergeSeparated,
@ -1400,7 +1417,15 @@ void Foam::globalPoints::calculateSharedPoints
Pout<< "Determined " << changedIndices.size() << " shared points." Pout<< "Determined " << changedIndices.size() << " shared points."
<< " Exchanging them" << endl; << " Exchanging them" << endl;
} }
PstreamBuffers pBufs(Pstream::defaultCommsType); PstreamBuffers pBufs
(
(
Pstream::defaultCommsType == Pstream::scheduled
? Pstream::nonBlocking
: Pstream::defaultCommsType
)
);
sendSharedPoints(mergeSeparated, pBufs, changedIndices); sendSharedPoints(mergeSeparated, pBufs, changedIndices);
pBufs.finishedSends(); pBufs.finishedSends();
receiveSharedPoints receiveSharedPoints

View File

@ -49,6 +49,7 @@ class objectMap;
inline bool operator==(const objectMap& a, const objectMap& b); inline bool operator==(const objectMap& a, const objectMap& b);
inline bool operator!=(const objectMap& a, const objectMap& b); inline bool operator!=(const objectMap& a, const objectMap& b);
inline Ostream& operator<<(Ostream&, const objectMap&); inline Ostream& operator<<(Ostream&, const objectMap&);
inline Istream& operator>>(Istream&, objectMap&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -100,6 +101,8 @@ public:
// IOstream Operators // IOstream Operators
friend Ostream& operator<<(Ostream&, const objectMap&); friend Ostream& operator<<(Ostream&, const objectMap&);
friend Istream& operator>>(Istream&, objectMap&);
}; };

View File

@ -122,6 +122,19 @@ inline Ostream& operator<<(Ostream& os, const objectMap& a)
} }
inline Istream& operator>>(Istream& is, objectMap& a)
{
is.readBegin("objectMap");
is >> a.index_ >> a.masterObjects_;
is.readEnd("objectMap");
// Check state of Istream
is.check("Istream& operator>>(Istream&, objectMap&)");
return is;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // Master namespace Foam } // Master namespace Foam

View File

@ -194,6 +194,10 @@ void Foam::cyclicPolyPatch::calcTransforms
vectorField half0Normals(half0Areas.size()); vectorField half0Normals(half0Areas.size());
vectorField half1Normals(half1Areas.size()); vectorField half1Normals(half1Areas.size());
//- Additional warning about faces non-aligned with rotation axis
//scalar maxCos = -GREAT;
//label maxFacei = -1;
forAll(half0, facei) forAll(half0, facei)
{ {
scalar magSf = mag(half0Areas[facei]); scalar magSf = mag(half0Areas[facei]);
@ -233,9 +237,33 @@ void Foam::cyclicPolyPatch::calcTransforms
{ {
half0Normals[facei] = half0Areas[facei] / magSf; half0Normals[facei] = half0Areas[facei] / magSf;
half1Normals[facei] = half1Areas[facei] / nbrMagSf; half1Normals[facei] = half1Areas[facei] / nbrMagSf;
//if (transform_ == ROTATIONAL)
//{
// scalar cos = mag(half0Normals[facei] & rotationAxis_);
// if (cos > maxCos)
// {
// maxCos = cos;
// maxFacei = facei;
// }
//}
} }
} }
//if (maxCos > sqrt(SMALL))
//{
// WarningIn
// (
// "cyclicPolyPatch::calcTransforms()"
// ) << "on patch " << name()
// << " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei]
// << " is not perpendicular to the rotationAxis." << endl
// << "This will cause problems with topology changes." << endl
// << "rotation axis : " << rotationAxis_ << endl
// << "face normal : " << half0Normals[maxFacei] << endl
// << "cosine of angle : " << maxCos << endl;
//}
// Calculate transformation tensors // Calculate transformation tensors
calcTransformTensors calcTransformTensors
( (
@ -450,6 +478,35 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
} }
Foam::cyclicPolyPatch::cyclicPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& neighbPatchName,
const transformType transform,
const vector& rotationAxis,
const point& rotationCentre,
const vector& separationVector
)
:
coupledPolyPatch(name, size, start, index, bm),
neighbPatchName_(neighbPatchName),
neighbPatchID_(-1),
transform_(transform),
rotationAxis_(rotationAxis),
rotationCentre_(rotationCentre),
separationVector_(separationVector),
coupledPointsPtr_(NULL),
coupledEdgesPtr_(NULL)
{
// Neighbour patch might not be valid yet so no transformation
// calculation possible.
}
Foam::cyclicPolyPatch::cyclicPolyPatch Foam::cyclicPolyPatch::cyclicPolyPatch
( (
const word& name, const word& name,

View File

@ -213,6 +213,21 @@ public:
const polyBoundaryMesh& bm const polyBoundaryMesh& bm
); );
//- Construct from components
cyclicPolyPatch
(
const word& name,
const label size,
const label start,
const label index,
const polyBoundaryMesh& bm,
const word& neighbPatchName,
const transformType transform, // transformation type
const vector& rotationAxis, // for rotation only
const point& rotationCentre, // for rotation only
const vector& separationVector // for translation only
);
//- Construct from dictionary //- Construct from dictionary
cyclicPolyPatch cyclicPolyPatch
( (

View File

@ -58,13 +58,35 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str)
{} {}
Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
(
const List<int>& initxadj,
const List<int>& initadjncy,
const scalarField& initcWeights,
List<int>& finalDecomp
) const
{
FatalErrorIn
(
"label ptscotchDecomp::decompose"
"("
"const List<int>&, "
"const List<int>&, "
"const scalarField&, "
"List<int>&"
")"
) << notImplementedMessage << exit(FatalError);
return -1;
}
Foam::label Foam::ptscotchDecomp::decompose Foam::label Foam::ptscotchDecomp::decompose
( (
List<int>& adjncy, const List<int>& adjncy,
List<int>& xadj, const List<int>& xadj,
const scalarField& cWeights, const scalarField& cWeights,
List<int>& finalDecomp List<int>& finalDecomp
) ) const
{ {
FatalErrorIn FatalErrorIn
( (

View File

@ -142,6 +142,7 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C $(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C $(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
$(derivedFvPatchFields)/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/slip/slipFvPatchFields.C $(derivedFvPatchFields)/slip/slipFvPatchFields.C
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C $(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C $(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C

View File

@ -272,15 +272,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
newValues = sampleField(); newValues = sampleField();
} }
mapDistribute::distribute distMap.distribute(newValues);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break; break;
} }
@ -305,15 +297,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fieldType& nbrField = sampleField(); const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID]; newValues = nbrField.boundaryField()[nbrPatchID];
mapDistribute::distribute distMap.distribute(newValues);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break; break;
} }
@ -335,16 +319,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
} }
} }
mapDistribute::distribute distMap.distribute(allValues);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allValues
);
newValues.transfer(allValues); newValues.transfer(allValues);
break; break;

View File

@ -212,26 +212,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
} }
} }
mapDistribute::distribute distMap.distribute(allUValues);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allUValues
);
newUValues.transfer(allUValues); newUValues.transfer(allUValues);
mapDistribute::distribute distMap.distribute(allPhiValues);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allPhiValues
);
newPhiValues.transfer(allPhiValues); newPhiValues.transfer(allPhiValues);
break; break;
@ -244,28 +228,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
); );
newUValues = UField.boundaryField()[nbrPatchID]; newUValues = UField.boundaryField()[nbrPatchID];
distMap.distribute(newUValues);
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newUValues
);
newPhiValues = phiField.boundaryField()[nbrPatchID]; newPhiValues = phiField.boundaryField()[nbrPatchID];
distMap.distribute(newPhiValues);
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newPhiValues
);
break; break;
} }

View File

@ -0,0 +1,387 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "selfContainedDirectMappedFixedValueFvPatchField.H"
#include "volFields.H"
#include "interpolationCell.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(p.patch()),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero),
interpolationScheme_(interpolationCell<Type>::typeName)
{}
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
directMappedPatchBase(p.patch(), ptf),
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{}
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
directMappedPatchBase(p.patch(), dict),
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average"))),
interpolationScheme_(interpolationCell<Type>::typeName)
{
if (mode() == directMappedPatchBase::NEARESTCELL)
{
dict.lookup("interpolationScheme") >> interpolationScheme_;
}
}
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average,
const word& interpolationScheme
)
:
directMappedPatchBase
(
p.patch(),
sampleRegion,
sampleMode,
samplePatch,
distance
),
fixedValueFvPatchField<Type>(p, iF),
fieldName_(fieldName),
setAverage_(setAverage),
average_(average),
interpolationScheme_(interpolationScheme)
{}
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{}
template<class Type>
selfContainedDirectMappedFixedValueFvPatchField<Type>::
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
directMappedPatchBase(ptf.patch().patch(), ptf),
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_),
interpolationScheme_(ptf.interpolationScheme_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
const GeometricField<Type, fvPatchField, volMesh>&
selfContainedDirectMappedFixedValueFvPatchField<Type>::sampleField() const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
if (sameRegion())
{
if (fieldName_ == this->dimensionedInternalField().name())
{
// Optimisation: bypass field lookup
return
dynamic_cast<const fieldType&>
(
this->dimensionedInternalField()
);
}
else
{
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
return thisMesh.lookupObject<fieldType>(fieldName_);
}
}
else
{
return nbrMesh.lookupObject<fieldType>(fieldName_);
}
}
template<class Type>
const interpolation<Type>&
selfContainedDirectMappedFixedValueFvPatchField<Type>::interpolator() const
{
if (!interpolator_.valid())
{
interpolator_ = interpolation<Type>::New
(
interpolationScheme_,
sampleField()
);
}
return interpolator_();
}
template<class Type>
void selfContainedDirectMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = directMappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
switch (mode())
{
case NEARESTCELL:
{
if (interpolationScheme_ != interpolationCell<Type>::typeName)
{
// Need to do interpolation so need cells to sample.
// Send back sample points to the processor that holds the cell
vectorField samples(samplePoints());
distMap.reverseDistribute
(
(sameRegion() ? thisMesh.nCells() : nbrMesh.nCells()),
point::max,
samples
);
const interpolation<Type>& interp = interpolator();
newValues.setSize(samples.size(), pTraits<Type>::max);
forAll(samples, cellI)
{
if (samples[cellI] != point::max)
{
newValues[cellI] = interp.interpolate
(
samples[cellI],
cellI
);
}
}
}
else
{
newValues = sampleField();
}
distMap.distribute(newValues);
break;
}
case NEARESTPATCHFACE:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
samplePatch()
);
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void "
"selfContainedDirectMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField = sampleField();
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
distMap.distribute(allValues);
newValues.transfer(allValues);
break;
}
default:
{
FatalErrorIn
(
"selfContainedDirectMappedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
) << "Unknown sampling mode: " << mode()
<< nl << abort(FatalError);
}
}
if (setAverage_)
{
Type averagePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(averagePsi)/mag(average_) > 0.5)
{
newValues *= mag(average_)/mag(averagePsi);
}
else
{
newValues += (average_ - averagePsi);
}
}
this->operator==(newValues);
if (debug)
{
Info<< "selfContainedDirectMapped on field:"
<< this->dimensionedInternalField().name()
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void selfContainedDirectMappedFixedValueFvPatchField<Type>::write(Ostream& os)
const
{
fvPatchField<Type>::write(os);
directMappedPatchBase::write(os);
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
os.writeKeyword("interpolationScheme") << interpolationScheme_
<< token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,208 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::selfContainedDirectMappedFixedValueFvPatchField
Description
Self-contained version of directMapped. Does not use information on
patch, instead holds it locally (and possibly duplicate) so use
normal directMapped in preference and only use this if you cannot
change the underlying patch type to directMapped.
SourceFiles
selfContainedDirectMappedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef selfContainedDirectMappedFixedValueFvPatchField_H
#define selfContainedDirectMappedFixedValueFvPatchField_H
#include "directMappedPatchBase.H"
#include "fixedValueFvPatchFields.H"
#include "interpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class selfContainedDirectMappedFixedValueFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class selfContainedDirectMappedFixedValueFvPatchField
:
public directMappedPatchBase,
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of field to sample - defaults to field associated with this
// patchField if not specified
word fieldName_;
//- If true adjust the mapped field to maintain average value average_
const bool setAverage_;
//- Average value the mapped field is adjusted to maintain if
// setAverage_ is set true
const Type average_;
//- Interpolation scheme to use for nearestcell mode
word interpolationScheme_;
mutable autoPtr<interpolation<Type> > interpolator_;
// Private Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;
//- Access the interpolation method
const interpolation<Type>& interpolator() const;
public:
//- Runtime type information
TypeName("selfContainedDirectMapped");
// Constructors
//- Construct from patch and internal field
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct from patch, internal field and distance for normal type
// sampling
selfContainedDirectMappedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
// directMappedPatchBase
const word& sampleRegion,
const sampleMode sampleMode,
const word& samplePatch,
const scalar distance,
// My settings
const word& fieldName,
const bool setAverage,
const Type average,
const word& interpolationScheme
);
//- Construct by mapping given
// selfContainedDirectMappedFixedValueFvPatchField
// onto a new patch
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new selfContainedDirectMappedFixedValueFvPatchField<Type>
(
*this
)
);
}
//- Construct as copy setting internal field reference
selfContainedDirectMappedFixedValueFvPatchField
(
const selfContainedDirectMappedFixedValueFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new selfContainedDirectMappedFixedValueFvPatchField<Type>
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "selfContainedDirectMappedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(selfContainedDirectMappedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef selfContainedDirectMappedFixedValueFvPatchFields_H
#define selfContainedDirectMappedFixedValueFvPatchFields_H
#include "selfContainedDirectMappedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(selfContainedDirectMappedFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#ifndef selfContainedDirectMappedFixedValueFvPatchFieldsFwd_H
#define selfContainedDirectMappedFixedValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class selfContainedDirectMappedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(selfContainedDirectMappedFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,9 +28,9 @@ License
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false)); int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
void Foam::fvSchemes::clear() void Foam::fvSchemes::clear()
@ -53,6 +53,198 @@ void Foam::fvSchemes::clear()
defaultFluxRequired_ = false; defaultFluxRequired_ = false;
} }
void Foam::fvSchemes::read(const dictionary& dict)
{
if (dict.found("ddtSchemes"))
{
ddtSchemes_ = dict.subDict("ddtSchemes");
}
else if (dict.found("timeScheme"))
{
// For backward compatibility.
// The timeScheme will be deprecated with warning or removed
WarningIn("fvSchemes::read()")
<< "Using deprecated 'timeScheme' instead of 'ddtSchemes'"
<< nl << endl;
word schemeName(dict.lookup("timeScheme"));
if (schemeName == "EulerImplicit")
{
schemeName = "Euler";
}
else if (schemeName == "BackwardDifferencing")
{
schemeName = "backward";
}
else if (schemeName == "SteadyState")
{
schemeName = "steadyState";
}
else
{
FatalIOErrorIn("fvSchemes::read()", dict.lookup("timeScheme"))
<< "\n Only EulerImplicit, BackwardDifferencing and "
"SteadyState\n are supported by the old timeScheme "
"specification.\n Please use ddtSchemes instead."
<< exit(FatalIOError);
}
ddtSchemes_.set("default", schemeName);
ddtSchemes_.lookup("default")[0].lineNumber() =
dict.lookup("timeScheme").lineNumber();
}
else
{
ddtSchemes_.set("default", "none");
}
if
(
ddtSchemes_.found("default")
&& word(ddtSchemes_.lookup("default")) != "none"
)
{
defaultDdtScheme_ = ddtSchemes_.lookup("default");
}
if (dict.found("d2dt2Schemes"))
{
d2dt2Schemes_ = dict.subDict("d2dt2Schemes");
}
else if (dict.found("timeScheme"))
{
// For backward compatibility.
// The timeScheme will be deprecated with warning or removed
WarningIn("fvSchemes::read()")
<< "Using deprecated 'timeScheme' instead of 'd2dt2Schemes'"
<< nl << endl;
word schemeName(dict.lookup("timeScheme"));
if (schemeName == "EulerImplicit")
{
schemeName = "Euler";
}
else if (schemeName == "SteadyState")
{
schemeName = "steadyState";
}
d2dt2Schemes_.set("default", schemeName);
d2dt2Schemes_.lookup("default")[0].lineNumber() =
dict.lookup("timeScheme").lineNumber();
}
else
{
d2dt2Schemes_.set("default", "none");
}
if
(
d2dt2Schemes_.found("default")
&& word(d2dt2Schemes_.lookup("default")) != "none"
)
{
defaultD2dt2Scheme_ = d2dt2Schemes_.lookup("default");
}
if (dict.found("interpolationSchemes"))
{
interpolationSchemes_ = dict.subDict("interpolationSchemes");
}
else if (!interpolationSchemes_.found("default"))
{
interpolationSchemes_.add("default", "linear");
}
if
(
interpolationSchemes_.found("default")
&& word(interpolationSchemes_.lookup("default")) != "none"
)
{
defaultInterpolationScheme_ =
interpolationSchemes_.lookup("default");
}
divSchemes_ = dict.subDict("divSchemes");
if
(
divSchemes_.found("default")
&& word(divSchemes_.lookup("default")) != "none"
)
{
defaultDivScheme_ = divSchemes_.lookup("default");
}
gradSchemes_ = dict.subDict("gradSchemes");
if
(
gradSchemes_.found("default")
&& word(gradSchemes_.lookup("default")) != "none"
)
{
defaultGradScheme_ = gradSchemes_.lookup("default");
}
if (dict.found("snGradSchemes"))
{
snGradSchemes_ = dict.subDict("snGradSchemes");
}
else if (!snGradSchemes_.found("default"))
{
snGradSchemes_.add("default", "corrected");
}
if
(
snGradSchemes_.found("default")
&& word(snGradSchemes_.lookup("default")) != "none"
)
{
defaultSnGradScheme_ = snGradSchemes_.lookup("default");
}
laplacianSchemes_ = dict.subDict("laplacianSchemes");
if
(
laplacianSchemes_.found("default")
&& word(laplacianSchemes_.lookup("default")) != "none"
)
{
defaultLaplacianScheme_ = laplacianSchemes_.lookup("default");
}
if (dict.found("fluxRequired"))
{
fluxRequired_ = dict.subDict("fluxRequired");
if
(
fluxRequired_.found("default")
&& word(fluxRequired_.lookup("default")) != "none"
)
{
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default"));
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fvSchemes::fvSchemes(const objectRegistry& obr) Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
@ -169,7 +361,10 @@ Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
), ),
defaultFluxRequired_(false) defaultFluxRequired_(false)
{ {
read(); // persistent settings across reads is incorrect
clear();
read(schemesDict());
} }
@ -179,197 +374,10 @@ bool Foam::fvSchemes::read()
{ {
if (regIOobject::read()) if (regIOobject::read())
{ {
const dictionary& dict = schemesDict();
// persistent settings across reads is incorrect // persistent settings across reads is incorrect
clear(); clear();
if (dict.found("ddtSchemes")) read(schemesDict());
{
ddtSchemes_ = dict.subDict("ddtSchemes");
}
else if (dict.found("timeScheme"))
{
// For backward compatibility.
// The timeScheme will be deprecated with warning or removed
WarningIn("fvSchemes::read()")
<< "Using deprecated 'timeScheme' instead of 'ddtSchemes'"
<< nl << endl;
word schemeName(dict.lookup("timeScheme"));
if (schemeName == "EulerImplicit")
{
schemeName = "Euler";
}
else if (schemeName == "BackwardDifferencing")
{
schemeName = "backward";
}
else if (schemeName == "SteadyState")
{
schemeName = "steadyState";
}
else
{
FatalIOErrorIn("fvSchemes::read()", dict.lookup("timeScheme"))
<< "\n Only EulerImplicit, BackwardDifferencing and "
"SteadyState\n are supported by the old timeScheme "
"specification.\n Please use ddtSchemes instead."
<< exit(FatalIOError);
}
ddtSchemes_.set("default", schemeName);
ddtSchemes_.lookup("default")[0].lineNumber() =
dict.lookup("timeScheme").lineNumber();
}
else
{
ddtSchemes_.set("default", "none");
}
if
(
ddtSchemes_.found("default")
&& word(ddtSchemes_.lookup("default")) != "none"
)
{
defaultDdtScheme_ = ddtSchemes_.lookup("default");
}
if (dict.found("d2dt2Schemes"))
{
d2dt2Schemes_ = dict.subDict("d2dt2Schemes");
}
else if (dict.found("timeScheme"))
{
// For backward compatibility.
// The timeScheme will be deprecated with warning or removed
WarningIn("fvSchemes::read()")
<< "Using deprecated 'timeScheme' instead of 'd2dt2Schemes'"
<< nl << endl;
word schemeName(dict.lookup("timeScheme"));
if (schemeName == "EulerImplicit")
{
schemeName = "Euler";
}
else if (schemeName == "SteadyState")
{
schemeName = "steadyState";
}
d2dt2Schemes_.set("default", schemeName);
d2dt2Schemes_.lookup("default")[0].lineNumber() =
dict.lookup("timeScheme").lineNumber();
}
else
{
d2dt2Schemes_.set("default", "none");
}
if
(
d2dt2Schemes_.found("default")
&& word(d2dt2Schemes_.lookup("default")) != "none"
)
{
defaultD2dt2Scheme_ = d2dt2Schemes_.lookup("default");
}
if (dict.found("interpolationSchemes"))
{
interpolationSchemes_ = dict.subDict("interpolationSchemes");
}
else if (!interpolationSchemes_.found("default"))
{
interpolationSchemes_.add("default", "linear");
}
if
(
interpolationSchemes_.found("default")
&& word(interpolationSchemes_.lookup("default")) != "none"
)
{
defaultInterpolationScheme_ =
interpolationSchemes_.lookup("default");
}
divSchemes_ = dict.subDict("divSchemes");
if
(
divSchemes_.found("default")
&& word(divSchemes_.lookup("default")) != "none"
)
{
defaultDivScheme_ = divSchemes_.lookup("default");
}
gradSchemes_ = dict.subDict("gradSchemes");
if
(
gradSchemes_.found("default")
&& word(gradSchemes_.lookup("default")) != "none"
)
{
defaultGradScheme_ = gradSchemes_.lookup("default");
}
if (dict.found("snGradSchemes"))
{
snGradSchemes_ = dict.subDict("snGradSchemes");
}
else if (!snGradSchemes_.found("default"))
{
snGradSchemes_.add("default", "corrected");
}
if
(
snGradSchemes_.found("default")
&& word(snGradSchemes_.lookup("default")) != "none"
)
{
defaultSnGradScheme_ = snGradSchemes_.lookup("default");
}
laplacianSchemes_ = dict.subDict("laplacianSchemes");
if
(
laplacianSchemes_.found("default")
&& word(laplacianSchemes_.lookup("default")) != "none"
)
{
defaultLaplacianScheme_ = laplacianSchemes_.lookup("default");
}
if (dict.found("fluxRequired"))
{
fluxRequired_ = dict.subDict("fluxRequired");
if
(
fluxRequired_.found("default")
&& word(fluxRequired_.lookup("default")) != "none"
)
{
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default"));
}
}
return true; return true;
} }

View File

@ -84,6 +84,9 @@ class fvSchemes
//- Clear the dictionaries and streams before reading //- Clear the dictionaries and streams before reading
void clear(); void clear();
//- Read settings from the dictionary
void read(const dictionary&);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
fvSchemes(const fvSchemes&); fvSchemes(const fvSchemes&);

View File

@ -62,37 +62,29 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
if (!ppp.parallel()) if (!ppp.parallel())
{ {
if (ppp.forwardT().size() == 1) const tensor& T =
{ (
const tensor& T = ppp.forwardT()[0]; ppp.forwardT().size() == 1
transformPosition(T); ? ppp.forwardT()[0]
static_cast<ParticleType&>(*this).transformProperties(T); : ppp.forwardT()[faceI_]
} );
else
{ transformPosition(T);
const tensor& T = ppp.forwardT()[faceI_]; static_cast<ParticleType&>(*this).transformProperties(T);
transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T);
}
} }
else if (ppp.separated()) else if (ppp.separated())
{ {
if (ppp.separation().size() == 1) const vector& s =
{ (
position_ -= ppp.separation()[0]; (ppp.separation().size() == 1)
static_cast<ParticleType&>(*this).transformProperties ? ppp.separation()[0]
( : ppp.separation()[faceI_]
-ppp.separation()[0] );
); position_ -= s;
} static_cast<ParticleType&>(*this).transformProperties
else (
{ -s
position_ -= ppp.separation()[faceI_]; );
static_cast<ParticleType&>(*this).transformProperties
(
-ppp.separation()[faceI_]
);
}
} }
tetFaceI_ = faceI_ + ppp.start(); tetFaceI_ = faceI_ + ppp.start();
@ -815,21 +807,34 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
// See note in correctAfterParallelTransfer for tetPtI_ addressing. // See note in correctAfterParallelTransfer for tetPtI_ addressing.
tetPtI_ = cloud_.polyMesh_.faces()[tetFaceI_].size() - 1 - tetPtI_; tetPtI_ = cloud_.polyMesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
// Now the particle is on the receiving side // Now the particle is on the receiving side
if (!cpp.parallel()) if (!receiveCpp.parallel())
{ {
const tensor& T = cpp.reverseT()[0]; const tensor& T =
(
receiveCpp.forwardT().size() == 1
? receiveCpp.forwardT()[0]
: receiveCpp.forwardT()[receiveCpp.whichFace(faceI_)]
);
transformPosition(T); transformPosition(T);
static_cast<ParticleType&>(*this).transformProperties(T); static_cast<ParticleType&>(*this).transformProperties(T);
} }
else if (cpp.separated()) else if (receiveCpp.separated())
{ {
position_ += cpp.separation()[0]; const vector& s =
(
(receiveCpp.separation().size() == 1)
? receiveCpp.separation()[0]
: receiveCpp.separation()[receiveCpp.whichFace(faceI_)]
);
position_ -= s;
static_cast<ParticleType&>(*this).transformProperties static_cast<ParticleType&>(*this).transformProperties
( (
cpp.separation()[0] -s
); );
} }
} }

View File

@ -504,7 +504,22 @@ Foam::polyMesh* Foam::blockMesh::createTopology
dictionary& dict = patchDicts[patchI]; dictionary& dict = patchDicts[patchI];
// Add but not override type // Add but not override type
dict.add("type", patchTypes[patchI], false); if (!dict.found("type"))
{
dict.add("type", patchTypes[patchI], false);
}
else if (word(dict.lookup("type")) != patchTypes[patchI])
{
IOWarningIn
(
"blockMesh::createTopology(IOdictionary&)",
meshDescription
) << "For patch " << patchNames[patchI]
<< " overriding type '" << patchTypes[patchI]
<< "' with '" << word(dict.lookup("type"))
<< "' (read from boundary file)"
<< endl;
}
// Override neighbourpatch name // Override neighbourpatch name
if (nbrPatchNames[patchI] != word::null) if (nbrPatchNames[patchI] != word::null)

View File

@ -473,7 +473,7 @@ void Foam::PointEdgeWave<Type>::handleProcPatches()
// Apply transform to received data for non-parallel planes // Apply transform to received data for non-parallel planes
if (!procPatch.parallel()) if (!procPatch.parallel())
{ {
transform(procPatch.reverseT(), patchInfo); transform(procPatch.forwardT(), patchInfo);
} }
updateFromPatchInfo updateFromPatchInfo

View File

@ -527,13 +527,14 @@ void Foam::directMappedPatchBase::calcMapping() const
constructMap[procI] constructMap[procI]
); );
if (debug) //if (debug)
{ //{
Pout<< "To proc:" << procI << " sending values of cells/faces:" // Pout<< "To proc:" << procI << " sending values of cells/faces:"
<< subMap[procI] << endl; // << subMap[procI] << endl;
Pout<< "From proc:" << procI << " receiving values of patch faces:" // Pout<< "From proc:" << procI
<< constructMap[procI] << endl; // << " receiving values of patch faces:"
} // << constructMap[procI] << endl;
//}
} }
// Redo constructSize // Redo constructSize
@ -644,6 +645,28 @@ Foam::directMappedPatchBase::directMappedPatchBase
{} {}
Foam::directMappedPatchBase::directMappedPatchBase
(
const polyPatch& pp,
const word& sampleRegion,
const sampleMode mode,
const word& samplePatch,
const scalar distance
)
:
patch_(pp),
sampleRegion_(sampleRegion),
mode_(mode),
samplePatch_(samplePatch),
offsetMode_(NORMAL),
offset_(vector::zero),
offsets_(0),
distance_(distance),
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
mapPtr_(NULL)
{}
Foam::directMappedPatchBase::directMappedPatchBase Foam::directMappedPatchBase::directMappedPatchBase
( (
const polyPatch& pp, const polyPatch& pp,

View File

@ -206,15 +206,15 @@ public:
const vector& offset const vector& offset
); );
////- Construct from normal and distance //- Construct from offsetMode=normal and distance
//directMappedPatchBase directMappedPatchBase
//( (
// const polyPatch& pp, const polyPatch& pp,
// const word& sampleRegion, const word& sampleRegion,
// const word& samplePatch, const sampleMode sampleMode,
// const sampleMode sampleMode, const word& samplePatch,
// const vector& offset const scalar distance
//); );
//- Construct from dictionary //- Construct from dictionary
directMappedPatchBase(const polyPatch&, const dictionary&); directMappedPatchBase(const polyPatch&, const dictionary&);

View File

@ -28,6 +28,7 @@ License
#include "cellSet.H" #include "cellSet.H"
#include "Time.H" #include "Time.H"
#include "IFstream.H" #include "IFstream.H"
#include "fieldDictionary.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
@ -207,7 +208,7 @@ void Foam::fieldToCell::applyToSet
IFstream str(fieldObject.filePath()); IFstream str(fieldObject.filePath());
// Read dictionary // Read dictionary
dictionary fieldDict(str); fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
scalarField internalVals("internalField", fieldDict, mesh().nCells()); scalarField internalVals("internalField", fieldDict, mesh().nCells());
@ -218,7 +219,7 @@ void Foam::fieldToCell::applyToSet
IFstream str(fieldObject.filePath()); IFstream str(fieldObject.filePath());
// Read dictionary // Read dictionary
dictionary fieldDict(str); fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
vectorField internalVals("internalField", fieldDict, mesh().nCells()); vectorField internalVals("internalField", fieldDict, mesh().nCells());

View File

@ -108,6 +108,7 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "Time.H" #include "Time.H"
#include "OFstream.H" #include "OFstream.H"
#include "globalIndex.H"
extern "C" extern "C"
{ {
@ -157,16 +158,204 @@ void Foam::ptscotchDecomp::check(const int retVal, const char* str)
} }
//- Does prevention of 0 cell domains and calls ptscotch.
Foam::label Foam::ptscotchDecomp::decomposeZeroDomains
(
const List<int>& initadjncy,
const List<int>& initxadj,
const scalarField& initcWeights,
List<int>& finalDecomp
) const
{
globalIndex globalCells(initxadj.size()-1);
bool hasZeroDomain = false;
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
if (globalCells.localSize(procI) == 0)
{
hasZeroDomain = true;
break;
}
}
if (!hasZeroDomain)
{
return decompose
(
initadjncy,
initxadj,
initcWeights,
finalDecomp
);
}
if (debug)
{
Info<< "ptscotchDecomp : have graphs with locally 0 cells."
<< " trickling down." << endl;
}
// Make sure every domain has at least one cell
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// (scotch does not like zero sized domains)
// Trickle cells from processors that have them up to those that
// don't.
// Number of cells to send to the next processor
// (is same as number of cells next processor has to receive)
List<int> nSendCells(Pstream::nProcs(), 0);
for (label procI = nSendCells.size()-1; procI >=1; procI--)
{
label nLocalCells = globalCells.localSize(procI);
if (nLocalCells-nSendCells[procI] < 1)
{
nSendCells[procI-1] = nSendCells[procI]-nLocalCells+1;
}
}
// First receive (so increasing the sizes of all arrays)
Field<int> xadj(initxadj);
Field<int> adjncy(initadjncy);
scalarField cWeights(initcWeights);
if (Pstream::myProcNo() >= 1 && nSendCells[Pstream::myProcNo()-1] > 0)
{
// Receive cells from previous processor
IPstream fromPrevProc(Pstream::blocking, Pstream::myProcNo()-1);
Field<int> prevXadj(fromPrevProc);
Field<int> prevAdjncy(fromPrevProc);
scalarField prevCellWeights(fromPrevProc);
if (prevXadj.size() != nSendCells[Pstream::myProcNo()-1])
{
FatalErrorIn("ptscotchDecomp::decompose(..)")
<< "Expected from processor " << Pstream::myProcNo()-1
<< " connectivity for " << nSendCells[Pstream::myProcNo()-1]
<< " nCells but only received " << prevXadj.size()
<< abort(FatalError);
}
// Insert adjncy
prepend(prevAdjncy, adjncy);
// Adapt offsets and prepend xadj
xadj += prevAdjncy.size();
prepend(prevXadj, xadj);
// Weights
prepend(prevCellWeights, cWeights);
}
// Send to my next processor
if (nSendCells[Pstream::myProcNo()] > 0)
{
// Send cells to next processor
OPstream toNextProc(Pstream::blocking, Pstream::myProcNo()+1);
int nCells = nSendCells[Pstream::myProcNo()];
int startCell = xadj.size()-1 - nCells;
int startFace = xadj[startCell];
int nFaces = adjncy.size()-startFace;
// Send for all cell data: last nCells elements
// Send for all face data: last nFaces elements
toNextProc
<< Field<int>::subField(xadj, nCells, startCell)-startFace
<< Field<int>::subField(adjncy, nFaces, startFace)
<<
(
cWeights.size()
? scalarField::subField(cWeights, nCells, startCell)
: scalarField(0)
);
// Remove data that has been sent
if (cWeights.size())
{
cWeights.setSize(cWeights.size()-nCells);
}
adjncy.setSize(adjncy.size()-nFaces);
xadj.setSize(xadj.size() - nCells);
}
// Do decomposition as normal. Sets finalDecomp.
label result = decompose(adjncy, xadj, cWeights, finalDecomp);
if (debug)
{
Info<< "ptscotchDecomp : have graphs with locally 0 cells."
<< " trickling up." << endl;
}
// If we sent cells across make sure we undo it
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Receive back from next processor if I sent something
if (nSendCells[Pstream::myProcNo()] > 0)
{
IPstream fromNextProc(Pstream::blocking, Pstream::myProcNo()+1);
List<int> nextFinalDecomp(fromNextProc);
if (nextFinalDecomp.size() != nSendCells[Pstream::myProcNo()])
{
FatalErrorIn("parMetisDecomp::decompose(..)")
<< "Expected from processor " << Pstream::myProcNo()+1
<< " decomposition for " << nSendCells[Pstream::myProcNo()]
<< " nCells but only received " << nextFinalDecomp.size()
<< abort(FatalError);
}
append(nextFinalDecomp, finalDecomp);
}
// Send back to previous processor.
if (Pstream::myProcNo() >= 1 && nSendCells[Pstream::myProcNo()-1] > 0)
{
OPstream toPrevProc(Pstream::blocking, Pstream::myProcNo()-1);
int nToPrevious = nSendCells[Pstream::myProcNo()-1];
toPrevProc <<
SubList<int>
(
finalDecomp,
nToPrevious,
finalDecomp.size()-nToPrevious
);
// Remove locally what has been sent
finalDecomp.setSize(finalDecomp.size()-nToPrevious);
}
return result;
}
// Call scotch with options from dictionary. // Call scotch with options from dictionary.
Foam::label Foam::ptscotchDecomp::decompose Foam::label Foam::ptscotchDecomp::decompose
( (
List<int>& adjncy, const List<int>& adjncy,
List<int>& xadj, const List<int>& xadj,
const scalarField& cWeights, const scalarField& cWeights,
List<int>& finalDecomp List<int>& finalDecomp
) ) const
{ {
if (debug)
{
Pout<< "ptscotchDecomp : entering with xadj:" << xadj.size() << endl;
}
// // Dump graph // // Dump graph
// if (decompositionDict_.found("ptscotchCoeffs")) // if (decompositionDict_.found("ptscotchCoeffs"))
// { // {
@ -262,8 +451,7 @@ Foam::label Foam::ptscotchDecomp::decompose
{ {
WarningIn WarningIn
( (
"ptscotchDecomp::decompose" "ptscotchDecomp::decompose(..)"
"(const pointField&, const scalarField&)"
) << "Illegal minimum weight " << minWeights ) << "Illegal minimum weight " << minWeights
<< endl; << endl;
} }
@ -272,8 +460,7 @@ Foam::label Foam::ptscotchDecomp::decompose
{ {
FatalErrorIn FatalErrorIn
( (
"ptscotchDecomp::decompose" "ptscotchDecomp::decompose(..)"
"(const pointField&, const scalarField&)"
) << "Number of cell weights " << cWeights.size() ) << "Number of cell weights " << cWeights.size()
<< " does not equal number of cells " << xadj.size()-1 << " does not equal number of cells " << xadj.size()-1
<< exit(FatalError); << exit(FatalError);
@ -289,8 +476,25 @@ Foam::label Foam::ptscotchDecomp::decompose
if (debug)
{
Pout<< "SCOTCH_dgraphInit" << endl;
}
SCOTCH_Dgraph grafdat; SCOTCH_Dgraph grafdat;
check(SCOTCH_dgraphInit(&grafdat, MPI_COMM_WORLD), "SCOTCH_dgraphInit"); check(SCOTCH_dgraphInit(&grafdat, MPI_COMM_WORLD), "SCOTCH_dgraphInit");
if (debug)
{
Pout<< "SCOTCH_dgraphBuild with:" << nl
<< "xadj.size() : " << xadj.size()-1 << nl
<< "xadj : " << long(xadj.begin()) << nl
<< "velotab : " << long(velotab.begin()) << nl
<< "adjncy.size() : " << adjncy.size() << nl
<< "adjncy : " << long(adjncy.begin()) << nl
<< endl;
}
check check
( (
SCOTCH_dgraphBuild SCOTCH_dgraphBuild
@ -302,19 +506,25 @@ Foam::label Foam::ptscotchDecomp::decompose
const_cast<SCOTCH_Num*>(xadj.begin()), const_cast<SCOTCH_Num*>(xadj.begin()),
// vertloctab, start index per cell into // vertloctab, start index per cell into
// adjncy // adjncy
&xadj[1], // vendloctab, end index ,, const_cast<SCOTCH_Num*>(&xadj[1]),// vendloctab, end index ,,
velotab.begin(), // veloloctab, vertex weights const_cast<SCOTCH_Num*>(velotab.begin()),// veloloctab, vtx weights
NULL, // vlblloctab NULL, // vlblloctab
adjncy.size(), // edgelocnbr, number of arcs adjncy.size(), // edgelocnbr, number of arcs
adjncy.size(), // edgelocsiz adjncy.size(), // edgelocsiz
adjncy.begin(), // edgeloctab const_cast<SCOTCH_Num*>(adjncy.begin()), // edgeloctab
NULL, // edgegsttab NULL, // edgegsttab
NULL // edlotab, edge weights NULL // edlotab, edge weights
), ),
"SCOTCH_dgraphBuild" "SCOTCH_dgraphBuild"
); );
if (debug)
{
Pout<< "SCOTCH_dgraphCheck" << endl;
}
check(SCOTCH_dgraphCheck(&grafdat), "SCOTCH_dgraphCheck"); check(SCOTCH_dgraphCheck(&grafdat), "SCOTCH_dgraphCheck");
@ -322,6 +532,10 @@ Foam::label Foam::ptscotchDecomp::decompose
// ~~~~~~~~~~~~ // ~~~~~~~~~~~~
// (fully connected network topology since using switch) // (fully connected network topology since using switch)
if (debug)
{
Pout<< "SCOTCH_archInit" << endl;
}
SCOTCH_Arch archdat; SCOTCH_Arch archdat;
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit"); check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
@ -349,6 +563,10 @@ Foam::label Foam::ptscotchDecomp::decompose
} }
else else
{ {
if (debug)
{
Pout<< "SCOTCH_archCmplt" << endl;
}
check check
( (
SCOTCH_archCmplt(&archdat, nProcessors_), SCOTCH_archCmplt(&archdat, nProcessors_),
@ -373,6 +591,10 @@ Foam::label Foam::ptscotchDecomp::decompose
); );
# endif # endif
if (debug)
{
Pout<< "SCOTCH_dgraphMap" << endl;
}
finalDecomp.setSize(xadj.size()-1); finalDecomp.setSize(xadj.size()-1);
finalDecomp = 0; finalDecomp = 0;
check check
@ -406,6 +628,10 @@ Foam::label Foam::ptscotchDecomp::decompose
// "SCOTCH_graphPart" // "SCOTCH_graphPart"
//); //);
if (debug)
{
Pout<< "SCOTCH_dgraphExit" << endl;
}
// Release storage for graph // Release storage for graph
SCOTCH_dgraphExit(&grafdat); SCOTCH_dgraphExit(&grafdat);
// Release storage for strategy // Release storage for strategy
@ -465,7 +691,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
// Decompose using default weights // Decompose using default weights
List<int> finalDecomp; List<int> finalDecomp;
decompose(cellCells.m(), cellCells.offsets(), pointWeights, finalDecomp); decomposeZeroDomains
(
cellCells.m(),
cellCells.offsets(),
pointWeights,
finalDecomp
);
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());
@ -510,7 +742,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
// Decompose using weights // Decompose using weights
List<int> finalDecomp; List<int> finalDecomp;
decompose(cellCells.m(), cellCells.offsets(), pointWeights, finalDecomp); decomposeZeroDomains
(
cellCells.m(),
cellCells.offsets(),
pointWeights,
finalDecomp
);
// Rework back into decomposition for original mesh // Rework back into decomposition for original mesh
labelList fineDistribution(agglom.size()); labelList fineDistribution(agglom.size());
@ -557,7 +795,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
// Decompose using weights // Decompose using weights
List<int> finalDecomp; List<int> finalDecomp;
decompose(cellCells.m(), cellCells.offsets(), cWeights, finalDecomp); decomposeZeroDomains
(
cellCells.m(),
cellCells.offsets(),
cWeights,
finalDecomp
);
// Copy back to labelList // Copy back to labelList
labelList decomp(finalDecomp.size()); labelList decomp(finalDecomp.size());

View File

@ -50,16 +50,33 @@ class ptscotchDecomp
{ {
// Private Member Functions // Private Member Functions
//- Insert list in front of list.
template<class Type>
static void prepend(const UList<Type>&, List<Type>&);
//- Insert list at end of list.
template<class Type>
static void append(const UList<Type>&, List<Type>&);
//- Check and print error message //- Check and print error message
static void check(const int, const char*); static void check(const int, const char*);
//- Decompose with optionally zero sized domains
label decomposeZeroDomains
(
const List<int>& initadjncy,
const List<int>& initxadj,
const scalarField& initcWeights,
List<int>& finalDecomp
) const;
//- Decompose
label decompose label decompose
( (
List<int>& adjncy, const List<int>& adjncy,
List<int>& xadj, const List<int>& xadj,
const scalarField& cWeights, const scalarField& cWeights,
List<int>& finalDecomp List<int>& finalDecomp
); ) const;
//- Disallow default bitwise copy construct and assignment //- Disallow default bitwise copy construct and assignment
void operator=(const ptscotchDecomp&); void operator=(const ptscotchDecomp&);
@ -135,6 +152,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ptscotchDecompTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,76 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ptscotchDecomp.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// Insert at front of list
template<class Type>
void Foam::ptscotchDecomp::prepend
(
const UList<Type>& extraLst,
List<Type>& lst
)
{
label nExtra = extraLst.size();
// Make space for initial elements
lst.setSize(lst.size() + nExtra);
for (label i = lst.size()-1; i >= nExtra; i--)
{
lst[i] = lst[i-nExtra];
}
// Insert at front
forAll(extraLst, i)
{
lst[i] = extraLst[i];
}
}
// Insert at back of list
template<class Type>
void Foam::ptscotchDecomp::append
(
const UList<Type>& extraLst,
List<Type>& lst
)
{
label sz = lst.size();
// Make space for initial elements
lst.setSize(sz + extraLst.size());
// Insert at back
forAll(extraLst, i)
{
lst[sz++] = extraLst[i];
}
}
// ************************************************************************* //

View File

@ -440,15 +440,7 @@ void Foam::distributedTriSurfaceMesh::findLine
// Exchange the segments // Exchange the segments
// ~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~
map.distribute map.distribute(allSegments);
(
Pstream::nonBlocking, //Pstream::scheduled,
List<labelPair>(0), //map.schedule(),
map.constructSize(),
map.subMap(), // what to send
map.constructMap(), // what to receive
allSegments
);
// Do tests I need to do // Do tests I need to do
@ -490,21 +482,7 @@ void Foam::distributedTriSurfaceMesh::findLine
// Exchange the intersections (opposite to segments) // Exchange the intersections (opposite to segments)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
map.distribute map.reverseDistribute(nOldAllSegments, intersections);
(
//Pstream::scheduled,
//map.schedule // Note reverse schedule
//(
// map.constructMap(),
// map.subMap()
//),
Pstream::nonBlocking,
List<labelPair>(0),
nOldAllSegments,
map.constructMap(), // what to send
map.subMap(), // what to receive
intersections
);
// Extract the hits // Extract the hits
@ -657,17 +635,7 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
// Send over queries // Send over queries
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
map.distribute map.distribute(triangleIndex);
(
//Pstream::scheduled,
//map.schedule(),
Pstream::nonBlocking,
List<labelPair>(0),
map.constructSize(),
map.subMap(), // what to send
map.constructMap(), // what to receive
triangleIndex
);
return mapPtr; return mapPtr;
@ -1589,28 +1557,8 @@ void Foam::distributedTriSurfaceMesh::findNearest
// swap samples to local processor // swap samples to local processor
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
map.distribute map.distribute(allCentres);
( map.distribute(allRadiusSqr);
//Pstream::scheduled,
//map.schedule(),
Pstream::nonBlocking,
List<labelPair>(0),
map.constructSize(),
map.subMap(), // what to send
map.constructMap(), // what to receive
allCentres
);
map.distribute
(
//Pstream::scheduled,
//map.schedule(),
Pstream::nonBlocking,
List<labelPair>(0),
map.constructSize(),
map.subMap(), // what to send
map.constructMap(), // what to receive
allRadiusSqr
);
// Do my tests // Do my tests
@ -1634,21 +1582,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
// Send back results // Send back results
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
map.distribute map.reverseDistribute(allSegmentMap.size(), allInfo);
(
//Pstream::scheduled,
//map.schedule // note reverse schedule
//(
// map.constructMap(),
// map.subMap()
//),
Pstream::nonBlocking,
List<labelPair>(0),
allSegmentMap.size(),
map.constructMap(), // what to send
map.subMap(), // what to receive
allInfo
);
// Extract information // Extract information
@ -1887,21 +1821,7 @@ void Foam::distributedTriSurfaceMesh::getRegion
// Send back results // Send back results
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
map.distribute map.reverseDistribute(info.size(), region);
(
//Pstream::scheduled,
//map.schedule // note reverse schedule
//(
// map.constructMap(),
// map.subMap()
//),
Pstream::nonBlocking,
List<labelPair>(0),
info.size(),
map.constructMap(), // what to send
map.subMap(), // what to receive
region
);
} }
@ -1951,21 +1871,7 @@ void Foam::distributedTriSurfaceMesh::getNormal
// Send back results // Send back results
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
map.distribute map.reverseDistribute(info.size(), normal);
(
//Pstream::scheduled,
//map.schedule // note reverse schedule
//(
// map.constructMap(),
// map.subMap()
//),
Pstream::nonBlocking,
List<labelPair>(0),
info.size(),
map.constructMap(), // what to send
map.subMap(), // what to receive
normal
);
} }
@ -2019,15 +1925,7 @@ void Foam::distributedTriSurfaceMesh::getField
// Send back results // Send back results
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
map.distribute map.reverseDistribute(info.size(), values);
(
Pstream::nonBlocking,
List<labelPair>(0),
info.size(),
map.constructMap(), // what to send
map.subMap(), // what to receive
values
);
} }
} }

View File

@ -76,15 +76,7 @@ License
// // Send back results // // Send back results
// // ~~~~~~~~~~~~~~~~~ // // ~~~~~~~~~~~~~~~~~
// //
// map.distribute // map.reverseDistribute(info.size(), values);
// (
// Pstream::nonBlocking,
// List<labelPair>(0),
// info.size(),
// map.constructMap(), // what to send
// map.subMap(), // what to receive
// values
// );
//} //}
@ -115,15 +107,7 @@ void Foam::distributedTriSurfaceMesh::distributeFields
label oldSize = field.size(); label oldSize = field.size();
map.distribute map.distribute(field);
(
Pstream::nonBlocking,
List<labelPair>(0),
map.constructSize(),
map.subMap(),
map.constructMap(),
field
);
if (debug) if (debug)
{ {

View File

@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C
fieldValues/cellSource/cellSource.C fieldValues/cellSource/cellSource.C
fieldValues/cellSource/cellSourceFunctionObject.C fieldValues/cellSource/cellSourceFunctionObject.C
nearWallFields/nearWallFields.C
nearWallFields/nearWallFieldsFunctionObject.C
readFields/readFields.C readFields/readFields.C
readFields/readFieldsFunctionObject.C readFields/readFieldsFunctionObject.C

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::IOnearWallFields
Description
Instance of the generic IOOutputFilter for nearWallFields.
\*---------------------------------------------------------------------------*/
#ifndef IOnearWallFields_H
#define IOnearWallFields_H
#include "nearWallFields.H"
#include "IOOutputFilter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOOutputFilter<nearWallFields> IOnearWallFields;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,179 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nearWallFields.H"
//#include "volFields.H"
//#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
//#include "interpolationCellPoint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(nearWallFields, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::nearWallFields::nearWallFields
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
name_(name),
obr_(obr),
active_(true),
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
{
active_ = false;
WarningIn
(
"nearWallFields::nearWallFields"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
<< endl;
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::nearWallFields::~nearWallFields()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::nearWallFields::read(const dictionary& dict)
{
if (active_)
{
const fvMesh& mesh = refCast<const fvMesh>(obr_);
dict.lookup("fields") >> fieldSet_;
patchSet_ =
mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches")));
distance_ = readScalar(dict.lookup("distance"));
// Clear out any previously loaded fields
vsf_.clear();
vvf_.clear();
vSpheretf_.clear();
vSymmtf_.clear();
vtf_.clear();
fieldMap_.clear();
reverseFieldMap_.clear();
// Generate fields with selfContainedDirectMapped bc.
// Convert field to map
fieldMap_.resize(2*fieldSet_.size());
reverseFieldMap_.resize(2*fieldSet_.size());
forAll(fieldSet_, setI)
{
const word& fldName = fieldSet_[setI].first();
const word& sampleFldName = fieldSet_[setI].second();
fieldMap_.insert(fldName, sampleFldName);
reverseFieldMap_.insert(sampleFldName, fldName);
}
createFields(vsf_);
createFields(vvf_);
createFields(vSpheretf_);
createFields(vSymmtf_);
createFields(vtf_);
}
}
void Foam::nearWallFields::execute()
{
if (active_)
{
sampleFields(vsf_);
sampleFields(vvf_);
sampleFields(vSpheretf_);
sampleFields(vSymmtf_);
sampleFields(vtf_);
}
}
void Foam::nearWallFields::end()
{
// Do nothing
}
void Foam::nearWallFields::write()
{
// Do nothing
if (active_)
{
Info<< "Writing sampled fields to " << obr_.time().timeName()
<< endl;
forAll(vsf_, i)
{
vsf_[i].write();
}
forAll(vvf_, i)
{
vvf_[i].write();
}
forAll(vSpheretf_, i)
{
vSpheretf_[i].write();
}
forAll(vSymmtf_, i)
{
vSymmtf_[i].write();
}
forAll(vtf_, i)
{
vtf_[i].write();
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,206 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::nearWallFields
Description
Samples near-patch volFields
Holds fields
- every timestep the field get updated with new values
- at write it writes the fields
so this functionObject can either be used to calculate a new field
as a postprocessing step or (since the fields are registered)
use these in another functionObject (e.g. faceSource).
surfaceValues
{
type nearWallFields;
..
enabled true;
outputControl outputTime;
..
// Name of volField and corresponding surfaceField
fields ((p pNear)(U UNear));
// Name of patch to sample
patches (movingWall);
// Distance away from the wall
distance 0.13; // distance away from wall
}
SourceFiles
nearWallFields.C
IOnearWallFields.H
\*---------------------------------------------------------------------------*/
#ifndef nearWallFields_H
#define nearWallFields_H
#include "OFstream.H"
#include "volFields.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class nearWallFields Declaration
\*---------------------------------------------------------------------------*/
class nearWallFields
{
protected:
// Protected data
//- Name of this set of nearWallFields object
word name_;
const objectRegistry& obr_;
//- on/off switch
bool active_;
// Read from dictionary
//- Fields to process
List<Tuple2<word, word> > fieldSet_;
//- Patches to sample
labelHashSet patchSet_;
//- Distance away from wall
scalar distance_;
//- From original field to sampled result
HashTable<word> fieldMap_;
//- From resulting back to original field
HashTable<word> reverseFieldMap_;
//- Locally constructed fields
PtrList<volScalarField> vsf_;
PtrList<volVectorField> vvf_;
PtrList<volSphericalTensorField> vSpheretf_;
PtrList<volSymmTensorField> vSymmtf_;
PtrList<volTensorField> vtf_;
// Protected Member Functions
//- Disallow default bitwise copy construct
nearWallFields(const nearWallFields&);
//- Disallow default bitwise assignment
void operator=(const nearWallFields&);
template<class Type>
void createFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
) const;
template<class Type>
void sampleFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >&
) const;
public:
//- Runtime type information
TypeName("nearWallFields");
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
nearWallFields
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
);
//- Destructor
virtual ~nearWallFields();
// Member Functions
//- Return name of the nearWallFields object
virtual const word& name() const
{
return name_;
}
//- Read the field min/max data
virtual void read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Execute at the final time-loop, currently does nothing
virtual void end();
//- Write
virtual void write();
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Update for changes of mesh
virtual void movePoints(const pointField&)
{}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "nearWallFieldsTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nearWallFieldsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
nearWallFieldsFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
nearWallFieldsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Typedef
Foam::nearWallFieldsFunctionObject
Description
FunctionObject wrapper around nearWallFields to allow
them to be created via the functions entry within controlDict.
SourceFiles
nearWallFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef nearWallFieldsFunctionObject_H
#define nearWallFieldsFunctionObject_H
#include "nearWallFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<nearWallFields>
nearWallFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "nearWallFields.H"
#include "selfContainedDirectMappedFixedValueFvPatchFields.H"
#include "interpolationCellPoint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::nearWallFields::createFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
HashTable<const vfType*> flds(obr_.lookupClass<vfType>());
forAllConstIter(typename HashTable<const vfType*>, flds, iter)
{
const vfType& fld = *iter();
if (fieldMap_.found(fld.name()))
{
const word& sampleFldName = fieldMap_[fld.name()];
if (obr_.found(sampleFldName))
{
Info<< " a field " << sampleFldName
<< " already exists on the mesh."
<< endl;
}
else
{
label sz = sflds.size();
sflds.setSize(sz+1);
IOobject io(fld);
io.readOpt() = IOobject::NO_READ;
io.rename(sampleFldName);
sflds.set(sz, new vfType(io, fld));
vfType& sampleFld = sflds[sz];
// Reset the bcs to be directMapped
forAllConstIter(labelHashSet, patchSet_, iter)
{
label patchI = iter.key();
sampleFld.boundaryField().set
(
patchI,
new selfContainedDirectMappedFixedValueFvPatchField
<Type>
(
sampleFld.mesh().boundary()[patchI],
sampleFld.dimensionedInternalField(),
sampleFld.mesh().name(),
directMappedPatchBase::NEARESTCELL,
word::null, // samplePatch
-distance_,
sampleFld.name(), // fieldName
false, // setAverage
pTraits<Type>::zero, // average
interpolationCellPoint<Type>::typeName
)
);
}
Info<< " created " << sampleFld.name() << " to sample "
<< fld.name() << endl;
}
}
}
}
template<class Type>
void Foam::nearWallFields::sampleFields
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& sflds
) const
{
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
forAll(sflds, i)
{
const word& fldName = reverseFieldMap_[sflds[i].name()];
const vfType& fld = obr_.lookupObject<vfType>(fldName);
// Take over internal and boundary values
sflds[i] == fld;
// Evaluate to update the directMapped
sflds[i].correctBoundaryConditions();
}
}
// ************************************************************************* //

View File

@ -426,7 +426,8 @@ void Foam::streamLine::write()
); );
// Distribute the track positions // Distribute the track positions. Note: use scheduled comms
// to prevent buffering.
mapDistribute::distribute mapDistribute::distribute
( (
Pstream::scheduled, Pstream::scheduled,

View File

@ -24,7 +24,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "surfaceInterpolateFields.H" #include "surfaceInterpolateFields.H"
//#include "dictionary.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -89,20 +88,21 @@ void Foam::surfaceInterpolateFields::read(const dictionary& dict)
void Foam::surfaceInterpolateFields::execute() void Foam::surfaceInterpolateFields::execute()
{ {
//Info<< type() << " " << name_ << ":" << nl; if (active_)
{
// Clear out any previously loaded fields
ssf_.clear();
svf_.clear();
sSpheretf_.clear();
sSymmtf_.clear();
stf_.clear();
// Clear out any previously loaded fields interpolateFields<scalar>(ssf_);
ssf_.clear(); interpolateFields<vector>(svf_);
svf_.clear(); interpolateFields<sphericalTensor>(sSpheretf_);
sSpheretf_.clear(); interpolateFields<symmTensor>(sSymmtf_);
sSymmtf_.clear(); interpolateFields<tensor>(stf_);
stf_.clear(); }
interpolateFields<scalar>(ssf_);
interpolateFields<vector>(svf_);
interpolateFields<sphericalTensor>(sSpheretf_);
interpolateFields<symmTensor>(sSymmtf_);
interpolateFields<tensor>(stf_);
} }
@ -114,7 +114,32 @@ void Foam::surfaceInterpolateFields::end()
void Foam::surfaceInterpolateFields::write() void Foam::surfaceInterpolateFields::write()
{ {
// Do nothing if (active_)
{
Info<< "Writing interpolated surface fields to "
<< obr_.time().timeName() << endl;
forAll(ssf_, i)
{
ssf_[i].write();
}
forAll(svf_, i)
{
svf_[i].write();
}
forAll(sSpheretf_, i)
{
sSpheretf_[i].write();
}
forAll(sSymmtf_, i)
{
sSymmtf_[i].write();
}
forAll(stf_, i)
{
stf_[i].write();
}
}
} }

View File

@ -27,9 +27,24 @@ Class
Description Description
Linear interpolates volFields to surfaceFields Linear interpolates volFields to surfaceFields
Note: gets executed every time step. Could move it to write() but then - at write it writes the fields
you'd have problems if you have different write frequencies for different - it executes every time step
function objects.
so it can either be used to calculate and write the interpolate or
(since the interpolates are registered) use some other functionObject
to work on them.
sampleSomeFields
{
type surfaceInterpolateFields;
..
enabled true;
outputControl outputTime;
..
// Name of volField and corresponding surfaceField
fields ((p pInterpolate)(U UInterpolate));
}
SourceFiles SourceFiles
surfaceInterpolateFields.C surfaceInterpolateFields.C

View File

@ -27,6 +27,7 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
cuttingPlane/cuttingPlane.C cuttingPlane/cuttingPlane.C
sampledSurface/sampledPatch/sampledPatch.C sampledSurface/sampledPatch/sampledPatch.C
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
sampledSurface/sampledPlane/sampledPlane.C sampledSurface/sampledPlane/sampledPlane.C
sampledSurface/isoSurface/isoSurface.C sampledSurface/isoSurface/isoSurface.C
sampledSurface/isoSurface/sampledIsoSurface.C sampledSurface/isoSurface/sampledIsoSurface.C

View File

@ -157,6 +157,10 @@ void Foam::sampledPatch::remapFaces
if (&faceMap && faceMap.size()) if (&faceMap && faceMap.size())
{ {
MeshStorage::remapFaces(faceMap); MeshStorage::remapFaces(faceMap);
patchFaceLabels_ = labelList
(
UIndirectList<label>(patchFaceLabels_, faceMap)
);
} }
} }

View File

@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "sampledPatchInternalField.H"
#include "dictionary.H"
#include "polyMesh.H"
#include "polyPatch.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(sampledPatchInternalField, 0);
addNamedToRunTimeSelectionTable
(
sampledSurface,
sampledPatchInternalField,
word,
patchInternalField
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledPatchInternalField::sampledPatchInternalField
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
)
:
sampledPatch(name, mesh, dict),
directMappedPatchBase
(
mesh.boundaryMesh()[sampledPatch::patchIndex()],
mesh.name(), // sampleRegion
directMappedPatchBase::NEARESTCELL, // sampleMode
word::null, // samplePatch
-readScalar(dict.lookup("distance"))
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sampledPatchInternalField::~sampledPatchInternalField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::sampledPatchInternalField::sample
(
const volScalarField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::vectorField> Foam::sampledPatchInternalField::sample
(
const volVectorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::sphericalTensorField> Foam::sampledPatchInternalField::sample
(
const volSphericalTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledPatchInternalField::sample
(
const volSymmTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::tensorField> Foam::sampledPatchInternalField::sample
(
const volTensorField& vField
) const
{
return sampleField(vField);
}
Foam::tmp<Foam::scalarField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<scalar>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::vectorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<vector>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::sphericalTensorField>
Foam::sampledPatchInternalField::interpolate
(
const interpolation<sphericalTensor>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::symmTensorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<symmTensor>& interpolator
) const
{
return interpolateField(interpolator);
}
Foam::tmp<Foam::tensorField> Foam::sampledPatchInternalField::interpolate
(
const interpolation<tensor>& interpolator
) const
{
return interpolateField(interpolator);
}
void Foam::sampledPatchInternalField::print(Ostream& os) const
{
os << "sampledPatchInternalField: " << name() << " :"
<< " patch:" << patchName()
<< " faces:" << faces().size()
<< " points:" << points().size();
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::sampledPatchInternalField
Description
Variation of sampledPatch that samples the internalField (at a given
normal distance from the patch) instead of the patchField.
Note:
- interpolate=false : get cell value on faces
- interpolate=true : interpolate inside cell and interpolate to points
There is no option to get interpolated value inside the cell on the faces.
SourceFiles
sampledPatchInternalField.C
\*---------------------------------------------------------------------------*/
#ifndef sampledPatchInternalField_H
#define sampledPatchInternalField_H
#include "sampledPatch.H"
#include "directMappedPatchBase.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class sampledPatchInternalField Declaration
\*---------------------------------------------------------------------------*/
class sampledPatchInternalField
:
public sampledPatch,
public directMappedPatchBase
{
// Private Member Functions
//- sample field on faces
template <class Type>
tmp<Field<Type> > sampleField
(
const GeometricField<Type, fvPatchField, volMesh>& vField
) const;
template <class Type>
tmp<Field<Type> > interpolateField(const interpolation<Type>&) const;
public:
//- Runtime type information
TypeName("sampledPatchInternalField");
// Constructors
//- Construct from dictionary
sampledPatchInternalField
(
const word& name,
const polyMesh& mesh,
const dictionary& dict
);
//- Destructor
virtual ~sampledPatchInternalField();
// Member Functions
//- sample field on surface
virtual tmp<scalarField> sample
(
const volScalarField&
) const;
//- sample field on surface
virtual tmp<vectorField> sample
(
const volVectorField&
) const;
//- sample field on surface
virtual tmp<sphericalTensorField> sample
(
const volSphericalTensorField&
) const;
//- sample field on surface
virtual tmp<symmTensorField> sample
(
const volSymmTensorField&
) const;
//- sample field on surface
virtual tmp<tensorField> sample
(
const volTensorField&
) const;
//- interpolate field on surface
virtual tmp<scalarField> interpolate
(
const interpolation<scalar>&
) const;
//- interpolate field on surface
virtual tmp<vectorField> interpolate
(
const interpolation<vector>&
) const;
//- interpolate field on surface
virtual tmp<sphericalTensorField> interpolate
(
const interpolation<sphericalTensor>&
) const;
//- interpolate field on surface
virtual tmp<symmTensorField> interpolate
(
const interpolation<symmTensor>&
) const;
//- interpolate field on surface
virtual tmp<tensorField> interpolate
(
const interpolation<tensor>&
) const;
//- Write
virtual void print(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "sampledPatchInternalFieldTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "sampledPatchInternalField.H"
#include "interpolationCellPoint.H"
#include "PrimitivePatchInterpolation.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatchInternalField::sampleField
(
const GeometricField<Type, fvPatchField, volMesh>& vField
) const
{
const mapDistribute& distMap = map();
// One value per face
tmp<Field<Type> > tvalues(new Field<Type>(patchFaceLabels().size()));
Field<Type>& values = tvalues();
if (patchIndex() != -1)
{
Field<Type> interpVals = vField.internalField();
distMap.distribute(interpVals);
forAll(patchFaceLabels(), elemI)
{
values[elemI] = interpVals[patchFaceLabels()[elemI]];
}
}
return tvalues;
}
template <class Type>
Foam::tmp<Foam::Field<Type> >
Foam::sampledPatchInternalField::interpolateField
(
const interpolation<Type>& interpolator
) const
{
// One value per vertex
if (patchIndex() != -1)
{
// See directMappedFixedValueFvPatchField
const mapDistribute& distMap = map();
const polyPatch& pp = mesh().boundaryMesh()[patchIndex()];
// Send back sample points to processor that holds the cell.
// Mark cells with point::max so we know which ones we need
// to interpolate (since expensive).
vectorField samples(pp.faceCentres());
distMap.reverseDistribute(mesh().nCells(), point::max, samples);
Field<Type> patchVals(mesh().nCells());
forAll(samples, cellI)
{
if (samples[cellI] != point::max)
{
patchVals[cellI] = interpolator.interpolate
(
samples[cellI],
cellI
);
}
}
distMap.distribute(patchVals);
// Now patchVals holds the interpolated data in patch face order.
// Interpolate to points. Note: points are patch.localPoints() so
// can use standard interpolation
return PrimitivePatchInterpolation<primitivePatch>
(
pp
).faceToPointInterpolate(patchVals);
}
else
{
return tmp<Field<Type> >(new Field<Type>(points().size()));
}
}
// ************************************************************************* //

View File

@ -132,15 +132,7 @@ void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
// Retrieve the neighbour patch internal field // Retrieve the neighbour patch internal field
Field<Type> nbrIntFld = nbrField.patchInternalField(); Field<Type> nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute distMap.distribute(nbrIntFld);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Assign (this) patch internal field to its neighbour values // Assign (this) patch internal field to its neighbour values
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField()); Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());

View File

@ -222,27 +222,11 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField(); scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute distMap.distribute(nbrIntFld);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta // Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs(); scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
mapDistribute::distribute distMap.distribute(nbrKDelta);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs(); tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
@ -255,15 +239,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
// Assign to me // Assign to me
fvPatchScalarField::operator=(Twall); fvPatchScalarField::operator=(Twall);
// Distribute back and assign to neighbour // Distribute back and assign to neighbour
mapDistribute::distribute distMap.reverseDistribute(nbrField.size(), Twall);
(
Pstream::defaultCommsType,
distMap.schedule(),
nbrField.size(),
distMap.constructMap(), // reverse : what to send
distMap.subMap(),
Twall
);
const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&> const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&>
( (
nbrField nbrField

View File

@ -179,27 +179,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
scalarField nbrIntFld = nbrField.patchInternalField(); scalarField nbrIntFld = nbrField.patchInternalField();
mapDistribute::distribute distMap.distribute(nbrIntFld);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
// Swap to obtain full local values of neighbour K*delta // Swap to obtain full local values of neighbour K*delta
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs(); scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
mapDistribute::distribute distMap.distribute(nbrKDelta);
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrKDelta
);
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs(); tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();

View File

@ -42,47 +42,34 @@ void Foam::IDDESDelta::calcDelta()
{ {
label nD = mesh().nGeometricD(); label nD = mesh().nGeometricD();
volScalarField delta
(
IOobject
(
"delta",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimLength, SMALL),
calculatedFvPatchScalarField::typeName
);
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
// initialise hwn as wall distance // initialise hwn as wall distance
volScalarField hwn = wallDist(mesh()).y(); volScalarField hwn = wallDist(mesh()).y();
scalar deltamaxTmp = 0.;
const cellList& cells = mesh().cells();
forAll(cells,cellI)
{
scalar deltaminTmp = 1.e10;
const labelList& cFaces = mesh().cells()[cellI];
const point& centrevector = mesh().cellCentres()[cellI];
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
const point& facevector = mesh().faceCentres()[faceI];
scalar tmp = mag(facevector - centrevector);
if (tmp > deltamaxTmp)
{
deltamaxTmp = tmp;
}
if (tmp < deltaminTmp)
{
deltaminTmp = tmp;
}
}
hwn[cellI] = 2.0*deltaminTmp;
}
dimensionedScalar deltamax("deltamax",dimLength,2.0*deltamaxTmp);
if (nD == 3) if (nD == 3)
{ {
delta_.internalField() = delta_.internalField() =
deltaCoeff_ deltaCoeff_
*min *min
( (
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn), max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
deltamax delta
); );
} }
else if (nD == 2) else if (nD == 2)
@ -95,8 +82,8 @@ void Foam::IDDESDelta::calcDelta()
deltaCoeff_ deltaCoeff_
*min *min
( (
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn), max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
deltamax delta
); );
} }
else else

View File

@ -44,9 +44,26 @@ addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
{ {
volScalarField delta
(
IOobject
(
"delta",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimLength, SMALL),
calculatedFvPatchScalarField::typeName
);
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
return max return max
( (
0.25 - y_/dimensionedScalar("hMax", dimLength, max(cmptMax(delta()))), 0.25 - y_/delta,
scalar(-5) scalar(-5)
); );
} }

View File

@ -22,32 +22,33 @@ boundaryField
{ {
inlet inlet
{ {
type directMapped; type directMapped;
value uniform (0 0 0 0 0 0 0 0 0); value uniform (0 0 0 0 0 0 0 0 0);
setAverage false; interpolationScheme cell;
average (0 0 0 0 0 0 0 0 0); setAverage false;
average (0 0 0 0 0 0 0 0 0);
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform (0 0 0 0 0 0 0 0 0); inletValue uniform (0 0 0 0 0 0 0 0 0);
value uniform (0 0 0 0 0 0 0 0 0); value uniform (0 0 0 0 0 0 0 0 0);
} }
upperWall upperWall
{ {
type zeroGradient; type zeroGradient;
} }
lowerWall lowerWall
{ {
type zeroGradient; type zeroGradient;
} }
frontAndBack frontAndBack
{ {
type empty; type empty;
} }
} }

View File

@ -22,34 +22,35 @@ boundaryField
{ {
inlet inlet
{ {
type directMapped; type directMapped;
value uniform (10 0 0); value uniform (10 0 0);
setAverage true; interpolationScheme cell;
average (10 0 0); setAverage true;
average (10 0 0);
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform (0 0 0); inletValue uniform (0 0 0);
value uniform (0 0 0); value uniform (0 0 0);
} }
upperWall upperWall
{ {
type fixedValue; type fixedValue;
value uniform (0 0 0); value uniform (0 0 0);
} }
lowerWall lowerWall
{ {
type fixedValue; type fixedValue;
value uniform (0 0 0); value uniform (0 0 0);
} }
frontAndBack frontAndBack
{ {
type empty; type empty;
} }
} }

View File

@ -22,34 +22,35 @@ boundaryField
{ {
inlet inlet
{ {
type directMapped; type directMapped;
value uniform 2e-05; value uniform 2e-05;
setAverage false; interpolationScheme cell;
average 2e-05; setAverage false;
average 2e-05;
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform 0; inletValue uniform 0;
value uniform 0; value uniform 0;
} }
upperWall upperWall
{ {
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
lowerWall lowerWall
{ {
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
frontAndBack frontAndBack
{ {
type empty; type empty;
} }
} }

View File

@ -22,34 +22,35 @@ boundaryField
{ {
inlet inlet
{ {
type directMapped; type directMapped;
value uniform 0; value uniform 0;
setAverage false; interpolationScheme cell;
average 0; setAverage false;
average 0;
} }
outlet outlet
{ {
type inletOutlet; type inletOutlet;
inletValue uniform 0; inletValue uniform 0;
value uniform 0; value uniform 0;
} }
upperWall upperWall
{ {
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
lowerWall lowerWall
{ {
type fixedValue; type fixedValue;
value uniform 0; value uniform 0;
} }
frontAndBack frontAndBack
{ {
type empty; type empty;
} }
} }

View File

@ -2,7 +2,7 @@
c++WARN = -wd327,654,819,1125,1476,1505,1572 c++WARN = -wd327,654,819,1125,1476,1505,1572
CC = icpc CC = icpc -std=c++0x
include $(RULES)/c++$(WM_COMPILE_OPTION) include $(RULES)/c++$(WM_COMPILE_OPTION)

View File

@ -1,2 +1,2 @@
c++DBUG = c++DBUG =
c++OPT = -xT -O3 -no-prec-div c++OPT = -xSSE3 -O3 -no-prec-div

View File

@ -3,7 +3,7 @@
c++WARN = -wd327,654,819,1125,1476,1505,1572 c++WARN = -wd327,654,819,1125,1476,1505,1572
#CC = icpc -gcc-version=400 #CC = icpc -gcc-version=400
CC = icpc CC = icpc -std=c++0x
include $(RULES)/c++$(WM_COMPILE_OPTION) include $(RULES)/c++$(WM_COMPILE_OPTION)