mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge remote branch 'OpenCFD/master' into olesenm
This commit is contained in:
@ -104,6 +104,8 @@
|
||||
taking film into account
|
||||
+ Parallel aware
|
||||
*** *New* ptscotch decomposition method
|
||||
*** *Updated* decomposePar maps polyPatches instead of recreating them so
|
||||
polyPatches holding data can map the data.
|
||||
*** *Updated* particle tracking algorithm
|
||||
+ uses non-blocking parallel transfers
|
||||
+ does 'minimum-tet' decomposition of face to work with warped faces (snappyHexMesh!)
|
||||
@ -150,7 +152,12 @@
|
||||
OpenFOAM.
|
||||
+ *New* wall functions:
|
||||
+ 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
|
||||
There have been some utilities added and updated in this release.
|
||||
*** *New* utilities
|
||||
@ -172,8 +179,10 @@
|
||||
*** Updated utilities
|
||||
+ =setFields=: optionally use faceSets to set patch values (see e.g. hotRoom tutorial).
|
||||
+ =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.
|
||||
+ =setSet=: allows time range (e.g. 0:100) in combination with -batch argument
|
||||
to execute the commands for multiple times.
|
||||
* Post-processing
|
||||
+ =foamToEnsight=: parallel continuous data. new =-nodeValues= option to generate and output nodal
|
||||
field data.
|
||||
@ -181,6 +190,10 @@
|
||||
mesh. Great for postprocessing.
|
||||
+ =steadyParticleTracks=: Generates VTK tracks from the output of the cloud
|
||||
=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:
|
||||
+ =residualControl=: new function object to allow users to terminate steady
|
||||
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
|
||||
fvSolution during a calculation
|
||||
+ =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
|
||||
There is a large number of new tutorials for existing and new solvers in the
|
||||
|
||||
@ -129,15 +129,7 @@ int main(int argc, char *argv[])
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
|
||||
// Distribute complexData
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
map.constructSize(),
|
||||
map.subMap(),
|
||||
map.constructMap(),
|
||||
complexData
|
||||
);
|
||||
mapDistribute::distribute(complexData);
|
||||
|
||||
Pout<< "complexData:" << complexData << endl;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ Description
|
||||
------ local definitions
|
||||
\* ------------------------------------------------------------------------ */
|
||||
|
||||
#include "cyclicPolyPatch.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
@ -904,6 +905,13 @@ int main(int argc, char *argv[])
|
||||
fluentToFoamType.insert("radiator", 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
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -1038,6 +1046,49 @@ int main(int argc, char *argv[])
|
||||
HashTable<word>::const_iterator iter = fluentToFoamType.find(type);
|
||||
|
||||
if (iter != fluentToFoamType.end())
|
||||
{
|
||||
// See if we have a periodic and can derive the other side.
|
||||
word neighbPatchName;
|
||||
if (iter() == cyclicPolyPatch::typeName)
|
||||
{
|
||||
// Periodic
|
||||
size_t n = name.rfind("-SIDE-1");
|
||||
|
||||
if (n != string::npos)
|
||||
{
|
||||
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
|
||||
(
|
||||
@ -1049,6 +1100,7 @@ int main(int argc, char *argv[])
|
||||
mesh.boundaryMesh()
|
||||
).ptr();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Adding polyPatch for unknown Fluent type " << type
|
||||
|
||||
@ -19,15 +19,17 @@ FoamFile
|
||||
|
||||
numberOfSubdomains 8;
|
||||
|
||||
|
||||
//- Keep owner and neighbour on same processor for faces in zones:
|
||||
// preserveFaceZones (heater solid1 solid3);
|
||||
|
||||
|
||||
//- Keep owner and neighbour on same processor for faces in patches:
|
||||
// (makes sense only for cyclic patches)
|
||||
//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 hierarchical;
|
||||
@ -59,11 +61,8 @@ multiLevelCoeffs
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Desired output
|
||||
|
||||
|
||||
|
||||
simpleCoeffs
|
||||
{
|
||||
n (2 1 1);
|
||||
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "domainDecomposition.H"
|
||||
#include "Time.H"
|
||||
#include "dictionary.H"
|
||||
#include "labelIOList.H"
|
||||
#include "processorPolyPatch.H"
|
||||
|
||||
@ -41,6 +41,9 @@ SourceFiles
|
||||
#include "SLList.H"
|
||||
#include "PtrList.H"
|
||||
#include "point.H"
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
@ -113,9 +113,37 @@ void Foam::domainDecomposition::distributeCells()
|
||||
);
|
||||
|
||||
if (sameProcFaces.empty())
|
||||
{
|
||||
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
|
||||
{
|
||||
Info<< "Selected " << sameProcFaces.size()
|
||||
@ -173,6 +201,42 @@ void Foam::domainDecomposition::distributeCells()
|
||||
|
||||
// Do decomposition on agglomeration
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if (decompositionDict_.found("weightField"))
|
||||
{
|
||||
scalarField regionWeights(globalRegion.nRegions(), 0);
|
||||
|
||||
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,
|
||||
@ -180,6 +244,7 @@ void Foam::domainDecomposition::distributeCells()
|
||||
regionCentres
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nFinished decomposition in "
|
||||
<< decompositionTime.elapsedCpuTime()
|
||||
|
||||
@ -6,6 +6,7 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-ldecompositionMethods \
|
||||
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
|
||||
-lmeshTools \
|
||||
|
||||
@ -86,9 +86,51 @@ autoPtr<fvMesh> createMesh
|
||||
if (!haveMesh)
|
||||
{
|
||||
// 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
|
||||
(
|
||||
io,
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
io.instance(),
|
||||
io.db(),
|
||||
IOobject::NO_READ
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
@ -510,19 +552,22 @@ int main(int argc, char *argv[])
|
||||
"specify the merge distance relative to the bounding box size "
|
||||
"(default 1E-6)"
|
||||
);
|
||||
// Create argList. This will check for non-existing processor dirs.
|
||||
# include "setRootCase.H"
|
||||
|
||||
//- Not useful anymore. See above.
|
||||
//// Create processor directory if non-existing
|
||||
//if (!Pstream::master() && !isDir(args.path()))
|
||||
//{
|
||||
// Pout<< "Creating case directory " << args.path() << endl;
|
||||
// mkDir(args.path());
|
||||
//}
|
||||
// Create processor directory if non-existing
|
||||
if (!Pstream::master() && !isDir(args.path()))
|
||||
{
|
||||
Pout<< "Creating case directory " << args.path() << endl;
|
||||
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"
|
||||
|
||||
|
||||
word regionName = polyMesh::defaultRegion;
|
||||
fileName meshSubDir;
|
||||
|
||||
|
||||
@ -166,6 +166,18 @@ surfaces
|
||||
// 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
|
||||
{
|
||||
// Iso surface for interpolated values only
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -57,8 +57,10 @@ runParallel()
|
||||
then
|
||||
echo "$APP_RUN already run on $PWD: remove log file to run"
|
||||
else
|
||||
echo "Running $APP_RUN in parallel on $PWD using $1 processes"
|
||||
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
|
||||
nProcs=$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
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
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
|
||||
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.
|
||||
It does not need timestamps. There is no need for fileModificationSkew
|
||||
to allow for time differences. (there can still temporarily be a difference
|
||||
|
||||
@ -319,7 +319,7 @@ void Foam::fileMonitor::checkFiles() const
|
||||
|
||||
if (ready < 0)
|
||||
{
|
||||
FatalErrorIn("fileMonitor::updateStates()")
|
||||
FatalErrorIn("fileMonitor::checkFiles()")
|
||||
<< "Problem in issuing select."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
@ -335,7 +335,7 @@ void Foam::fileMonitor::checkFiles() const
|
||||
|
||||
if (nBytes < 0)
|
||||
{
|
||||
FatalErrorIn("fileMonitor::updateStates(const fileName&)")
|
||||
FatalErrorIn("fileMonitor::checkFiles()")
|
||||
<< "read of " << watcher_->inotifyFd_
|
||||
<< " failed with " << label(nBytes)
|
||||
<< abort(FatalError);
|
||||
@ -374,7 +374,7 @@ void Foam::fileMonitor::checkFiles() const
|
||||
)
|
||||
{
|
||||
// Correct directory and name
|
||||
state_[i] = MODIFIED;
|
||||
localState_[i] = MODIFIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -403,18 +403,17 @@ void Foam::fileMonitor::checkFiles() const
|
||||
|
||||
if (newTime == 0)
|
||||
{
|
||||
state_[watchFd] = DELETED;
|
||||
localState_[watchFd] = DELETED;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (newTime > (oldTime + regIOobject::fileModificationSkew))
|
||||
{
|
||||
watcher_->lastMod_[watchFd] = newTime;
|
||||
state_[watchFd] = MODIFIED;
|
||||
localState_[watchFd] = MODIFIED;
|
||||
}
|
||||
else
|
||||
{
|
||||
state_[watchFd] = UNMODIFIED;
|
||||
localState_[watchFd] = UNMODIFIED;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,12 +421,14 @@ void Foam::fileMonitor::checkFiles() const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Foam::fileMonitor::fileMonitor(const bool useInotify)
|
||||
:
|
||||
useInotify_(useInotify),
|
||||
localState_(20),
|
||||
state_(20),
|
||||
watchFile_(20),
|
||||
freeWatchFds_(2),
|
||||
@ -476,6 +477,7 @@ Foam::label Foam::fileMonitor::addWatch(const fileName& fName)
|
||||
}
|
||||
else
|
||||
{
|
||||
localState_(watchFd) = UNMODIFIED;
|
||||
state_(watchFd) = UNMODIFIED;
|
||||
watchFile_(watchFd) = fName;
|
||||
}
|
||||
@ -517,30 +519,26 @@ void Foam::fileMonitor::updateStates
|
||||
{
|
||||
if (Pstream::master() || !masterOnly)
|
||||
{
|
||||
// Update the localState_
|
||||
checkFiles();
|
||||
}
|
||||
|
||||
if (syncPar)
|
||||
{
|
||||
// Pack current state (might be on master only)
|
||||
// Pack local state (might be on master only)
|
||||
PackedList<2> stats(state_.size(), MODIFIED);
|
||||
if (Pstream::master() || !masterOnly)
|
||||
{
|
||||
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
|
||||
if (masterOnly)
|
||||
{
|
||||
@ -573,36 +571,41 @@ void Foam::fileMonitor::updateStates
|
||||
}
|
||||
|
||||
|
||||
// Update local state
|
||||
// Update synchronised state
|
||||
forAll(state_, watchFd)
|
||||
{
|
||||
if (masterOnly)
|
||||
{
|
||||
// No need to check for inconsistent state. Just assign.
|
||||
// Assign synchronised state
|
||||
unsigned int stat = stats[watchFd];
|
||||
state_[watchFd] = fileState(stat);
|
||||
}
|
||||
else
|
||||
|
||||
if (!masterOnly)
|
||||
{
|
||||
// Check for inconsistent state before assigning.
|
||||
if (thisProcStats[watchFd] != UNMODIFIED)
|
||||
// Give warning for inconsistent state
|
||||
if (state_[watchFd] != localState_[watchFd])
|
||||
{
|
||||
if (stats[watchFd] == UNMODIFIED)
|
||||
if (debug)
|
||||
{
|
||||
WarningIn("fileMonitor::updateStates(const bool) const")
|
||||
<< "Delaying reading " << watchFile_[watchFd]
|
||||
Pout<< "fileMonitor : Delaying reading "
|
||||
<< watchFile_[watchFd]
|
||||
<< " due to inconsistent "
|
||||
"file time-stamps between processors"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"fileMonitor::updateStates"
|
||||
"(const bool, const bool) const"
|
||||
) << "Delaying reading " << watchFile_[watchFd]
|
||||
<< " due to inconsistent "
|
||||
"file time-stamps between processors" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned int stat = stats[watchFd];
|
||||
state_[watchFd] = fileState(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
state_ = localState_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -610,6 +613,7 @@ void Foam::fileMonitor::updateStates
|
||||
void Foam::fileMonitor::setUnmodified(const label watchFd)
|
||||
{
|
||||
state_[watchFd] = UNMODIFIED;
|
||||
localState_[watchFd] = UNMODIFIED;
|
||||
|
||||
if (!useInotify_)
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
{
|
||||
UNMODIFIED = 0,
|
||||
MODIFIED = 1,
|
||||
DELETED = 2,
|
||||
DELETED = 2
|
||||
};
|
||||
|
||||
static const NamedEnum<fileState, 3> fileStateNames_;
|
||||
@ -82,7 +82,10 @@ private:
|
||||
//- Whether to use inotify (requires -DFOAM_USE_INOTIFY, see above)
|
||||
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_;
|
||||
|
||||
//- Filename for all watchFds
|
||||
@ -97,7 +100,7 @@ private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Update state_ from any events.
|
||||
//- Update localState_ from any events.
|
||||
void checkFiles() const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
|
||||
@ -537,7 +537,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
{
|
||||
transform
|
||||
(
|
||||
procPatch.reverseT(),
|
||||
procPatch.forwardT(),
|
||||
receiveFaces.size(),
|
||||
receiveFacesInfo
|
||||
);
|
||||
|
||||
@ -55,46 +55,59 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
|
||||
close();
|
||||
}
|
||||
|
||||
if (masterOnly)
|
||||
if (masterOnly && Pstream::parRun())
|
||||
{
|
||||
// Scatter master data
|
||||
if (Pstream::master())
|
||||
{
|
||||
for
|
||||
// Scatter master data using communication scheme
|
||||
|
||||
const List<Pstream::commsStruct>& comms =
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
{
|
||||
// Note: use ASCII for now - binary IO of dictionaries is
|
||||
// not currently supported
|
||||
OPstream toSlave
|
||||
(
|
||||
Pstream::scheduled,
|
||||
slave,
|
||||
0,
|
||||
UPstream::msgType(),
|
||||
IOstream::ASCII
|
||||
(Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
? Pstream::linearCommunication()
|
||||
: Pstream::treeCommunication()
|
||||
);
|
||||
IOdictionary::writeData(toSlave);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
// Get my communication order
|
||||
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
||||
|
||||
// Reveive from up
|
||||
if (myComm.above() != -1)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
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::masterNo(),
|
||||
myComm.above(),
|
||||
0,
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,6 @@ Foam::regIOobject::fileCheckTypes Foam::regIOobject::fileModificationChecking
|
||||
debug::optimisationSwitches().lookup
|
||||
(
|
||||
"fileModificationChecking"
|
||||
//Foam::regIOobject::timeStamp
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -177,55 +177,69 @@ bool Foam::regIOobject::read()
|
||||
regIOobject::fileModificationChecking == timeStampMaster
|
||||
|| regIOobject::fileModificationChecking == inotifyMaster;
|
||||
|
||||
bool ok;
|
||||
bool ok = true;
|
||||
if (Pstream::master() || !masterOnly)
|
||||
{
|
||||
ok = readData(readStream(type()));
|
||||
close();
|
||||
}
|
||||
|
||||
if (masterOnly)
|
||||
{
|
||||
// Scatter master data
|
||||
if (Pstream::master())
|
||||
{
|
||||
for
|
||||
(
|
||||
int slave=Pstream::firstSlave();
|
||||
slave<=Pstream::lastSlave();
|
||||
slave++
|
||||
)
|
||||
{
|
||||
// Note: use ASCII for now - binary IO of dictionaries is
|
||||
// not currently supported
|
||||
OPstream toSlave
|
||||
(
|
||||
Pstream::scheduled,
|
||||
slave,
|
||||
0,
|
||||
UPstream::msgType(),
|
||||
IOstream::ASCII
|
||||
);
|
||||
writeData(toSlave);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IFstream::debug)
|
||||
{
|
||||
Pout<< "regIOobject::read() : "
|
||||
<< "reading object " << name()
|
||||
<< " from master processor " << Pstream::masterNo()
|
||||
<< " from file " << endl;
|
||||
}
|
||||
ok = readData(readStream(type()));
|
||||
close();
|
||||
}
|
||||
|
||||
if (masterOnly && Pstream::parRun())
|
||||
{
|
||||
// Scatter master data using communication scheme
|
||||
|
||||
const List<Pstream::commsStruct>& comms =
|
||||
(
|
||||
(Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||
? Pstream::linearCommunication()
|
||||
: Pstream::treeCommunication()
|
||||
);
|
||||
|
||||
|
||||
// Get my communication order
|
||||
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
||||
|
||||
// Reveive from up
|
||||
if (myComm.above() != -1)
|
||||
{
|
||||
if (IFstream::debug)
|
||||
{
|
||||
Pout<< "regIOobject::read() : "
|
||||
<< "reading object " << name()
|
||||
<< " 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::masterNo(),
|
||||
myComm.above(),
|
||||
0,
|
||||
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;
|
||||
|
||||
@ -31,6 +31,7 @@ License
|
||||
#include "IOobject.H"
|
||||
#include "JobInfo.H"
|
||||
#include "labelList.H"
|
||||
#include "regIOobject.H"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@ -767,6 +768,16 @@ Foam::argList::argList
|
||||
sigQuit_.set(bannerEnabled);
|
||||
sigSegv_.set(bannerEnabled);
|
||||
|
||||
if (bannerEnabled)
|
||||
{
|
||||
Info<< "Monitoring run-time modified files using "
|
||||
<< regIOobject::fileCheckTypesNames
|
||||
[
|
||||
regIOobject::fileModificationChecking
|
||||
]
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (Pstream::master() && bannerEnabled)
|
||||
{
|
||||
Info<< endl;
|
||||
|
||||
@ -41,16 +41,20 @@ Foam::cyclicLduInterfaceField::~cyclicLduInterfaceField()
|
||||
|
||||
void Foam::cyclicLduInterfaceField::transformCoupleField
|
||||
(
|
||||
scalarField& pnf,
|
||||
scalarField& f,
|
||||
const direction cmpt
|
||||
) const
|
||||
{
|
||||
if (doTransform())
|
||||
{
|
||||
scalar forwardScale =
|
||||
pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||
|
||||
pnf *= forwardScale;
|
||||
if (forwardT().size() == 1)
|
||||
{
|
||||
f *= pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||
}
|
||||
else
|
||||
{
|
||||
f *= pow(diag(forwardT())().component(cmpt), rank());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,9 +43,39 @@ static const Foam::List<Foam::word> subDictNames
|
||||
);
|
||||
//! @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 * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||
Foam::solution::solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
@ -64,7 +94,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
||||
defaultRelaxationFactor_(0),
|
||||
solvers_(ITstream("solvers", tokenList())())
|
||||
{
|
||||
read();
|
||||
read(solutionDict());
|
||||
}
|
||||
|
||||
|
||||
@ -250,26 +280,7 @@ bool Foam::solution::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
const dictionary& dict = 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_);
|
||||
}
|
||||
read(solutionDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -70,6 +70,9 @@ class solution
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Read settings from the dictionary
|
||||
void read(const dictionary&);
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
solution(const solution&);
|
||||
void operator=(const solution&);
|
||||
@ -89,7 +92,11 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary
|
||||
solution(const objectRegistry& obr, const fileName& dictName);
|
||||
solution
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const fileName& dictName
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -1220,7 +1220,17 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
|
||||
// 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
|
||||
(
|
||||
mergeSeparated,
|
||||
@ -1251,7 +1261,14 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
|
||||
do
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::defaultCommsType);
|
||||
PstreamBuffers pBufs
|
||||
(
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::scheduled
|
||||
? Pstream::nonBlocking
|
||||
: Pstream::defaultCommsType
|
||||
)
|
||||
);
|
||||
sendPatchPoints
|
||||
(
|
||||
mergeSeparated,
|
||||
@ -1400,7 +1417,15 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
Pout<< "Determined " << changedIndices.size() << " shared points."
|
||||
<< " Exchanging them" << endl;
|
||||
}
|
||||
PstreamBuffers pBufs(Pstream::defaultCommsType);
|
||||
PstreamBuffers pBufs
|
||||
(
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::scheduled
|
||||
? Pstream::nonBlocking
|
||||
: Pstream::defaultCommsType
|
||||
)
|
||||
);
|
||||
|
||||
sendSharedPoints(mergeSeparated, pBufs, changedIndices);
|
||||
pBufs.finishedSends();
|
||||
receiveSharedPoints
|
||||
|
||||
@ -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 Ostream& operator<<(Ostream&, const objectMap&);
|
||||
inline Istream& operator>>(Istream&, objectMap&);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -100,6 +101,8 @@ public:
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream&, const objectMap&);
|
||||
|
||||
friend Istream& operator>>(Istream&, objectMap&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -194,6 +194,10 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
vectorField half0Normals(half0Areas.size());
|
||||
vectorField half1Normals(half1Areas.size());
|
||||
|
||||
//- Additional warning about faces non-aligned with rotation axis
|
||||
//scalar maxCos = -GREAT;
|
||||
//label maxFacei = -1;
|
||||
|
||||
forAll(half0, facei)
|
||||
{
|
||||
scalar magSf = mag(half0Areas[facei]);
|
||||
@ -233,9 +237,33 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
{
|
||||
half0Normals[facei] = half0Areas[facei] / magSf;
|
||||
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
|
||||
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
|
||||
(
|
||||
const word& name,
|
||||
|
||||
@ -213,6 +213,21 @@ public:
|
||||
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
|
||||
cyclicPolyPatch
|
||||
(
|
||||
|
||||
@ -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
|
||||
(
|
||||
List<int>& adjncy,
|
||||
List<int>& xadj,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
List<int>& finalDecomp
|
||||
)
|
||||
) const
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
||||
@ -142,6 +142,7 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit
|
||||
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
|
||||
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
||||
|
||||
@ -272,15 +272,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
newValues = sampleField();
|
||||
}
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
newValues
|
||||
);
|
||||
distMap.distribute(newValues);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -305,15 +297,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
const fieldType& nbrField = sampleField();
|
||||
|
||||
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
newValues
|
||||
);
|
||||
distMap.distribute(newValues);
|
||||
|
||||
break;
|
||||
}
|
||||
@ -335,16 +319,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
}
|
||||
}
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allValues
|
||||
);
|
||||
|
||||
distMap.distribute(allValues);
|
||||
newValues.transfer(allValues);
|
||||
|
||||
break;
|
||||
|
||||
@ -212,26 +212,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
||||
}
|
||||
}
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allUValues
|
||||
);
|
||||
distMap.distribute(allUValues);
|
||||
newUValues.transfer(allUValues);
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
allPhiValues
|
||||
);
|
||||
distMap.distribute(allPhiValues);
|
||||
newPhiValues.transfer(allPhiValues);
|
||||
|
||||
break;
|
||||
@ -244,28 +228,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
||||
);
|
||||
|
||||
newUValues = UField.boundaryField()[nbrPatchID];
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
newUValues
|
||||
);
|
||||
distMap.distribute(newUValues);
|
||||
|
||||
newPhiValues = phiField.boundaryField()[nbrPatchID];
|
||||
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
distMap.constructMap(),
|
||||
newPhiValues
|
||||
);
|
||||
distMap.distribute(newPhiValues);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,9 +28,9 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fvSchemes::clear()
|
||||
@ -53,137 +53,9 @@ void Foam::fvSchemes::clear()
|
||||
defaultFluxRequired_ = false;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"fvSchemes",
|
||||
obr.time().system(),
|
||||
obr,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
ddtSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::ddtSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDdtScheme_
|
||||
(
|
||||
ddtSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
d2dt2Schemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::d2dt2Schemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultD2dt2Scheme_
|
||||
(
|
||||
d2dt2Schemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
interpolationSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::interpolationSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultInterpolationScheme_
|
||||
(
|
||||
interpolationSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
divSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::divSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDivScheme_
|
||||
(
|
||||
divSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
gradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::gradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultGradScheme_
|
||||
(
|
||||
gradSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
snGradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::snGradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultSnGradScheme_
|
||||
(
|
||||
snGradSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
laplacianSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::laplacianSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultLaplacianScheme_
|
||||
(
|
||||
laplacianSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
fluxRequired_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::fluxRequired",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultFluxRequired_(false)
|
||||
void Foam::fvSchemes::read(const dictionary& dict)
|
||||
{
|
||||
read();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fvSchemes::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
const dictionary& dict = schemesDict();
|
||||
|
||||
// persistent settings across reads is incorrect
|
||||
clear();
|
||||
|
||||
if (dict.found("ddtSchemes"))
|
||||
{
|
||||
ddtSchemes_ = dict.subDict("ddtSchemes");
|
||||
@ -370,6 +242,142 @@ bool Foam::fvSchemes::read()
|
||||
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"fvSchemes",
|
||||
obr.time().system(),
|
||||
obr,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
ddtSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::ddtSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDdtScheme_
|
||||
(
|
||||
ddtSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
d2dt2Schemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::d2dt2Schemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultD2dt2Scheme_
|
||||
(
|
||||
d2dt2Schemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
interpolationSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::interpolationSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultInterpolationScheme_
|
||||
(
|
||||
interpolationSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
divSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::divSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultDivScheme_
|
||||
(
|
||||
divSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
gradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::gradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultGradScheme_
|
||||
(
|
||||
gradSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
snGradSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::snGradSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultSnGradScheme_
|
||||
(
|
||||
snGradSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
laplacianSchemes_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::laplacianSchemes",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultLaplacianScheme_
|
||||
(
|
||||
laplacianSchemes_.name() + "::default",
|
||||
tokenList()
|
||||
),
|
||||
fluxRequired_
|
||||
(
|
||||
ITstream
|
||||
(
|
||||
objectPath() + "::fluxRequired",
|
||||
tokenList()
|
||||
)()
|
||||
),
|
||||
defaultFluxRequired_(false)
|
||||
{
|
||||
// persistent settings across reads is incorrect
|
||||
clear();
|
||||
|
||||
read(schemesDict());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::fvSchemes::read()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
// persistent settings across reads is incorrect
|
||||
clear();
|
||||
|
||||
read(schemesDict());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -84,6 +84,9 @@ class fvSchemes
|
||||
//- Clear the dictionaries and streams before reading
|
||||
void clear();
|
||||
|
||||
//- Read settings from the dictionary
|
||||
void read(const dictionary&);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
fvSchemes(const fvSchemes&);
|
||||
|
||||
|
||||
@ -62,38 +62,30 @@ void Foam::Particle<ParticleType>::correctAfterParallelTransfer
|
||||
|
||||
if (!ppp.parallel())
|
||||
{
|
||||
if (ppp.forwardT().size() == 1)
|
||||
{
|
||||
const tensor& T = ppp.forwardT()[0];
|
||||
const tensor& T =
|
||||
(
|
||||
ppp.forwardT().size() == 1
|
||||
? ppp.forwardT()[0]
|
||||
: ppp.forwardT()[faceI_]
|
||||
);
|
||||
|
||||
transformPosition(T);
|
||||
static_cast<ParticleType&>(*this).transformProperties(T);
|
||||
}
|
||||
else
|
||||
{
|
||||
const tensor& T = ppp.forwardT()[faceI_];
|
||||
transformPosition(T);
|
||||
static_cast<ParticleType&>(*this).transformProperties(T);
|
||||
}
|
||||
}
|
||||
else if (ppp.separated())
|
||||
{
|
||||
if (ppp.separation().size() == 1)
|
||||
{
|
||||
position_ -= ppp.separation()[0];
|
||||
const vector& s =
|
||||
(
|
||||
(ppp.separation().size() == 1)
|
||||
? ppp.separation()[0]
|
||||
: ppp.separation()[faceI_]
|
||||
);
|
||||
position_ -= s;
|
||||
static_cast<ParticleType&>(*this).transformProperties
|
||||
(
|
||||
-ppp.separation()[0]
|
||||
-s
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
position_ -= ppp.separation()[faceI_];
|
||||
static_cast<ParticleType&>(*this).transformProperties
|
||||
(
|
||||
-ppp.separation()[faceI_]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
tetFaceI_ = faceI_ + ppp.start();
|
||||
|
||||
@ -815,21 +807,34 @@ void Foam::Particle<ParticleType>::hitCyclicPatch
|
||||
// See note in correctAfterParallelTransfer for tetPtI_ addressing.
|
||||
tetPtI_ = cloud_.polyMesh_.faces()[tetFaceI_].size() - 1 - tetPtI_;
|
||||
|
||||
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
|
||||
|
||||
// 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);
|
||||
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
|
||||
(
|
||||
cpp.separation()[0]
|
||||
-s
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,7 +504,22 @@ Foam::polyMesh* Foam::blockMesh::createTopology
|
||||
dictionary& dict = patchDicts[patchI];
|
||||
|
||||
// Add but not override type
|
||||
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
|
||||
if (nbrPatchNames[patchI] != word::null)
|
||||
|
||||
@ -473,7 +473,7 @@ void Foam::PointEdgeWave<Type>::handleProcPatches()
|
||||
// Apply transform to received data for non-parallel planes
|
||||
if (!procPatch.parallel())
|
||||
{
|
||||
transform(procPatch.reverseT(), patchInfo);
|
||||
transform(procPatch.forwardT(), patchInfo);
|
||||
}
|
||||
|
||||
updateFromPatchInfo
|
||||
|
||||
@ -527,13 +527,14 @@ void Foam::directMappedPatchBase::calcMapping() const
|
||||
constructMap[procI]
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "To proc:" << procI << " sending values of cells/faces:"
|
||||
<< subMap[procI] << endl;
|
||||
Pout<< "From proc:" << procI << " receiving values of patch faces:"
|
||||
<< constructMap[procI] << endl;
|
||||
}
|
||||
//if (debug)
|
||||
//{
|
||||
// Pout<< "To proc:" << procI << " sending values of cells/faces:"
|
||||
// << subMap[procI] << endl;
|
||||
// Pout<< "From proc:" << procI
|
||||
// << " receiving values of patch faces:"
|
||||
// << constructMap[procI] << endl;
|
||||
//}
|
||||
}
|
||||
|
||||
// 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
|
||||
(
|
||||
const polyPatch& pp,
|
||||
|
||||
@ -206,15 +206,15 @@ public:
|
||||
const vector& offset
|
||||
);
|
||||
|
||||
////- Construct from normal and distance
|
||||
//directMappedPatchBase
|
||||
//(
|
||||
// const polyPatch& pp,
|
||||
// const word& sampleRegion,
|
||||
// const word& samplePatch,
|
||||
// const sampleMode sampleMode,
|
||||
// const vector& offset
|
||||
//);
|
||||
//- Construct from offsetMode=normal and distance
|
||||
directMappedPatchBase
|
||||
(
|
||||
const polyPatch& pp,
|
||||
const word& sampleRegion,
|
||||
const sampleMode sampleMode,
|
||||
const word& samplePatch,
|
||||
const scalar distance
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
directMappedPatchBase(const polyPatch&, const dictionary&);
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "cellSet.H"
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
#include "fieldDictionary.H"
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -207,7 +208,7 @@ void Foam::fieldToCell::applyToSet
|
||||
IFstream str(fieldObject.filePath());
|
||||
|
||||
// Read dictionary
|
||||
dictionary fieldDict(str);
|
||||
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
|
||||
|
||||
scalarField internalVals("internalField", fieldDict, mesh().nCells());
|
||||
|
||||
@ -218,7 +219,7 @@ void Foam::fieldToCell::applyToSet
|
||||
IFstream str(fieldObject.filePath());
|
||||
|
||||
// Read dictionary
|
||||
dictionary fieldDict(str);
|
||||
fieldDictionary fieldDict(fieldObject, fieldObject.headerClassName());
|
||||
|
||||
vectorField internalVals("internalField", fieldDict, mesh().nCells());
|
||||
|
||||
|
||||
@ -108,6 +108,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "Time.H"
|
||||
#include "OFstream.H"
|
||||
#include "globalIndex.H"
|
||||
|
||||
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.
|
||||
Foam::label Foam::ptscotchDecomp::decompose
|
||||
(
|
||||
List<int>& adjncy,
|
||||
List<int>& xadj,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
|
||||
List<int>& finalDecomp
|
||||
)
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "ptscotchDecomp : entering with xadj:" << xadj.size() << endl;
|
||||
}
|
||||
|
||||
// // Dump graph
|
||||
// if (decompositionDict_.found("ptscotchCoeffs"))
|
||||
// {
|
||||
@ -262,8 +451,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"ptscotchDecomp::decompose"
|
||||
"(const pointField&, const scalarField&)"
|
||||
"ptscotchDecomp::decompose(..)"
|
||||
) << "Illegal minimum weight " << minWeights
|
||||
<< endl;
|
||||
}
|
||||
@ -272,8 +460,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"ptscotchDecomp::decompose"
|
||||
"(const pointField&, const scalarField&)"
|
||||
"ptscotchDecomp::decompose(..)"
|
||||
) << "Number of cell weights " << cWeights.size()
|
||||
<< " does not equal number of cells " << xadj.size()-1
|
||||
<< exit(FatalError);
|
||||
@ -289,8 +476,25 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_dgraphInit" << endl;
|
||||
}
|
||||
SCOTCH_Dgraph grafdat;
|
||||
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
|
||||
(
|
||||
SCOTCH_dgraphBuild
|
||||
@ -302,19 +506,25 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
const_cast<SCOTCH_Num*>(xadj.begin()),
|
||||
// vertloctab, start index per cell into
|
||||
// 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
|
||||
|
||||
adjncy.size(), // edgelocnbr, number of arcs
|
||||
adjncy.size(), // edgelocsiz
|
||||
adjncy.begin(), // edgeloctab
|
||||
const_cast<SCOTCH_Num*>(adjncy.begin()), // edgeloctab
|
||||
NULL, // edgegsttab
|
||||
NULL // edlotab, edge weights
|
||||
),
|
||||
"SCOTCH_dgraphBuild"
|
||||
);
|
||||
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_dgraphCheck" << endl;
|
||||
}
|
||||
check(SCOTCH_dgraphCheck(&grafdat), "SCOTCH_dgraphCheck");
|
||||
|
||||
|
||||
@ -322,6 +532,10 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
// ~~~~~~~~~~~~
|
||||
// (fully connected network topology since using switch)
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_archInit" << endl;
|
||||
}
|
||||
SCOTCH_Arch archdat;
|
||||
check(SCOTCH_archInit(&archdat), "SCOTCH_archInit");
|
||||
|
||||
@ -349,6 +563,10 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
}
|
||||
else
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_archCmplt" << endl;
|
||||
}
|
||||
check
|
||||
(
|
||||
SCOTCH_archCmplt(&archdat, nProcessors_),
|
||||
@ -373,6 +591,10 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
);
|
||||
# endif
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_dgraphMap" << endl;
|
||||
}
|
||||
finalDecomp.setSize(xadj.size()-1);
|
||||
finalDecomp = 0;
|
||||
check
|
||||
@ -406,6 +628,10 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
// "SCOTCH_graphPart"
|
||||
//);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "SCOTCH_dgraphExit" << endl;
|
||||
}
|
||||
// Release storage for graph
|
||||
SCOTCH_dgraphExit(&grafdat);
|
||||
// Release storage for strategy
|
||||
@ -465,7 +691,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
|
||||
// Decompose using default weights
|
||||
List<int> finalDecomp;
|
||||
decompose(cellCells.m(), cellCells.offsets(), pointWeights, finalDecomp);
|
||||
decomposeZeroDomains
|
||||
(
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
pointWeights,
|
||||
finalDecomp
|
||||
);
|
||||
|
||||
// Copy back to labelList
|
||||
labelList decomp(finalDecomp.size());
|
||||
@ -510,7 +742,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
|
||||
// Decompose using weights
|
||||
List<int> finalDecomp;
|
||||
decompose(cellCells.m(), cellCells.offsets(), pointWeights, finalDecomp);
|
||||
decomposeZeroDomains
|
||||
(
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
pointWeights,
|
||||
finalDecomp
|
||||
);
|
||||
|
||||
// Rework back into decomposition for original mesh
|
||||
labelList fineDistribution(agglom.size());
|
||||
@ -557,7 +795,13 @@ Foam::labelList Foam::ptscotchDecomp::decompose
|
||||
|
||||
// Decompose using weights
|
||||
List<int> finalDecomp;
|
||||
decompose(cellCells.m(), cellCells.offsets(), cWeights, finalDecomp);
|
||||
decomposeZeroDomains
|
||||
(
|
||||
cellCells.m(),
|
||||
cellCells.offsets(),
|
||||
cWeights,
|
||||
finalDecomp
|
||||
);
|
||||
|
||||
// Copy back to labelList
|
||||
labelList decomp(finalDecomp.size());
|
||||
|
||||
@ -50,16 +50,33 @@ class ptscotchDecomp
|
||||
{
|
||||
// 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
|
||||
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
|
||||
(
|
||||
List<int>& adjncy,
|
||||
List<int>& xadj,
|
||||
const List<int>& adjncy,
|
||||
const List<int>& xadj,
|
||||
const scalarField& cWeights,
|
||||
List<int>& finalDecomp
|
||||
);
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct and assignment
|
||||
void operator=(const ptscotchDecomp&);
|
||||
@ -135,6 +152,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ptscotchDecompTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -440,15 +440,7 @@ void Foam::distributedTriSurfaceMesh::findLine
|
||||
// Exchange the segments
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
Pstream::nonBlocking, //Pstream::scheduled,
|
||||
List<labelPair>(0), //map.schedule(),
|
||||
map.constructSize(),
|
||||
map.subMap(), // what to send
|
||||
map.constructMap(), // what to receive
|
||||
allSegments
|
||||
);
|
||||
map.distribute(allSegments);
|
||||
|
||||
|
||||
// Do tests I need to do
|
||||
@ -490,21 +482,7 @@ void Foam::distributedTriSurfaceMesh::findLine
|
||||
// Exchange the intersections (opposite to segments)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//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
|
||||
);
|
||||
map.reverseDistribute(nOldAllSegments, intersections);
|
||||
|
||||
|
||||
// Extract the hits
|
||||
@ -657,17 +635,7 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
||||
// Send over queries
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//Pstream::scheduled,
|
||||
//map.schedule(),
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(0),
|
||||
map.constructSize(),
|
||||
map.subMap(), // what to send
|
||||
map.constructMap(), // what to receive
|
||||
triangleIndex
|
||||
);
|
||||
map.distribute(triangleIndex);
|
||||
|
||||
|
||||
return mapPtr;
|
||||
@ -1589,28 +1557,8 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
||||
// swap samples to local processor
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//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
|
||||
);
|
||||
map.distribute(allCentres);
|
||||
map.distribute(allRadiusSqr);
|
||||
|
||||
|
||||
// Do my tests
|
||||
@ -1634,21 +1582,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
||||
// Send back results
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//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
|
||||
);
|
||||
map.reverseDistribute(allSegmentMap.size(), allInfo);
|
||||
|
||||
|
||||
// Extract information
|
||||
@ -1887,21 +1821,7 @@ void Foam::distributedTriSurfaceMesh::getRegion
|
||||
// Send back results
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//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
|
||||
);
|
||||
map.reverseDistribute(info.size(), region);
|
||||
}
|
||||
|
||||
|
||||
@ -1951,21 +1871,7 @@ void Foam::distributedTriSurfaceMesh::getNormal
|
||||
// Send back results
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
//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
|
||||
);
|
||||
map.reverseDistribute(info.size(), normal);
|
||||
}
|
||||
|
||||
|
||||
@ -2019,15 +1925,7 @@ void Foam::distributedTriSurfaceMesh::getField
|
||||
// Send back results
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
|
||||
map.distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(0),
|
||||
info.size(),
|
||||
map.constructMap(), // what to send
|
||||
map.subMap(), // what to receive
|
||||
values
|
||||
);
|
||||
map.reverseDistribute(info.size(), values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,15 +76,7 @@ License
|
||||
// // Send back results
|
||||
// // ~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// map.distribute
|
||||
// (
|
||||
// Pstream::nonBlocking,
|
||||
// List<labelPair>(0),
|
||||
// info.size(),
|
||||
// map.constructMap(), // what to send
|
||||
// map.subMap(), // what to receive
|
||||
// values
|
||||
// );
|
||||
// map.reverseDistribute(info.size(), values);
|
||||
//}
|
||||
|
||||
|
||||
@ -115,15 +107,7 @@ void Foam::distributedTriSurfaceMesh::distributeFields
|
||||
|
||||
label oldSize = field.size();
|
||||
|
||||
map.distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(0),
|
||||
map.constructSize(),
|
||||
map.subMap(),
|
||||
map.constructMap(),
|
||||
field
|
||||
);
|
||||
map.distribute(field);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C
|
||||
fieldValues/cellSource/cellSource.C
|
||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
||||
|
||||
nearWallFields/nearWallFields.C
|
||||
nearWallFields/nearWallFieldsFunctionObject.C
|
||||
|
||||
readFields/readFields.C
|
||||
readFields/readFieldsFunctionObject.C
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
(
|
||||
Pstream::scheduled,
|
||||
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "surfaceInterpolateFields.H"
|
||||
//#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -89,8 +88,8 @@ void Foam::surfaceInterpolateFields::read(const dictionary& dict)
|
||||
|
||||
void Foam::surfaceInterpolateFields::execute()
|
||||
{
|
||||
//Info<< type() << " " << name_ << ":" << nl;
|
||||
|
||||
if (active_)
|
||||
{
|
||||
// Clear out any previously loaded fields
|
||||
ssf_.clear();
|
||||
svf_.clear();
|
||||
@ -104,6 +103,7 @@ void Foam::surfaceInterpolateFields::execute()
|
||||
interpolateFields<symmTensor>(sSymmtf_);
|
||||
interpolateFields<tensor>(stf_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::surfaceInterpolateFields::end()
|
||||
@ -114,7 +114,32 @@ void Foam::surfaceInterpolateFields::end()
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,9 +27,24 @@ Class
|
||||
Description
|
||||
Linear interpolates volFields to surfaceFields
|
||||
|
||||
Note: gets executed every time step. Could move it to write() but then
|
||||
you'd have problems if you have different write frequencies for different
|
||||
function objects.
|
||||
- at write it writes the fields
|
||||
- it executes every time step
|
||||
|
||||
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
|
||||
surfaceInterpolateFields.C
|
||||
|
||||
@ -27,6 +27,7 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
||||
cuttingPlane/cuttingPlane.C
|
||||
|
||||
sampledSurface/sampledPatch/sampledPatch.C
|
||||
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
|
||||
sampledSurface/sampledPlane/sampledPlane.C
|
||||
sampledSurface/isoSurface/isoSurface.C
|
||||
sampledSurface/isoSurface/sampledIsoSurface.C
|
||||
|
||||
@ -157,6 +157,10 @@ void Foam::sampledPatch::remapFaces
|
||||
if (&faceMap && faceMap.size())
|
||||
{
|
||||
MeshStorage::remapFaces(faceMap);
|
||||
patchFaceLabels_ = labelList
|
||||
(
|
||||
UIndirectList<label>(patchFaceLabels_, faceMap)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -132,15 +132,7 @@ void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
// Retrieve the neighbour patch internal field
|
||||
Field<Type> nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
distMap.distribute(nbrIntFld);
|
||||
|
||||
// Assign (this) patch internal field to its neighbour values
|
||||
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
|
||||
|
||||
@ -222,27 +222,11 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
distMap.distribute(nbrIntFld);
|
||||
|
||||
// Swap to obtain full local values of neighbour K*delta
|
||||
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrKDelta
|
||||
);
|
||||
distMap.distribute(nbrKDelta);
|
||||
|
||||
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
||||
|
||||
@ -255,15 +239,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
||||
// Assign to me
|
||||
fvPatchScalarField::operator=(Twall);
|
||||
// Distribute back and assign to neighbour
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
nbrField.size(),
|
||||
distMap.constructMap(), // reverse : what to send
|
||||
distMap.subMap(),
|
||||
Twall
|
||||
);
|
||||
distMap.reverseDistribute(nbrField.size(), Twall);
|
||||
const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&>
|
||||
(
|
||||
nbrField
|
||||
|
||||
@ -179,27 +179,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrIntFld
|
||||
);
|
||||
distMap.distribute(nbrIntFld);
|
||||
|
||||
// Swap to obtain full local values of neighbour K*delta
|
||||
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(), // what to send
|
||||
distMap.constructMap(), // what to receive
|
||||
nbrKDelta
|
||||
);
|
||||
distMap.distribute(nbrKDelta);
|
||||
|
||||
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
||||
|
||||
|
||||
@ -42,47 +42,34 @@ void Foam::IDDESDelta::calcDelta()
|
||||
{
|
||||
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
|
||||
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)
|
||||
{
|
||||
delta_.internalField() =
|
||||
deltaCoeff_
|
||||
*min
|
||||
(
|
||||
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn),
|
||||
deltamax
|
||||
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
||||
delta
|
||||
);
|
||||
}
|
||||
else if (nD == 2)
|
||||
@ -95,8 +82,8 @@ void Foam::IDDESDelta::calcDelta()
|
||||
deltaCoeff_
|
||||
*min
|
||||
(
|
||||
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn),
|
||||
deltamax
|
||||
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
||||
delta
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -44,9 +44,26 @@ addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
|
||||
|
||||
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
|
||||
(
|
||||
0.25 - y_/dimensionedScalar("hMax", dimLength, max(cmptMax(delta()))),
|
||||
0.25 - y_/delta,
|
||||
scalar(-5)
|
||||
);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ boundaryField
|
||||
{
|
||||
type directMapped;
|
||||
value uniform (0 0 0 0 0 0 0 0 0);
|
||||
interpolationScheme cell;
|
||||
setAverage false;
|
||||
average (0 0 0 0 0 0 0 0 0);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ boundaryField
|
||||
{
|
||||
type directMapped;
|
||||
value uniform (10 0 0);
|
||||
interpolationScheme cell;
|
||||
setAverage true;
|
||||
average (10 0 0);
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ boundaryField
|
||||
{
|
||||
type directMapped;
|
||||
value uniform 2e-05;
|
||||
interpolationScheme cell;
|
||||
setAverage false;
|
||||
average 2e-05;
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ boundaryField
|
||||
{
|
||||
type directMapped;
|
||||
value uniform 0;
|
||||
interpolationScheme cell;
|
||||
setAverage false;
|
||||
average 0;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
c++WARN = -wd327,654,819,1125,1476,1505,1572
|
||||
|
||||
CC = icpc
|
||||
CC = icpc -std=c++0x
|
||||
|
||||
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
c++DBUG =
|
||||
c++OPT = -xT -O3 -no-prec-div
|
||||
c++OPT = -xSSE3 -O3 -no-prec-div
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
c++WARN = -wd327,654,819,1125,1476,1505,1572
|
||||
|
||||
#CC = icpc -gcc-version=400
|
||||
CC = icpc
|
||||
CC = icpc -std=c++0x
|
||||
|
||||
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user