mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
This commit is contained in:
@ -190,6 +190,10 @@
|
|||||||
mesh. Great for postprocessing.
|
mesh. Great for postprocessing.
|
||||||
+ =steadyParticleTracks=: Generates VTK tracks from the output of the cloud
|
+ =steadyParticleTracks=: Generates VTK tracks from the output of the cloud
|
||||||
=ParticleTracks= post-processing sub-model
|
=ParticleTracks= post-processing sub-model
|
||||||
|
+ Sampling:
|
||||||
|
+ =patchInternalField=: new sampledSurface - like 'patch' but samples
|
||||||
|
internal field instead of boundary field.
|
||||||
|
+ =ensight=: new output format for all sampledSurfaces.
|
||||||
+ Function objects:
|
+ Function objects:
|
||||||
+ =residualControl=: new function object to allow users to terminate steady
|
+ =residualControl=: new function object to allow users to terminate steady
|
||||||
state calculations when the defined residual levels are achieved
|
state calculations when the defined residual levels are achieved
|
||||||
@ -204,7 +208,9 @@
|
|||||||
+ =readFields=: reads field if not yet registered. Makes functionObjects
|
+ =readFields=: reads field if not yet registered. Makes functionObjects
|
||||||
useable through standalone execFlowFunctionObjects.
|
useable through standalone execFlowFunctionObjects.
|
||||||
+ =faceSource=: can now calculate on a sampledSurface (e.g. flow through a
|
+ =faceSource=: can now calculate on a sampledSurface (e.g. flow through a
|
||||||
triSurfaceMesh)
|
triSurfaceMesh).
|
||||||
|
+ =nearWallFields=: constructs field with on selected patches interpolated
|
||||||
|
internal field for further postprocessing.
|
||||||
|
|
||||||
* New tutorials
|
* New tutorials
|
||||||
There is a large number of new tutorials for existing and new solvers in the
|
There is a large number of new tutorials for existing and new solvers in the
|
||||||
|
|||||||
@ -129,15 +129,7 @@ int main(int argc, char *argv[])
|
|||||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||||
|
|
||||||
// Distribute complexData
|
// Distribute complexData
|
||||||
mapDistribute::distribute
|
mapDistribute::distribute(complexData);
|
||||||
(
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(),
|
|
||||||
map.constructMap(),
|
|
||||||
complexData
|
|
||||||
);
|
|
||||||
|
|
||||||
Pout<< "complexData:" << complexData << endl;
|
Pout<< "complexData:" << complexData << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,7 @@ Description
|
|||||||
------ local definitions
|
------ local definitions
|
||||||
\* ------------------------------------------------------------------------ */
|
\* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#include "cyclicPolyPatch.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
@ -904,6 +905,13 @@ int main(int argc, char *argv[])
|
|||||||
fluentToFoamType.insert("radiator", polyPatch::typeName);
|
fluentToFoamType.insert("radiator", polyPatch::typeName);
|
||||||
fluentToFoamType.insert("porous-jump", polyPatch::typeName);
|
fluentToFoamType.insert("porous-jump", polyPatch::typeName);
|
||||||
|
|
||||||
|
//- Periodic halves map directly into split cyclics. The problem is the
|
||||||
|
// initial matching since we require knowledge of the transformation.
|
||||||
|
// It is ok if the periodics are already ordered. We should read the
|
||||||
|
// periodic shadow faces section (section 18) to give use the ordering
|
||||||
|
// For now just disable.
|
||||||
|
//fluentToFoamType.insert("periodic", cyclicPolyPatch::typeName);
|
||||||
|
|
||||||
|
|
||||||
// Foam patch type for Fluent zone type
|
// Foam patch type for Fluent zone type
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@ -1038,6 +1046,49 @@ int main(int argc, char *argv[])
|
|||||||
HashTable<word>::const_iterator iter = fluentToFoamType.find(type);
|
HashTable<word>::const_iterator iter = fluentToFoamType.find(type);
|
||||||
|
|
||||||
if (iter != fluentToFoamType.end())
|
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
|
newPatches[patchi] = polyPatch::New
|
||||||
(
|
(
|
||||||
@ -1049,6 +1100,7 @@ int main(int argc, char *argv[])
|
|||||||
mesh.boundaryMesh()
|
mesh.boundaryMesh()
|
||||||
).ptr();
|
).ptr();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Adding polyPatch for unknown Fluent type " << type
|
Info<< "Adding polyPatch for unknown Fluent type " << type
|
||||||
|
|||||||
@ -19,15 +19,17 @@ FoamFile
|
|||||||
|
|
||||||
numberOfSubdomains 8;
|
numberOfSubdomains 8;
|
||||||
|
|
||||||
|
|
||||||
//- Keep owner and neighbour on same processor for faces in zones:
|
//- Keep owner and neighbour on same processor for faces in zones:
|
||||||
// preserveFaceZones (heater solid1 solid3);
|
// preserveFaceZones (heater solid1 solid3);
|
||||||
|
|
||||||
|
|
||||||
//- Keep owner and neighbour on same processor for faces in patches:
|
//- Keep owner and neighbour on same processor for faces in patches:
|
||||||
// (makes sense only for cyclic patches)
|
// (makes sense only for cyclic patches)
|
||||||
//preservePatches (cyclic_half0 cyclic_half1);
|
//preservePatches (cyclic_half0 cyclic_half1);
|
||||||
|
|
||||||
|
//- Use the volScalarField named here as a weight for each cell in the
|
||||||
|
// decomposition. For example, use a particle population field to decompose
|
||||||
|
// for a balanced number of particles in a lagrangian simulation.
|
||||||
|
// weightField dsmcRhoNMean;
|
||||||
|
|
||||||
method scotch;
|
method scotch;
|
||||||
// method hierarchical;
|
// method hierarchical;
|
||||||
@ -59,11 +61,8 @@ multiLevelCoeffs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Desired output
|
// Desired output
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
simpleCoeffs
|
simpleCoeffs
|
||||||
{
|
{
|
||||||
n (2 1 1);
|
n (2 1 1);
|
||||||
|
|||||||
@ -24,7 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "domainDecomposition.H"
|
#include "domainDecomposition.H"
|
||||||
#include "Time.H"
|
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "labelIOList.H"
|
#include "labelIOList.H"
|
||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
|
|||||||
@ -41,6 +41,9 @@ SourceFiles
|
|||||||
#include "SLList.H"
|
#include "SLList.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
#include "point.H"
|
#include "point.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|||||||
@ -113,9 +113,37 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (sameProcFaces.empty())
|
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());
|
cellToProc_ = decomposePtr().decompose(*this, cellCentres());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Info<< "Selected " << sameProcFaces.size()
|
Info<< "Selected " << sameProcFaces.size()
|
||||||
@ -173,6 +201,42 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
|
|
||||||
// Do decomposition on agglomeration
|
// 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
|
cellToProc_ = decomposePtr().decompose
|
||||||
(
|
(
|
||||||
*this,
|
*this,
|
||||||
@ -180,6 +244,7 @@ void Foam::domainDecomposition::distributeCells()
|
|||||||
regionCentres
|
regionCentres
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "\nFinished decomposition in "
|
Info<< "\nFinished decomposition in "
|
||||||
<< decompositionTime.elapsedCpuTime()
|
<< decompositionTime.elapsedCpuTime()
|
||||||
|
|||||||
@ -6,6 +6,7 @@ EXE_INC = \
|
|||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
|
-lgenericPatchFields \
|
||||||
-ldecompositionMethods \
|
-ldecompositionMethods \
|
||||||
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
|
-L$(FOAM_LIBBIN)/dummy -lptscotchDecomp \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
|
|||||||
@ -86,33 +86,49 @@ autoPtr<fvMesh> createMesh
|
|||||||
if (!haveMesh)
|
if (!haveMesh)
|
||||||
{
|
{
|
||||||
// Create dummy mesh. Only used on procs that don't have mesh.
|
// Create dummy mesh. Only used on procs that don't have mesh.
|
||||||
// WIP: how to avoid parallel comms when loading IOdictionaries?
|
|
||||||
// For now just give error message.
|
|
||||||
if
|
|
||||||
(
|
|
||||||
regIOobject::fileModificationChecking
|
|
||||||
== regIOobject::timeStampMaster
|
|
||||||
|| regIOobject::fileModificationChecking
|
|
||||||
== regIOobject::inotifyMaster
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FatalErrorIn("createMesh(..)")
|
IOdictionary fvSolution
|
||||||
<< "Cannot use 'fileModificationChecking' mode "
|
(
|
||||||
<< regIOobject::fileCheckTypesNames
|
IOobject
|
||||||
[
|
(
|
||||||
regIOobject::fileModificationChecking
|
"fvSolution",
|
||||||
]
|
runTime.system(),
|
||||||
<< " since this uses parallel communication."
|
runTime,
|
||||||
<< exit(FatalError);
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
Pout<< "Writing dummy " << fvSolution.objectPath() << endl;
|
||||||
|
fvSolution.regIOobject::write();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
IOdictionary fvSchemes
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"fvSchemes",
|
||||||
|
runTime.system(),
|
||||||
|
runTime,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
fvSchemes.add("divSchemes", dictionary());
|
||||||
|
fvSchemes.add("gradSchemes", dictionary());
|
||||||
|
fvSchemes.add("laplacianSchemes", dictionary());
|
||||||
|
Pout<< "Writing dummy " << fvSchemes.objectPath() << endl;
|
||||||
|
fvSchemes.regIOobject::write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pout<< "Creating dummy mesh from " << io.objectPath() << endl;
|
||||||
fvMesh dummyMesh
|
fvMesh dummyMesh
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
regionName,
|
io.name(),
|
||||||
instDir,
|
io.instance(),
|
||||||
runTime,
|
io.db(),
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
),
|
),
|
||||||
xferCopy(pointField()),
|
xferCopy(pointField()),
|
||||||
@ -545,8 +561,13 @@ int main(int argc, char *argv[])
|
|||||||
mkDir(args.path());
|
mkDir(args.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Switch timeStamp checking to one which does not do any
|
||||||
|
// parallel sync for same reason
|
||||||
|
regIOobject::fileModificationChecking = regIOobject::timeStamp;
|
||||||
|
|
||||||
# include "createTime.H"
|
# include "createTime.H"
|
||||||
|
|
||||||
|
|
||||||
word regionName = polyMesh::defaultRegion;
|
word regionName = polyMesh::defaultRegion;
|
||||||
fileName meshSubDir;
|
fileName meshSubDir;
|
||||||
|
|
||||||
|
|||||||
@ -166,6 +166,18 @@ surfaces
|
|||||||
// triangulate false;
|
// triangulate false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
movingNearWall_interpolated
|
||||||
|
{
|
||||||
|
// Sample cell values off patch. Does not need to be the near-wall
|
||||||
|
// cell, can be arbitrarily far away.
|
||||||
|
type patchInternalField;
|
||||||
|
patchName movingWall;
|
||||||
|
distance 0.0001;
|
||||||
|
interpolate true;
|
||||||
|
// Optional: whether to leave as faces (=default) or triangulate
|
||||||
|
// triangulate false;
|
||||||
|
}
|
||||||
|
|
||||||
interpolatedIso
|
interpolatedIso
|
||||||
{
|
{
|
||||||
// Iso surface for interpolated values only
|
// Iso surface for interpolated values only
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -57,8 +57,10 @@ runParallel()
|
|||||||
then
|
then
|
||||||
echo "$APP_RUN already run on $PWD: remove log file to run"
|
echo "$APP_RUN already run on $PWD: remove log file to run"
|
||||||
else
|
else
|
||||||
echo "Running $APP_RUN in parallel on $PWD using $1 processes"
|
nProcs=$1
|
||||||
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
|
shift
|
||||||
|
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
|
||||||
|
( mpirun -np $nProcs $APP_RUN -parallel $* < /dev/null > log.$APP_RUN 2>&1 )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,8 +70,12 @@ are READ_IF_MODIFIED. It means that slaves read exactly the same dictionary
|
|||||||
as the master so cannot be used for dictionaries that contain e.g. mesh
|
as the master so cannot be used for dictionaries that contain e.g. mesh
|
||||||
specific information.
|
specific information.
|
||||||
|
|
||||||
|
- note: even if the file does not exist (e.g. when timeStampMaster) it
|
||||||
|
will still register a local file with the fileMonitor. This is so fileMonitor
|
||||||
|
stays synchronised. So take care when reading/creating non-parallel dictionary.
|
||||||
|
|
||||||
- inotify is a monitoring framework used to monitor changes in
|
- inotify is a monitoring framework used to monitor changes in
|
||||||
lots of files (e.g. used in desktop searched like beagle). You specify
|
lots of files (e.g. used in desktop search engines like beagle). You specify
|
||||||
files to monitor and then get warned for any changes to these files.
|
files to monitor and then get warned for any changes to these files.
|
||||||
It does not need timestamps. There is no need for fileModificationSkew
|
It does not need timestamps. There is no need for fileModificationSkew
|
||||||
to allow for time differences. (there can still temporarily be a difference
|
to allow for time differences. (there can still temporarily be a difference
|
||||||
|
|||||||
@ -537,7 +537,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
|||||||
{
|
{
|
||||||
transform
|
transform
|
||||||
(
|
(
|
||||||
procPatch.reverseT(),
|
procPatch.forwardT(),
|
||||||
receiveFaces.size(),
|
receiveFaces.size(),
|
||||||
receiveFacesInfo
|
receiveFacesInfo
|
||||||
);
|
);
|
||||||
|
|||||||
@ -55,46 +55,59 @@ void Foam::IOdictionary::readFile(const bool masterOnly)
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterOnly)
|
if (masterOnly && Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Scatter master data
|
// Scatter master data using communication scheme
|
||||||
if (Pstream::master())
|
|
||||||
{
|
const List<Pstream::commsStruct>& comms =
|
||||||
for
|
|
||||||
(
|
(
|
||||||
int slave=Pstream::firstSlave();
|
(Pstream::nProcs() < Pstream::nProcsSimpleSum)
|
||||||
slave<=Pstream::lastSlave();
|
? Pstream::linearCommunication()
|
||||||
slave++
|
: Pstream::treeCommunication()
|
||||||
)
|
|
||||||
{
|
|
||||||
// Note: use ASCII for now - binary IO of dictionaries is
|
|
||||||
// not currently supported
|
|
||||||
OPstream toSlave
|
|
||||||
(
|
|
||||||
Pstream::scheduled,
|
|
||||||
slave,
|
|
||||||
0,
|
|
||||||
UPstream::msgType(),
|
|
||||||
IOstream::ASCII
|
|
||||||
);
|
);
|
||||||
IOdictionary::writeData(toSlave);
|
|
||||||
}
|
|
||||||
}
|
// Get my communication order
|
||||||
else
|
const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
|
||||||
|
|
||||||
|
// Reveive from up
|
||||||
|
if (myComm.above() != -1)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "IOdictionary : Reading " << objectPath()
|
Pout<< "IOdictionary : Reading " << objectPath()
|
||||||
<< " from master processor " << Pstream::masterNo() << endl;
|
<< " from processor " << myComm.above() << endl;
|
||||||
}
|
}
|
||||||
IPstream fromMaster
|
|
||||||
|
// Note: use ASCII for now - binary IO of dictionaries is
|
||||||
|
// not currently supported
|
||||||
|
IPstream fromAbove
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
Pstream::masterNo(),
|
myComm.above(),
|
||||||
0,
|
0,
|
||||||
IOstream::ASCII
|
IOstream::ASCII
|
||||||
);
|
);
|
||||||
IOdictionary::readData(fromMaster);
|
IOdictionary::readData(fromAbove);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send to my downstairs neighbours
|
||||||
|
forAll(myComm.below(), belowI)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "IOdictionary : Sending " << objectPath()
|
||||||
|
<< " to processor " << myComm.below()[belowI] << endl;
|
||||||
|
}
|
||||||
|
OPstream toBelow
|
||||||
|
(
|
||||||
|
Pstream::scheduled,
|
||||||
|
myComm.below()[belowI],
|
||||||
|
0,
|
||||||
|
Pstream::msgType(),
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
IOdictionary::writeData(toBelow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,55 +177,69 @@ bool Foam::regIOobject::read()
|
|||||||
regIOobject::fileModificationChecking == timeStampMaster
|
regIOobject::fileModificationChecking == timeStampMaster
|
||||||
|| regIOobject::fileModificationChecking == inotifyMaster;
|
|| regIOobject::fileModificationChecking == inotifyMaster;
|
||||||
|
|
||||||
bool ok;
|
bool ok = true;
|
||||||
if (Pstream::master() || !masterOnly)
|
if (Pstream::master() || !masterOnly)
|
||||||
{
|
|
||||||
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)
|
if (IFstream::debug)
|
||||||
{
|
{
|
||||||
Pout<< "regIOobject::read() : "
|
Pout<< "regIOobject::read() : "
|
||||||
<< "reading object " << name()
|
<< "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;
|
<< endl;
|
||||||
}
|
}
|
||||||
IPstream fromMaster
|
|
||||||
|
// Note: use ASCII for now - binary IO of dictionaries is
|
||||||
|
// not currently supported
|
||||||
|
IPstream fromAbove
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
Pstream::masterNo(),
|
myComm.above(),
|
||||||
0,
|
0,
|
||||||
IOstream::ASCII
|
IOstream::ASCII
|
||||||
);
|
);
|
||||||
ok = readData(fromMaster);
|
ok = readData(fromAbove);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send to my downstairs neighbours
|
||||||
|
forAll(myComm.below(), belowI)
|
||||||
|
{
|
||||||
|
OPstream toBelow
|
||||||
|
(
|
||||||
|
Pstream::scheduled,
|
||||||
|
myComm.below()[belowI],
|
||||||
|
0,
|
||||||
|
Pstream::msgType(),
|
||||||
|
IOstream::ASCII
|
||||||
|
);
|
||||||
|
writeData(toBelow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
|||||||
@ -41,16 +41,20 @@ Foam::cyclicLduInterfaceField::~cyclicLduInterfaceField()
|
|||||||
|
|
||||||
void Foam::cyclicLduInterfaceField::transformCoupleField
|
void Foam::cyclicLduInterfaceField::transformCoupleField
|
||||||
(
|
(
|
||||||
scalarField& pnf,
|
scalarField& f,
|
||||||
const direction cmpt
|
const direction cmpt
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (doTransform())
|
if (doTransform())
|
||||||
{
|
{
|
||||||
scalar forwardScale =
|
if (forwardT().size() == 1)
|
||||||
pow(diag(forwardT()[0]).component(cmpt), rank());
|
{
|
||||||
|
f *= pow(diag(forwardT()[0]).component(cmpt), rank());
|
||||||
pnf *= forwardScale;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f *= pow(diag(forwardT())().component(cmpt), rank());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,9 +43,39 @@ static const Foam::List<Foam::word> subDictNames
|
|||||||
);
|
);
|
||||||
//! @endcond
|
//! @endcond
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::solution::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (dict.found("cache"))
|
||||||
|
{
|
||||||
|
cache_ = dict.subDict("cache");
|
||||||
|
caching_ = cache_.lookupOrDefault("active", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("relaxationFactors"))
|
||||||
|
{
|
||||||
|
relaxationFactors_ = dict.subDict("relaxationFactors");
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
||||||
|
|
||||||
|
if (dict.found("solvers"))
|
||||||
|
{
|
||||||
|
solvers_ = dict.subDict("solvers");
|
||||||
|
upgradeSolverDict(solvers_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
Foam::solution::solution
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const fileName& dictName
|
||||||
|
)
|
||||||
:
|
:
|
||||||
IOdictionary
|
IOdictionary
|
||||||
(
|
(
|
||||||
@ -64,7 +94,7 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
|||||||
defaultRelaxationFactor_(0),
|
defaultRelaxationFactor_(0),
|
||||||
solvers_(ITstream("solvers", tokenList())())
|
solvers_(ITstream("solvers", tokenList())())
|
||||||
{
|
{
|
||||||
read();
|
read(solutionDict());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -250,26 +280,7 @@ bool Foam::solution::read()
|
|||||||
{
|
{
|
||||||
if (regIOobject::read())
|
if (regIOobject::read())
|
||||||
{
|
{
|
||||||
const dictionary& dict = solutionDict();
|
read(solutionDict());
|
||||||
|
|
||||||
if (dict.found("cache"))
|
|
||||||
{
|
|
||||||
cache_ = dict.subDict("cache");
|
|
||||||
caching_ = cache_.lookupOrDefault("active", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dict.found("relaxationFactors"))
|
|
||||||
{
|
|
||||||
relaxationFactors_ = dict.subDict("relaxationFactors");
|
|
||||||
}
|
|
||||||
|
|
||||||
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
|
||||||
|
|
||||||
if (dict.found("solvers"))
|
|
||||||
{
|
|
||||||
solvers_ = dict.subDict("solvers");
|
|
||||||
upgradeSolverDict(solvers_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,6 +70,9 @@ class solution
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read settings from the dictionary
|
||||||
|
void read(const dictionary&);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct and assignment
|
//- Disallow default bitwise copy construct and assignment
|
||||||
solution(const solution&);
|
solution(const solution&);
|
||||||
void operator=(const solution&);
|
void operator=(const solution&);
|
||||||
@ -89,7 +92,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary
|
//- Construct for given objectRegistry and dictionary
|
||||||
solution(const objectRegistry& obr, const fileName& dictName);
|
solution
|
||||||
|
(
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const fileName& dictName
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -1220,7 +1220,17 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
|
|
||||||
// Do one exchange iteration to get neighbour points.
|
// Do one exchange iteration to get neighbour points.
|
||||||
{
|
{
|
||||||
PstreamBuffers pBufs(Pstream::defaultCommsType);
|
// Note: to use 'scheduled' would have to intersperse send and receive.
|
||||||
|
// So for now just use nonBlocking. Also globalPoints itself gets
|
||||||
|
// constructed by mesh.globalData().patchSchedule() so creates a loop.
|
||||||
|
PstreamBuffers pBufs
|
||||||
|
(
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType == Pstream::scheduled
|
||||||
|
? Pstream::nonBlocking
|
||||||
|
: Pstream::defaultCommsType
|
||||||
|
)
|
||||||
|
);
|
||||||
sendPatchPoints
|
sendPatchPoints
|
||||||
(
|
(
|
||||||
mergeSeparated,
|
mergeSeparated,
|
||||||
@ -1251,7 +1261,14 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
PstreamBuffers pBufs(Pstream::defaultCommsType);
|
PstreamBuffers pBufs
|
||||||
|
(
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType == Pstream::scheduled
|
||||||
|
? Pstream::nonBlocking
|
||||||
|
: Pstream::defaultCommsType
|
||||||
|
)
|
||||||
|
);
|
||||||
sendPatchPoints
|
sendPatchPoints
|
||||||
(
|
(
|
||||||
mergeSeparated,
|
mergeSeparated,
|
||||||
@ -1400,7 +1417,15 @@ void Foam::globalPoints::calculateSharedPoints
|
|||||||
Pout<< "Determined " << changedIndices.size() << " shared points."
|
Pout<< "Determined " << changedIndices.size() << " shared points."
|
||||||
<< " Exchanging them" << endl;
|
<< " Exchanging them" << endl;
|
||||||
}
|
}
|
||||||
PstreamBuffers pBufs(Pstream::defaultCommsType);
|
PstreamBuffers pBufs
|
||||||
|
(
|
||||||
|
(
|
||||||
|
Pstream::defaultCommsType == Pstream::scheduled
|
||||||
|
? Pstream::nonBlocking
|
||||||
|
: Pstream::defaultCommsType
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
sendSharedPoints(mergeSeparated, pBufs, changedIndices);
|
sendSharedPoints(mergeSeparated, pBufs, changedIndices);
|
||||||
pBufs.finishedSends();
|
pBufs.finishedSends();
|
||||||
receiveSharedPoints
|
receiveSharedPoints
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class objectMap;
|
|||||||
inline bool operator==(const objectMap& a, const objectMap& b);
|
inline bool operator==(const objectMap& a, const objectMap& b);
|
||||||
inline bool operator!=(const objectMap& a, const objectMap& b);
|
inline bool operator!=(const objectMap& a, const objectMap& b);
|
||||||
inline Ostream& operator<<(Ostream&, const objectMap&);
|
inline Ostream& operator<<(Ostream&, const objectMap&);
|
||||||
|
inline Istream& operator>>(Istream&, objectMap&);
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -100,6 +101,8 @@ public:
|
|||||||
// IOstream Operators
|
// IOstream Operators
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream&, const objectMap&);
|
friend Ostream& operator<<(Ostream&, const objectMap&);
|
||||||
|
|
||||||
|
friend Istream& operator>>(Istream&, objectMap&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -122,6 +122,19 @@ inline Ostream& operator<<(Ostream& os, const objectMap& a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Istream& operator>>(Istream& is, objectMap& a)
|
||||||
|
{
|
||||||
|
is.readBegin("objectMap");
|
||||||
|
is >> a.index_ >> a.masterObjects_;
|
||||||
|
is.readEnd("objectMap");
|
||||||
|
|
||||||
|
// Check state of Istream
|
||||||
|
is.check("Istream& operator>>(Istream&, objectMap&)");
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // Master namespace Foam
|
} // Master namespace Foam
|
||||||
|
|||||||
@ -194,6 +194,10 @@ void Foam::cyclicPolyPatch::calcTransforms
|
|||||||
vectorField half0Normals(half0Areas.size());
|
vectorField half0Normals(half0Areas.size());
|
||||||
vectorField half1Normals(half1Areas.size());
|
vectorField half1Normals(half1Areas.size());
|
||||||
|
|
||||||
|
//- Additional warning about faces non-aligned with rotation axis
|
||||||
|
//scalar maxCos = -GREAT;
|
||||||
|
//label maxFacei = -1;
|
||||||
|
|
||||||
forAll(half0, facei)
|
forAll(half0, facei)
|
||||||
{
|
{
|
||||||
scalar magSf = mag(half0Areas[facei]);
|
scalar magSf = mag(half0Areas[facei]);
|
||||||
@ -233,9 +237,33 @@ void Foam::cyclicPolyPatch::calcTransforms
|
|||||||
{
|
{
|
||||||
half0Normals[facei] = half0Areas[facei] / magSf;
|
half0Normals[facei] = half0Areas[facei] / magSf;
|
||||||
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
|
half1Normals[facei] = half1Areas[facei] / nbrMagSf;
|
||||||
|
|
||||||
|
//if (transform_ == ROTATIONAL)
|
||||||
|
//{
|
||||||
|
// scalar cos = mag(half0Normals[facei] & rotationAxis_);
|
||||||
|
// if (cos > maxCos)
|
||||||
|
// {
|
||||||
|
// maxCos = cos;
|
||||||
|
// maxFacei = facei;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (maxCos > sqrt(SMALL))
|
||||||
|
//{
|
||||||
|
// WarningIn
|
||||||
|
// (
|
||||||
|
// "cyclicPolyPatch::calcTransforms()"
|
||||||
|
// ) << "on patch " << name()
|
||||||
|
// << " face:" << maxFacei << " fc:" << half0Ctrs[maxFacei]
|
||||||
|
// << " is not perpendicular to the rotationAxis." << endl
|
||||||
|
// << "This will cause problems with topology changes." << endl
|
||||||
|
// << "rotation axis : " << rotationAxis_ << endl
|
||||||
|
// << "face normal : " << half0Normals[maxFacei] << endl
|
||||||
|
// << "cosine of angle : " << maxCos << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
// Calculate transformation tensors
|
// Calculate transformation tensors
|
||||||
calcTransformTensors
|
calcTransformTensors
|
||||||
(
|
(
|
||||||
@ -450,6 +478,35 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const word& neighbPatchName,
|
||||||
|
const transformType transform,
|
||||||
|
const vector& rotationAxis,
|
||||||
|
const point& rotationCentre,
|
||||||
|
const vector& separationVector
|
||||||
|
)
|
||||||
|
:
|
||||||
|
coupledPolyPatch(name, size, start, index, bm),
|
||||||
|
neighbPatchName_(neighbPatchName),
|
||||||
|
neighbPatchID_(-1),
|
||||||
|
transform_(transform),
|
||||||
|
rotationAxis_(rotationAxis),
|
||||||
|
rotationCentre_(rotationCentre),
|
||||||
|
separationVector_(separationVector),
|
||||||
|
coupledPointsPtr_(NULL),
|
||||||
|
coupledEdgesPtr_(NULL)
|
||||||
|
{
|
||||||
|
// Neighbour patch might not be valid yet so no transformation
|
||||||
|
// calculation possible.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::cyclicPolyPatch::cyclicPolyPatch
|
Foam::cyclicPolyPatch::cyclicPolyPatch
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
|
|||||||
@ -213,6 +213,21 @@ public:
|
|||||||
const polyBoundaryMesh& bm
|
const polyBoundaryMesh& bm
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
cyclicPolyPatch
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const label size,
|
||||||
|
const label start,
|
||||||
|
const label index,
|
||||||
|
const polyBoundaryMesh& bm,
|
||||||
|
const word& neighbPatchName,
|
||||||
|
const transformType transform, // transformation type
|
||||||
|
const vector& rotationAxis, // for rotation only
|
||||||
|
const point& rotationCentre, // for rotation only
|
||||||
|
const vector& separationVector // for translation only
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
cyclicPolyPatch
|
cyclicPolyPatch
|
||||||
(
|
(
|
||||||
|
|||||||
@ -142,6 +142,7 @@ $(derivedFvPatchFields)/pressureInletUniformVelocity/pressureInletUniformVelocit
|
|||||||
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/pressureInletVelocity/pressureInletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
$(derivedFvPatchFields)/rotatingPressureInletOutletVelocity/rotatingPressureInletOutletVelocityFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
|
$(derivedFvPatchFields)/rotatingTotalPressure/rotatingTotalPressureFvPatchScalarField.C
|
||||||
|
$(derivedFvPatchFields)/selfContainedDirectMapped/selfContainedDirectMappedFixedValueFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
|
$(derivedFvPatchFields)/slip/slipFvPatchFields.C
|
||||||
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
|
$(derivedFvPatchFields)/supersonicFreestream/supersonicFreestreamFvPatchVectorField.C
|
||||||
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
$(derivedFvPatchFields)/surfaceNormalFixedValue/surfaceNormalFixedValueFvPatchVectorField.C
|
||||||
|
|||||||
@ -272,15 +272,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
newValues = sampleField();
|
newValues = sampleField();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapDistribute::distribute
|
distMap.distribute(newValues);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
newValues
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -305,15 +297,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
const fieldType& nbrField = sampleField();
|
const fieldType& nbrField = sampleField();
|
||||||
|
|
||||||
newValues = nbrField.boundaryField()[nbrPatchID];
|
newValues = nbrField.boundaryField()[nbrPatchID];
|
||||||
mapDistribute::distribute
|
distMap.distribute(newValues);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
newValues
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -335,16 +319,7 @@ void directMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapDistribute::distribute
|
distMap.distribute(allValues);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
allValues
|
|
||||||
);
|
|
||||||
|
|
||||||
newValues.transfer(allValues);
|
newValues.transfer(allValues);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -212,26 +212,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapDistribute::distribute
|
distMap.distribute(allUValues);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
allUValues
|
|
||||||
);
|
|
||||||
newUValues.transfer(allUValues);
|
newUValues.transfer(allUValues);
|
||||||
|
|
||||||
mapDistribute::distribute
|
distMap.distribute(allPhiValues);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
allPhiValues
|
|
||||||
);
|
|
||||||
newPhiValues.transfer(allPhiValues);
|
newPhiValues.transfer(allPhiValues);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -244,28 +228,10 @@ void directMappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
|
|||||||
);
|
);
|
||||||
|
|
||||||
newUValues = UField.boundaryField()[nbrPatchID];
|
newUValues = UField.boundaryField()[nbrPatchID];
|
||||||
|
distMap.distribute(newUValues);
|
||||||
mapDistribute::distribute
|
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
newUValues
|
|
||||||
);
|
|
||||||
|
|
||||||
newPhiValues = phiField.boundaryField()[nbrPatchID];
|
newPhiValues = phiField.boundaryField()[nbrPatchID];
|
||||||
|
distMap.distribute(newPhiValues);
|
||||||
mapDistribute::distribute
|
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(),
|
|
||||||
distMap.constructMap(),
|
|
||||||
newPhiValues
|
|
||||||
);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
|
int Foam::fvSchemes::debug(Foam::debug::debugSwitch("fvSchemes", false));
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::fvSchemes::clear()
|
void Foam::fvSchemes::clear()
|
||||||
@ -53,137 +53,9 @@ void Foam::fvSchemes::clear()
|
|||||||
defaultFluxRequired_ = false;
|
defaultFluxRequired_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::fvSchemes::fvSchemes(const objectRegistry& obr)
|
void Foam::fvSchemes::read(const dictionary& dict)
|
||||||
:
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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"))
|
if (dict.found("ddtSchemes"))
|
||||||
{
|
{
|
||||||
ddtSchemes_ = dict.subDict("ddtSchemes");
|
ddtSchemes_ = dict.subDict("ddtSchemes");
|
||||||
@ -370,6 +242,142 @@ bool Foam::fvSchemes::read()
|
|||||||
defaultFluxRequired_ = Switch(fluxRequired_.lookup("default"));
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,6 +84,9 @@ class fvSchemes
|
|||||||
//- Clear the dictionaries and streams before reading
|
//- Clear the dictionaries and streams before reading
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
//- Read settings from the dictionary
|
||||||
|
void read(const dictionary&);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
fvSchemes(const fvSchemes&);
|
fvSchemes(const fvSchemes&);
|
||||||
|
|
||||||
|
|||||||
@ -504,7 +504,22 @@ Foam::polyMesh* Foam::blockMesh::createTopology
|
|||||||
dictionary& dict = patchDicts[patchI];
|
dictionary& dict = patchDicts[patchI];
|
||||||
|
|
||||||
// Add but not override type
|
// Add but not override type
|
||||||
|
if (!dict.found("type"))
|
||||||
|
{
|
||||||
dict.add("type", patchTypes[patchI], false);
|
dict.add("type", patchTypes[patchI], false);
|
||||||
|
}
|
||||||
|
else if (word(dict.lookup("type")) != patchTypes[patchI])
|
||||||
|
{
|
||||||
|
IOWarningIn
|
||||||
|
(
|
||||||
|
"blockMesh::createTopology(IOdictionary&)",
|
||||||
|
meshDescription
|
||||||
|
) << "For patch " << patchNames[patchI]
|
||||||
|
<< " overriding type '" << patchTypes[patchI]
|
||||||
|
<< "' with '" << word(dict.lookup("type"))
|
||||||
|
<< "' (read from boundary file)"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Override neighbourpatch name
|
// Override neighbourpatch name
|
||||||
if (nbrPatchNames[patchI] != word::null)
|
if (nbrPatchNames[patchI] != word::null)
|
||||||
|
|||||||
@ -473,7 +473,7 @@ void Foam::PointEdgeWave<Type>::handleProcPatches()
|
|||||||
// Apply transform to received data for non-parallel planes
|
// Apply transform to received data for non-parallel planes
|
||||||
if (!procPatch.parallel())
|
if (!procPatch.parallel())
|
||||||
{
|
{
|
||||||
transform(procPatch.reverseT(), patchInfo);
|
transform(procPatch.forwardT(), patchInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFromPatchInfo
|
updateFromPatchInfo
|
||||||
|
|||||||
@ -527,13 +527,14 @@ void Foam::directMappedPatchBase::calcMapping() const
|
|||||||
constructMap[procI]
|
constructMap[procI]
|
||||||
);
|
);
|
||||||
|
|
||||||
if (debug)
|
//if (debug)
|
||||||
{
|
//{
|
||||||
Pout<< "To proc:" << procI << " sending values of cells/faces:"
|
// Pout<< "To proc:" << procI << " sending values of cells/faces:"
|
||||||
<< subMap[procI] << endl;
|
// << subMap[procI] << endl;
|
||||||
Pout<< "From proc:" << procI << " receiving values of patch faces:"
|
// Pout<< "From proc:" << procI
|
||||||
<< constructMap[procI] << endl;
|
// << " receiving values of patch faces:"
|
||||||
}
|
// << constructMap[procI] << endl;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redo constructSize
|
// Redo constructSize
|
||||||
@ -644,6 +645,28 @@ Foam::directMappedPatchBase::directMappedPatchBase
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::directMappedPatchBase::directMappedPatchBase
|
||||||
|
(
|
||||||
|
const polyPatch& pp,
|
||||||
|
const word& sampleRegion,
|
||||||
|
const sampleMode mode,
|
||||||
|
const word& samplePatch,
|
||||||
|
const scalar distance
|
||||||
|
)
|
||||||
|
:
|
||||||
|
patch_(pp),
|
||||||
|
sampleRegion_(sampleRegion),
|
||||||
|
mode_(mode),
|
||||||
|
samplePatch_(samplePatch),
|
||||||
|
offsetMode_(NORMAL),
|
||||||
|
offset_(vector::zero),
|
||||||
|
offsets_(0),
|
||||||
|
distance_(distance),
|
||||||
|
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||||
|
mapPtr_(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::directMappedPatchBase::directMappedPatchBase
|
Foam::directMappedPatchBase::directMappedPatchBase
|
||||||
(
|
(
|
||||||
const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
|
|||||||
@ -206,15 +206,15 @@ public:
|
|||||||
const vector& offset
|
const vector& offset
|
||||||
);
|
);
|
||||||
|
|
||||||
////- Construct from normal and distance
|
//- Construct from offsetMode=normal and distance
|
||||||
//directMappedPatchBase
|
directMappedPatchBase
|
||||||
//(
|
(
|
||||||
// const polyPatch& pp,
|
const polyPatch& pp,
|
||||||
// const word& sampleRegion,
|
const word& sampleRegion,
|
||||||
// const word& samplePatch,
|
const sampleMode sampleMode,
|
||||||
// const sampleMode sampleMode,
|
const word& samplePatch,
|
||||||
// const vector& offset
|
const scalar distance
|
||||||
//);
|
);
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
directMappedPatchBase(const polyPatch&, const dictionary&);
|
directMappedPatchBase(const polyPatch&, const dictionary&);
|
||||||
|
|||||||
@ -440,15 +440,7 @@ void Foam::distributedTriSurfaceMesh::findLine
|
|||||||
// Exchange the segments
|
// Exchange the segments
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.distribute(allSegments);
|
||||||
(
|
|
||||||
Pstream::nonBlocking, //Pstream::scheduled,
|
|
||||||
List<labelPair>(0), //map.schedule(),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(), // what to send
|
|
||||||
map.constructMap(), // what to receive
|
|
||||||
allSegments
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Do tests I need to do
|
// Do tests I need to do
|
||||||
@ -490,21 +482,7 @@ void Foam::distributedTriSurfaceMesh::findLine
|
|||||||
// Exchange the intersections (opposite to segments)
|
// Exchange the intersections (opposite to segments)
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.reverseDistribute(nOldAllSegments, intersections);
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule // Note reverse schedule
|
|
||||||
//(
|
|
||||||
// map.constructMap(),
|
|
||||||
// map.subMap()
|
|
||||||
//),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
nOldAllSegments,
|
|
||||||
map.constructMap(), // what to send
|
|
||||||
map.subMap(), // what to receive
|
|
||||||
intersections
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Extract the hits
|
// Extract the hits
|
||||||
@ -657,17 +635,7 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
|||||||
// Send over queries
|
// Send over queries
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.distribute(triangleIndex);
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule(),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(), // what to send
|
|
||||||
map.constructMap(), // what to receive
|
|
||||||
triangleIndex
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
return mapPtr;
|
return mapPtr;
|
||||||
@ -1603,28 +1571,8 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
// swap samples to local processor
|
// swap samples to local processor
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.distribute(allCentres);
|
||||||
(
|
map.distribute(allRadiusSqr);
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule(),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(), // what to send
|
|
||||||
map.constructMap(), // what to receive
|
|
||||||
allCentres
|
|
||||||
);
|
|
||||||
map.distribute
|
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule(),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(), // what to send
|
|
||||||
map.constructMap(), // what to receive
|
|
||||||
allRadiusSqr
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Do my tests
|
// Do my tests
|
||||||
@ -1648,21 +1596,7 @@ void Foam::distributedTriSurfaceMesh::findNearest
|
|||||||
// Send back results
|
// Send back results
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.reverseDistribute(allSegmentMap.size(), allInfo);
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule // note reverse schedule
|
|
||||||
//(
|
|
||||||
// map.constructMap(),
|
|
||||||
// map.subMap()
|
|
||||||
//),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
allSegmentMap.size(),
|
|
||||||
map.constructMap(), // what to send
|
|
||||||
map.subMap(), // what to receive
|
|
||||||
allInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Extract information
|
// Extract information
|
||||||
@ -1901,21 +1835,7 @@ void Foam::distributedTriSurfaceMesh::getRegion
|
|||||||
// Send back results
|
// Send back results
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.reverseDistribute(info.size(), region);
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule // note reverse schedule
|
|
||||||
//(
|
|
||||||
// map.constructMap(),
|
|
||||||
// map.subMap()
|
|
||||||
//),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
info.size(),
|
|
||||||
map.constructMap(), // what to send
|
|
||||||
map.subMap(), // what to receive
|
|
||||||
region
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1965,21 +1885,7 @@ void Foam::distributedTriSurfaceMesh::getNormal
|
|||||||
// Send back results
|
// Send back results
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.reverseDistribute(info.size(), normal);
|
||||||
(
|
|
||||||
//Pstream::scheduled,
|
|
||||||
//map.schedule // note reverse schedule
|
|
||||||
//(
|
|
||||||
// map.constructMap(),
|
|
||||||
// map.subMap()
|
|
||||||
//),
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
info.size(),
|
|
||||||
map.constructMap(), // what to send
|
|
||||||
map.subMap(), // what to receive
|
|
||||||
normal
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2033,15 +1939,7 @@ void Foam::distributedTriSurfaceMesh::getField
|
|||||||
// Send back results
|
// Send back results
|
||||||
// ~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
map.distribute
|
map.reverseDistribute(info.size(), values);
|
||||||
(
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
info.size(),
|
|
||||||
map.constructMap(), // what to send
|
|
||||||
map.subMap(), // what to receive
|
|
||||||
values
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,15 +76,7 @@ License
|
|||||||
// // Send back results
|
// // Send back results
|
||||||
// // ~~~~~~~~~~~~~~~~~
|
// // ~~~~~~~~~~~~~~~~~
|
||||||
//
|
//
|
||||||
// map.distribute
|
// map.reverseDistribute(info.size(), values);
|
||||||
// (
|
|
||||||
// Pstream::nonBlocking,
|
|
||||||
// List<labelPair>(0),
|
|
||||||
// info.size(),
|
|
||||||
// map.constructMap(), // what to send
|
|
||||||
// map.subMap(), // what to receive
|
|
||||||
// values
|
|
||||||
// );
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
@ -115,15 +107,7 @@ void Foam::distributedTriSurfaceMesh::distributeFields
|
|||||||
|
|
||||||
label oldSize = field.size();
|
label oldSize = field.size();
|
||||||
|
|
||||||
map.distribute
|
map.distribute(field);
|
||||||
(
|
|
||||||
Pstream::nonBlocking,
|
|
||||||
List<labelPair>(0),
|
|
||||||
map.constructSize(),
|
|
||||||
map.subMap(),
|
|
||||||
map.constructMap(),
|
|
||||||
field
|
|
||||||
);
|
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,6 +12,9 @@ fieldValues/faceSource/faceSourceFunctionObject.C
|
|||||||
fieldValues/cellSource/cellSource.C
|
fieldValues/cellSource/cellSource.C
|
||||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
fieldValues/cellSource/cellSourceFunctionObject.C
|
||||||
|
|
||||||
|
nearWallFields/nearWallFields.C
|
||||||
|
nearWallFields/nearWallFieldsFunctionObject.C
|
||||||
|
|
||||||
readFields/readFields.C
|
readFields/readFields.C
|
||||||
readFields/readFieldsFunctionObject.C
|
readFields/readFieldsFunctionObject.C
|
||||||
|
|
||||||
|
|||||||
@ -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
|
mapDistribute::distribute
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
|
|||||||
@ -24,7 +24,6 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "surfaceInterpolateFields.H"
|
#include "surfaceInterpolateFields.H"
|
||||||
//#include "dictionary.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -89,8 +88,8 @@ void Foam::surfaceInterpolateFields::read(const dictionary& dict)
|
|||||||
|
|
||||||
void Foam::surfaceInterpolateFields::execute()
|
void Foam::surfaceInterpolateFields::execute()
|
||||||
{
|
{
|
||||||
//Info<< type() << " " << name_ << ":" << nl;
|
if (active_)
|
||||||
|
{
|
||||||
// Clear out any previously loaded fields
|
// Clear out any previously loaded fields
|
||||||
ssf_.clear();
|
ssf_.clear();
|
||||||
svf_.clear();
|
svf_.clear();
|
||||||
@ -103,6 +102,7 @@ void Foam::surfaceInterpolateFields::execute()
|
|||||||
interpolateFields<sphericalTensor>(sSpheretf_);
|
interpolateFields<sphericalTensor>(sSpheretf_);
|
||||||
interpolateFields<symmTensor>(sSymmtf_);
|
interpolateFields<symmTensor>(sSymmtf_);
|
||||||
interpolateFields<tensor>(stf_);
|
interpolateFields<tensor>(stf_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +114,32 @@ void Foam::surfaceInterpolateFields::end()
|
|||||||
|
|
||||||
void Foam::surfaceInterpolateFields::write()
|
void Foam::surfaceInterpolateFields::write()
|
||||||
{
|
{
|
||||||
// Do nothing
|
if (active_)
|
||||||
|
{
|
||||||
|
Info<< "Writing interpolated surface fields to "
|
||||||
|
<< obr_.time().timeName() << endl;
|
||||||
|
|
||||||
|
forAll(ssf_, i)
|
||||||
|
{
|
||||||
|
ssf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(svf_, i)
|
||||||
|
{
|
||||||
|
svf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(sSpheretf_, i)
|
||||||
|
{
|
||||||
|
sSpheretf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(sSymmtf_, i)
|
||||||
|
{
|
||||||
|
sSymmtf_[i].write();
|
||||||
|
}
|
||||||
|
forAll(stf_, i)
|
||||||
|
{
|
||||||
|
stf_[i].write();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,9 +27,24 @@ Class
|
|||||||
Description
|
Description
|
||||||
Linear interpolates volFields to surfaceFields
|
Linear interpolates volFields to surfaceFields
|
||||||
|
|
||||||
Note: gets executed every time step. Could move it to write() but then
|
- at write it writes the fields
|
||||||
you'd have problems if you have different write frequencies for different
|
- it executes every time step
|
||||||
function objects.
|
|
||||||
|
so it can either be used to calculate and write the interpolate or
|
||||||
|
(since the interpolates are registered) use some other functionObject
|
||||||
|
to work on them.
|
||||||
|
|
||||||
|
sampleSomeFields
|
||||||
|
{
|
||||||
|
type surfaceInterpolateFields;
|
||||||
|
..
|
||||||
|
enabled true;
|
||||||
|
outputControl outputTime;
|
||||||
|
..
|
||||||
|
// Name of volField and corresponding surfaceField
|
||||||
|
fields ((p pInterpolate)(U UInterpolate));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfaceInterpolateFields.C
|
surfaceInterpolateFields.C
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
probes/probes.C
|
probes/probes.C
|
||||||
|
probes/patchProbes.C
|
||||||
probes/probesGrouping.C
|
probes/probesGrouping.C
|
||||||
probes/probesFunctionObject/probesFunctionObject.C
|
probes/probesFunctionObject/probesFunctionObject.C
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ $(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
|||||||
cuttingPlane/cuttingPlane.C
|
cuttingPlane/cuttingPlane.C
|
||||||
|
|
||||||
sampledSurface/sampledPatch/sampledPatch.C
|
sampledSurface/sampledPatch/sampledPatch.C
|
||||||
|
sampledSurface/sampledPatchInternalField/sampledPatchInternalField.C
|
||||||
sampledSurface/sampledPlane/sampledPlane.C
|
sampledSurface/sampledPlane/sampledPlane.C
|
||||||
sampledSurface/isoSurface/isoSurface.C
|
sampledSurface/isoSurface/isoSurface.C
|
||||||
sampledSurface/isoSurface/sampledIsoSurface.C
|
sampledSurface/isoSurface/sampledIsoSurface.C
|
||||||
|
|||||||
@ -33,6 +33,7 @@ Description
|
|||||||
#define IOprobes_H
|
#define IOprobes_H
|
||||||
|
|
||||||
#include "probes.H"
|
#include "probes.H"
|
||||||
|
#include "patchProbes.H"
|
||||||
#include "IOOutputFilter.H"
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -40,6 +41,7 @@ Description
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef IOOutputFilter<probes> IOprobes;
|
typedef IOOutputFilter<probes> IOprobes;
|
||||||
|
typedef IOOutputFilter<patchProbes> IOpatchProbes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
162
src/sampling/probes/patchProbes.C
Normal file
162
src/sampling/probes/patchProbes.C
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "patchProbes.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "IOmanip.H"
|
||||||
|
#include "directMappedPatchBase.C"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(patchProbes, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::patchProbes::findElements(const fvMesh& mesh)
|
||||||
|
{
|
||||||
|
|
||||||
|
elementList_.clear();
|
||||||
|
elementList_.setSize(size());
|
||||||
|
// All the info for nearest. Construct to miss
|
||||||
|
List<nearInfo> nearest(this->size());
|
||||||
|
|
||||||
|
// Octree based search engine
|
||||||
|
meshSearch meshSearchEngine(mesh, false);
|
||||||
|
|
||||||
|
forAll(*this, probeI)
|
||||||
|
{
|
||||||
|
const vector& sample = operator[](probeI);
|
||||||
|
label faceI = meshSearchEngine.findNearestBoundaryFace(sample);
|
||||||
|
if (faceI == -1)
|
||||||
|
{
|
||||||
|
nearest[probeI].second().first() = Foam::sqr(GREAT);
|
||||||
|
nearest[probeI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const point& fc = mesh.faceCentres()[faceI];
|
||||||
|
nearest[probeI].first() = pointIndexHit
|
||||||
|
(
|
||||||
|
true,
|
||||||
|
fc,
|
||||||
|
faceI
|
||||||
|
);
|
||||||
|
nearest[probeI].second().first() = magSqr(fc-sample);
|
||||||
|
nearest[probeI].second().second() = Pstream::myProcNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Find nearest.
|
||||||
|
Pstream::listCombineGather(nearest, nearestEqOp());
|
||||||
|
Pstream::listCombineScatter(nearest);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "patchProbes::findElements" << " : " << endl;
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
label procI = nearest[sampleI].second().second();
|
||||||
|
label localI = nearest[sampleI].first().index();
|
||||||
|
|
||||||
|
Info<< " " << sampleI << " coord:"<< operator[](sampleI)
|
||||||
|
<< " found on processor:" << procI
|
||||||
|
<< " in local cell/face:" << localI
|
||||||
|
<< " with cc:" << nearest[sampleI].first().rawPoint() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Check if all patchProbes have been found.
|
||||||
|
forAll(nearest, sampleI)
|
||||||
|
{
|
||||||
|
label localI = nearest[sampleI].first().index();
|
||||||
|
|
||||||
|
if (localI == -1)
|
||||||
|
{
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
WarningIn("patchProbes::findElements()")
|
||||||
|
<< "Did not find location "
|
||||||
|
<< nearest[sampleI].second().first()
|
||||||
|
<< " in any cell. Skipping location." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elementList_[sampleI] = localI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::patchProbes::patchProbes
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
probes(name, obr, dict, loadFromFiles)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::patchProbes::~patchProbes()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::patchProbes::write()
|
||||||
|
{
|
||||||
|
if (this->size() && prepare())
|
||||||
|
{
|
||||||
|
sampleAndWrite(scalarFields_);
|
||||||
|
sampleAndWrite(vectorFields_);
|
||||||
|
sampleAndWrite(sphericalTensorFields_);
|
||||||
|
sampleAndWrite(symmTensorFields_);
|
||||||
|
sampleAndWrite(tensorFields_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Foam::patchProbes::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
probes::read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
152
src/sampling/probes/patchProbes.H
Normal file
152
src/sampling/probes/patchProbes.H
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::patchProbes
|
||||||
|
|
||||||
|
Description
|
||||||
|
Set of locations to sample.at patches
|
||||||
|
|
||||||
|
Call write() to sample and write files.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
patchProbes.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef patchProbes_H
|
||||||
|
#define patchProbes_H
|
||||||
|
|
||||||
|
#include "HashPtrTable.H"
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "polyMesh.H"
|
||||||
|
#include "pointField.H"
|
||||||
|
#include "volFieldsFwd.H"
|
||||||
|
#include "probes.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class fvMesh;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class patchProbes Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class patchProbes
|
||||||
|
:
|
||||||
|
public probes
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Sample and write a particular volume field
|
||||||
|
template<class Type>
|
||||||
|
void sampleAndWrite
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Sample and write all the fields of the given type
|
||||||
|
template <class Type>
|
||||||
|
void sampleAndWrite(const fieldGroup<Type>&);
|
||||||
|
|
||||||
|
|
||||||
|
//- Sample a volume field at all locations
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type> > sample
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>&
|
||||||
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Sample a single field on all sample locations
|
||||||
|
template <class Type>
|
||||||
|
tmp<Field<Type> > sample(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
patchProbes(const patchProbes&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const patchProbes&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("patchProbes");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
patchProbes
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~patchProbes();
|
||||||
|
|
||||||
|
//- Public members
|
||||||
|
|
||||||
|
//- Sample and write
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Read
|
||||||
|
virtual void read(const dictionary&);
|
||||||
|
|
||||||
|
//- Find elements containing patchProbes
|
||||||
|
virtual void findElements(const fvMesh&);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "patchProbesTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
162
src/sampling/probes/patchProbesTemplates.C
Normal file
162
src/sampling/probes/patchProbesTemplates.C
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "patchProbes.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "IOmanip.H"
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::patchProbes::sampleAndWrite
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Field<Type> values = sample(vField);
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
unsigned int w = IOstream::defaultPrecision() + 7;
|
||||||
|
OFstream& probeStream = *probeFilePtrs_[vField.name()];
|
||||||
|
|
||||||
|
probeStream << setw(w) << vField.time().value();
|
||||||
|
|
||||||
|
forAll(values, probeI)
|
||||||
|
{
|
||||||
|
probeStream << ' ' << setw(w) << values[probeI];
|
||||||
|
}
|
||||||
|
probeStream << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
void Foam::patchProbes::sampleAndWrite
|
||||||
|
(
|
||||||
|
const fieldGroup<Type>& fields
|
||||||
|
)
|
||||||
|
{
|
||||||
|
forAll(fields, fieldI)
|
||||||
|
{
|
||||||
|
if (loadFromFiles_)
|
||||||
|
{
|
||||||
|
sampleAndWrite
|
||||||
|
(
|
||||||
|
GeometricField<Type, fvPatchField, volMesh>
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fields[fieldI],
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
mesh_
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectRegistry::const_iterator iter = mesh_.find(fields[fieldI]);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
iter != objectRegistry::end()
|
||||||
|
&& iter()->type()
|
||||||
|
== GeometricField<Type, fvPatchField, volMesh>::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
sampleAndWrite
|
||||||
|
(
|
||||||
|
mesh_.lookupObject
|
||||||
|
<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
fields[fieldI]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::patchProbes::sample
|
||||||
|
(
|
||||||
|
const GeometricField<Type, fvPatchField, volMesh>& vField
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const Type unsetVal(-VGREAT*pTraits<Type>::one);
|
||||||
|
|
||||||
|
tmp<Field<Type> > tValues
|
||||||
|
(
|
||||||
|
new Field<Type>(this->size(), unsetVal)
|
||||||
|
);
|
||||||
|
|
||||||
|
Field<Type>& values = tValues();
|
||||||
|
|
||||||
|
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||||
|
|
||||||
|
forAll(*this, probeI)
|
||||||
|
{
|
||||||
|
label faceI = elementList_[probeI];
|
||||||
|
|
||||||
|
if (faceI >= 0)
|
||||||
|
{
|
||||||
|
label patchI = patches.whichPatch(faceI);
|
||||||
|
label localFaceI = patches[patchI].whichFace(faceI);
|
||||||
|
values[probeI] = vField.boundaryField()[patchI][localFaceI];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Pstream::listCombineGather(values, isNotEqOp<Type>());
|
||||||
|
Pstream::listCombineScatter(values);
|
||||||
|
|
||||||
|
return tValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::tmp<Foam::Field<Type> >
|
||||||
|
Foam::patchProbes::sample(const word& fieldName) const
|
||||||
|
{
|
||||||
|
return sample
|
||||||
|
(
|
||||||
|
mesh_.lookupObject<GeometricField<Type, fvPatchField, volMesh> >
|
||||||
|
(
|
||||||
|
fieldName
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -36,30 +36,30 @@ defineTypeNameAndDebug(Foam::probes, 0);
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::probes::findCells(const fvMesh& mesh)
|
void Foam::probes::findElements(const fvMesh& mesh)
|
||||||
{
|
{
|
||||||
cellList_.clear();
|
elementList_.clear();
|
||||||
cellList_.setSize(size());
|
elementList_.setSize(size());
|
||||||
|
|
||||||
forAll(*this, probeI)
|
forAll(*this, probeI)
|
||||||
{
|
{
|
||||||
const vector& location = operator[](probeI);
|
const vector& location = operator[](probeI);
|
||||||
|
|
||||||
cellList_[probeI] = mesh.findCell(location);
|
elementList_[probeI] = mesh.findCell(location);
|
||||||
|
|
||||||
if (debug && cellList_[probeI] != -1)
|
if (debug && elementList_[probeI] != -1)
|
||||||
{
|
{
|
||||||
Pout<< "probes : found point " << location
|
Pout<< "probes : found point " << location
|
||||||
<< " in cell " << cellList_[probeI] << endl;
|
<< " in cell " << elementList_[probeI] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check if all probes have been found.
|
// Check if all probes have been found.
|
||||||
forAll(cellList_, probeI)
|
forAll(elementList_, probeI)
|
||||||
{
|
{
|
||||||
const vector& location = operator[](probeI);
|
const vector& location = operator[](probeI);
|
||||||
label cellI = cellList_[probeI];
|
label cellI = elementList_[probeI];
|
||||||
|
|
||||||
// Check at least one processor with cell.
|
// Check at least one processor with cell.
|
||||||
reduce(cellI, maxOp<label>());
|
reduce(cellI, maxOp<label>());
|
||||||
@ -76,12 +76,12 @@ void Foam::probes::findCells(const fvMesh& mesh)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Make sure location not on two domains.
|
// Make sure location not on two domains.
|
||||||
if (cellList_[probeI] != -1 && cellList_[probeI] != cellI)
|
if (elementList_[probeI] != -1 && elementList_[probeI] != cellI)
|
||||||
{
|
{
|
||||||
WarningIn("probes::read()")
|
WarningIn("probes::read()")
|
||||||
<< "Location " << location
|
<< "Location " << location
|
||||||
<< " seems to be on multiple domains:"
|
<< " seems to be on multiple domains:"
|
||||||
<< " cell " << cellList_[probeI]
|
<< " cell " << elementList_[probeI]
|
||||||
<< " on my domain " << Pstream::myProcNo()
|
<< " on my domain " << Pstream::myProcNo()
|
||||||
<< " and cell " << cellI << " on some other domain."
|
<< " and cell " << cellI << " on some other domain."
|
||||||
<< endl
|
<< endl
|
||||||
@ -249,7 +249,7 @@ void Foam::probes::read(const dictionary& dict)
|
|||||||
dict.lookup("fields") >> fieldSelection_;
|
dict.lookup("fields") >> fieldSelection_;
|
||||||
|
|
||||||
// redetermined all cell locations
|
// redetermined all cell locations
|
||||||
findCells(mesh_);
|
findElements(mesh_);
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,9 @@ class probes
|
|||||||
:
|
:
|
||||||
public pointField
|
public pointField
|
||||||
{
|
{
|
||||||
// Private classes
|
protected:
|
||||||
|
|
||||||
|
// Protected classes
|
||||||
|
|
||||||
//- Class used for grouping field types
|
//- Class used for grouping field types
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -110,7 +112,7 @@ class probes
|
|||||||
fieldGroup<tensor> tensorFields_;
|
fieldGroup<tensor> tensorFields_;
|
||||||
|
|
||||||
// Cells to be probed (obtained from the locations)
|
// Cells to be probed (obtained from the locations)
|
||||||
labelList cellList_;
|
labelList elementList_;
|
||||||
|
|
||||||
//- Current open files
|
//- Current open files
|
||||||
HashPtrTable<OFstream> probeFilePtrs_;
|
HashPtrTable<OFstream> probeFilePtrs_;
|
||||||
@ -128,12 +130,14 @@ class probes
|
|||||||
label classifyFields();
|
label classifyFields();
|
||||||
|
|
||||||
//- Find cells containing probes
|
//- Find cells containing probes
|
||||||
void findCells(const fvMesh&);
|
virtual void findElements(const fvMesh&);
|
||||||
|
|
||||||
//- Classify field type and Open/close file streams,
|
//- Classify field type and Open/close file streams,
|
||||||
// returns number of fields
|
// returns number of fields
|
||||||
label prepare();
|
label prepare();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
//- Sample and write a particular volume field
|
//- Sample and write a particular volume field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void sampleAndWrite
|
void sampleAndWrite
|
||||||
@ -202,9 +206,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Cells to be probed (obtained from the locations)
|
//- Cells to be probed (obtained from the locations)
|
||||||
const labelList& cells() const
|
const labelList& elemets() const
|
||||||
{
|
{
|
||||||
return cellList_;
|
return elementList_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Execute, currently does nothing
|
||||||
|
|||||||
@ -30,6 +30,7 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineNamedTemplateTypeNameAndDebug(probesFunctionObject, 0);
|
defineNamedTemplateTypeNameAndDebug(probesFunctionObject, 0);
|
||||||
|
defineNamedTemplateTypeNameAndDebug(patchProbesFunctionObject, 0);
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
addToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
@ -37,6 +38,12 @@ namespace Foam
|
|||||||
probesFunctionObject,
|
probesFunctionObject,
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
patchProbesFunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -37,6 +37,7 @@ SourceFiles
|
|||||||
#define probesFunctionObject_H
|
#define probesFunctionObject_H
|
||||||
|
|
||||||
#include "probes.H"
|
#include "probes.H"
|
||||||
|
#include "patchProbes.H"
|
||||||
#include "OutputFilterFunctionObject.H"
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -44,6 +45,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef OutputFilterFunctionObject<probes> probesFunctionObject;
|
typedef OutputFilterFunctionObject<probes> probesFunctionObject;
|
||||||
|
typedef OutputFilterFunctionObject<patchProbes> patchProbesFunctionObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -158,9 +158,9 @@ Foam::probes::sample
|
|||||||
|
|
||||||
forAll(*this, probeI)
|
forAll(*this, probeI)
|
||||||
{
|
{
|
||||||
if (cellList_[probeI] >= 0)
|
if (elementList_[probeI] >= 0)
|
||||||
{
|
{
|
||||||
values[probeI] = vField[cellList_[probeI]];
|
values[probeI] = vField[elementList_[probeI]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -157,6 +157,10 @@ void Foam::sampledPatch::remapFaces
|
|||||||
if (&faceMap && faceMap.size())
|
if (&faceMap && faceMap.size())
|
||||||
{
|
{
|
||||||
MeshStorage::remapFaces(faceMap);
|
MeshStorage::remapFaces(faceMap);
|
||||||
|
patchFaceLabels_ = labelList
|
||||||
|
(
|
||||||
|
UIndirectList<label>(patchFaceLabels_, faceMap)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
// Retrieve the neighbour patch internal field
|
||||||
Field<Type> nbrIntFld = nbrField.patchInternalField();
|
Field<Type> nbrIntFld = nbrField.patchInternalField();
|
||||||
mapDistribute::distribute
|
distMap.distribute(nbrIntFld);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(), // what to send
|
|
||||||
distMap.constructMap(), // what to receive
|
|
||||||
nbrIntFld
|
|
||||||
);
|
|
||||||
|
|
||||||
// Assign (this) patch internal field to its neighbour values
|
// Assign (this) patch internal field to its neighbour values
|
||||||
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
|
Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField());
|
||||||
|
|||||||
@ -222,27 +222,11 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
// Swap to obtain full local values of neighbour internal field
|
// Swap to obtain full local values of neighbour internal field
|
||||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||||
mapDistribute::distribute
|
distMap.distribute(nbrIntFld);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(), // what to send
|
|
||||||
distMap.constructMap(), // what to receive
|
|
||||||
nbrIntFld
|
|
||||||
);
|
|
||||||
|
|
||||||
// Swap to obtain full local values of neighbour K*delta
|
// Swap to obtain full local values of neighbour K*delta
|
||||||
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
||||||
mapDistribute::distribute
|
distMap.distribute(nbrKDelta);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(), // what to send
|
|
||||||
distMap.constructMap(), // what to receive
|
|
||||||
nbrKDelta
|
|
||||||
);
|
|
||||||
|
|
||||||
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
||||||
|
|
||||||
@ -255,15 +239,7 @@ void Foam::turbulentTemperatureCoupledBaffleFvPatchScalarField::updateCoeffs()
|
|||||||
// Assign to me
|
// Assign to me
|
||||||
fvPatchScalarField::operator=(Twall);
|
fvPatchScalarField::operator=(Twall);
|
||||||
// Distribute back and assign to neighbour
|
// Distribute back and assign to neighbour
|
||||||
mapDistribute::distribute
|
distMap.reverseDistribute(nbrField.size(), Twall);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
nbrField.size(),
|
|
||||||
distMap.constructMap(), // reverse : what to send
|
|
||||||
distMap.subMap(),
|
|
||||||
Twall
|
|
||||||
);
|
|
||||||
const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&>
|
const_cast<turbulentTemperatureCoupledBaffleFvPatchScalarField&>
|
||||||
(
|
(
|
||||||
nbrField
|
nbrField
|
||||||
|
|||||||
@ -179,27 +179,11 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
// Swap to obtain full local values of neighbour internal field
|
// Swap to obtain full local values of neighbour internal field
|
||||||
scalarField nbrIntFld = nbrField.patchInternalField();
|
scalarField nbrIntFld = nbrField.patchInternalField();
|
||||||
mapDistribute::distribute
|
distMap.distribute(nbrIntFld);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(), // what to send
|
|
||||||
distMap.constructMap(), // what to receive
|
|
||||||
nbrIntFld
|
|
||||||
);
|
|
||||||
|
|
||||||
// Swap to obtain full local values of neighbour K*delta
|
// Swap to obtain full local values of neighbour K*delta
|
||||||
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
scalarField nbrKDelta = nbrField.K(nbrField)*nbrPatch.deltaCoeffs();
|
||||||
mapDistribute::distribute
|
distMap.distribute(nbrKDelta);
|
||||||
(
|
|
||||||
Pstream::defaultCommsType,
|
|
||||||
distMap.schedule(),
|
|
||||||
distMap.constructSize(),
|
|
||||||
distMap.subMap(), // what to send
|
|
||||||
distMap.constructMap(), // what to receive
|
|
||||||
nbrKDelta
|
|
||||||
);
|
|
||||||
|
|
||||||
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
tmp<scalarField> myKDelta = K(*this)*patch().deltaCoeffs();
|
||||||
|
|
||||||
|
|||||||
@ -42,47 +42,34 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
{
|
{
|
||||||
label nD = mesh().nGeometricD();
|
label nD = mesh().nGeometricD();
|
||||||
|
|
||||||
|
volScalarField delta
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"delta",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimLength, SMALL),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
|
||||||
|
|
||||||
// initialise hwn as wall distance
|
// initialise hwn as wall distance
|
||||||
volScalarField hwn = wallDist(mesh()).y();
|
volScalarField hwn = wallDist(mesh()).y();
|
||||||
|
|
||||||
scalar deltamaxTmp = 0.;
|
|
||||||
|
|
||||||
const cellList& cells = mesh().cells();
|
|
||||||
|
|
||||||
forAll(cells,cellI)
|
|
||||||
{
|
|
||||||
scalar deltaminTmp = 1.e10;
|
|
||||||
const labelList& cFaces = mesh().cells()[cellI];
|
|
||||||
const point& centrevector = mesh().cellCentres()[cellI];
|
|
||||||
|
|
||||||
forAll(cFaces, cFaceI)
|
|
||||||
{
|
|
||||||
label faceI = cFaces[cFaceI];
|
|
||||||
const point& facevector = mesh().faceCentres()[faceI];
|
|
||||||
scalar tmp = mag(facevector - centrevector);
|
|
||||||
|
|
||||||
if (tmp > deltamaxTmp)
|
|
||||||
{
|
|
||||||
deltamaxTmp = tmp;
|
|
||||||
}
|
|
||||||
if (tmp < deltaminTmp)
|
|
||||||
{
|
|
||||||
deltaminTmp = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hwn[cellI] = 2.0*deltaminTmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
dimensionedScalar deltamax("deltamax",dimLength,2.0*deltamaxTmp);
|
|
||||||
|
|
||||||
if (nD == 3)
|
if (nD == 3)
|
||||||
{
|
{
|
||||||
delta_.internalField() =
|
delta_.internalField() =
|
||||||
deltaCoeff_
|
deltaCoeff_
|
||||||
*min
|
*min
|
||||||
(
|
(
|
||||||
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn),
|
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
||||||
deltamax
|
delta
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (nD == 2)
|
else if (nD == 2)
|
||||||
@ -95,8 +82,8 @@ void Foam::IDDESDelta::calcDelta()
|
|||||||
deltaCoeff_
|
deltaCoeff_
|
||||||
*min
|
*min
|
||||||
(
|
(
|
||||||
max(max(cw_*wallDist(mesh()).y(), cw_*deltamax), hwn),
|
max(max(cw_*wallDist(mesh()).y(), cw_*delta), hwn),
|
||||||
deltamax
|
delta
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -44,9 +44,26 @@ addToRunTimeSelectionTable(LESModel, SpalartAllmarasIDDES, dictionary);
|
|||||||
|
|
||||||
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
|
tmp<volScalarField> SpalartAllmarasIDDES::alpha() const
|
||||||
{
|
{
|
||||||
|
volScalarField delta
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"delta",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar("zero", dimLength, SMALL),
|
||||||
|
calculatedFvPatchScalarField::typeName
|
||||||
|
);
|
||||||
|
|
||||||
|
delta.internalField() = pow(mesh_.V(), 1.0/3.0);
|
||||||
|
|
||||||
return max
|
return max
|
||||||
(
|
(
|
||||||
0.25 - y_/dimensionedScalar("hMax", dimLength, max(cmptMax(delta()))),
|
0.25 - y_/delta,
|
||||||
scalar(-5)
|
scalar(-5)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,80 +0,0 @@
|
|||||||
0.000625 0.001
|
|
||||||
0.001875 0.001
|
|
||||||
0.003125 0.001
|
|
||||||
0.004375 0.001
|
|
||||||
0.005625 0.001
|
|
||||||
0.006875 0.001
|
|
||||||
0.008125 0.001
|
|
||||||
0.009375 0.001
|
|
||||||
0.010625 0.001
|
|
||||||
0.011875 0.001
|
|
||||||
0.013125 0.001
|
|
||||||
0.014375 0.001
|
|
||||||
0.015625 0.001
|
|
||||||
0.016875 0.001
|
|
||||||
0.018125 0.001
|
|
||||||
0.019375 0.001
|
|
||||||
0.020625 0.001
|
|
||||||
0.021875 0.001
|
|
||||||
0.023125 0.001
|
|
||||||
0.024375 0.001
|
|
||||||
0.025625 0.001
|
|
||||||
0.026875 0.001
|
|
||||||
0.028125 0.001
|
|
||||||
0.029375 0.001
|
|
||||||
0.030625 0.001
|
|
||||||
0.031875 0.001
|
|
||||||
0.033125 0.001
|
|
||||||
0.034375 0.001
|
|
||||||
0.035625 0.001
|
|
||||||
0.036875 0.001
|
|
||||||
0.038125 0.001
|
|
||||||
0.039375 0.001
|
|
||||||
0.040625 0.001
|
|
||||||
0.041875 0.001
|
|
||||||
0.043125 0.001
|
|
||||||
0.044375 0.001
|
|
||||||
0.045625 0.001
|
|
||||||
0.046875 0.001
|
|
||||||
0.048125 0.001
|
|
||||||
0.049375 0.001
|
|
||||||
0.050625 0.001
|
|
||||||
0.051875 0.001
|
|
||||||
0.053125 0.001
|
|
||||||
0.054375 0.001
|
|
||||||
0.055625 0.001
|
|
||||||
0.056875 0.001
|
|
||||||
0.058125 0.001
|
|
||||||
0.059375 0.001
|
|
||||||
0.060625 0.001
|
|
||||||
0.061875 0.001
|
|
||||||
0.063125 0.001
|
|
||||||
0.064375 0.001
|
|
||||||
0.065625 0.001
|
|
||||||
0.066875 0.001
|
|
||||||
0.068125 0.001
|
|
||||||
0.069375 0.001
|
|
||||||
0.070625 0.001
|
|
||||||
0.071875 0.001
|
|
||||||
0.073125 0.001
|
|
||||||
0.074375 0.001
|
|
||||||
0.075625 0.001
|
|
||||||
0.076875 0.001
|
|
||||||
0.078125 0.001
|
|
||||||
0.079375 0.001
|
|
||||||
0.080625 0.001
|
|
||||||
0.081875 0.001
|
|
||||||
0.083125 0.001
|
|
||||||
0.084375 0.001
|
|
||||||
0.085625 0.001
|
|
||||||
0.086875 0.001
|
|
||||||
0.088125 0.001
|
|
||||||
0.089375 0.001
|
|
||||||
0.090625 0.001
|
|
||||||
0.091875 0.001
|
|
||||||
0.093125 0.001
|
|
||||||
0.094375 0.001
|
|
||||||
0.095625 0.001
|
|
||||||
0.096875 0.001
|
|
||||||
0.098125 0.001
|
|
||||||
0.099375 0.001
|
|
||||||
@ -47,11 +47,5 @@ runTimeModifiable true;
|
|||||||
|
|
||||||
graphFormat raw;
|
graphFormat raw;
|
||||||
|
|
||||||
libs
|
|
||||||
(
|
|
||||||
"libOpenFOAM.so"
|
|
||||||
"libinterpolationTables_16x.so"
|
|
||||||
"libtabulatedWallFunctionFvPatchFields_16x.so"
|
|
||||||
);
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -49,13 +49,6 @@ adjustTimeStep yes;
|
|||||||
|
|
||||||
maxCo 5;
|
maxCo 5;
|
||||||
|
|
||||||
libs
|
|
||||||
(
|
|
||||||
"libOpenFOAM.so"
|
|
||||||
"libinterpolationTables_16x.so"
|
|
||||||
"libtabulatedWallFunctionFvPatchFields_16x.so"
|
|
||||||
);
|
|
||||||
|
|
||||||
functions
|
functions
|
||||||
{
|
{
|
||||||
probes
|
probes
|
||||||
|
|||||||
@ -24,6 +24,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type directMapped;
|
type directMapped;
|
||||||
value uniform (0 0 0 0 0 0 0 0 0);
|
value uniform (0 0 0 0 0 0 0 0 0);
|
||||||
|
interpolationScheme cell;
|
||||||
setAverage false;
|
setAverage false;
|
||||||
average (0 0 0 0 0 0 0 0 0);
|
average (0 0 0 0 0 0 0 0 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type directMapped;
|
type directMapped;
|
||||||
value uniform (10 0 0);
|
value uniform (10 0 0);
|
||||||
|
interpolationScheme cell;
|
||||||
setAverage true;
|
setAverage true;
|
||||||
average (10 0 0);
|
average (10 0 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type directMapped;
|
type directMapped;
|
||||||
value uniform 2e-05;
|
value uniform 2e-05;
|
||||||
|
interpolationScheme cell;
|
||||||
setAverage false;
|
setAverage false;
|
||||||
average 2e-05;
|
average 2e-05;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ boundaryField
|
|||||||
{
|
{
|
||||||
type directMapped;
|
type directMapped;
|
||||||
value uniform 0;
|
value uniform 0;
|
||||||
|
interpolationScheme cell;
|
||||||
setAverage false;
|
setAverage false;
|
||||||
average 0;
|
average 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
c++WARN = -wd327,654,819,1125,1476,1505,1572
|
c++WARN = -wd327,654,819,1125,1476,1505,1572
|
||||||
|
|
||||||
CC = icpc
|
CC = icpc -std=c++0x
|
||||||
|
|
||||||
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
c++DBUG =
|
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
|
c++WARN = -wd327,654,819,1125,1476,1505,1572
|
||||||
|
|
||||||
#CC = icpc -gcc-version=400
|
#CC = icpc -gcc-version=400
|
||||||
CC = icpc
|
CC = icpc -std=c++0x
|
||||||
|
|
||||||
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
include $(RULES)/c++$(WM_COMPILE_OPTION)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user