mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -38,7 +38,24 @@ Foam::label Foam::PatchInjection<CloudType>::parcelsToInject
|
|||||||
{
|
{
|
||||||
if ((time0 >= 0.0) && (time0 < duration_))
|
if ((time0 >= 0.0) && (time0 < duration_))
|
||||||
{
|
{
|
||||||
return round(fraction_*(time1 - time0)*parcelsPerSecond_);
|
scalar nParcels =fraction_*(time1 - time0)*parcelsPerSecond_;
|
||||||
|
|
||||||
|
cachedRandom& rnd = this->owner().rndGen();
|
||||||
|
|
||||||
|
label nParcelsToInject = floor(nParcels);
|
||||||
|
|
||||||
|
// Inject an additional parcel with a probability based on the
|
||||||
|
// remainder after the floor function
|
||||||
|
if
|
||||||
|
(
|
||||||
|
nParcelsToInject > 0
|
||||||
|
&& (nParcels - scalar(nParcelsToInject) > rnd.position(0.0, 1.0))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nParcelsToInject;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nParcelsToInject;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -173,6 +190,7 @@ void Foam::PatchInjection<CloudType>::setPositionAndCell
|
|||||||
if (cellOwners_.size() > 0)
|
if (cellOwners_.size() > 0)
|
||||||
{
|
{
|
||||||
cachedRandom& rnd = this->owner().rndGen();
|
cachedRandom& rnd = this->owner().rndGen();
|
||||||
|
|
||||||
label cellI = rnd.position<label>(0, cellOwners_.size() - 1);
|
label cellI = rnd.position<label>(0, cellOwners_.size() - 1);
|
||||||
|
|
||||||
cellOwner = cellOwners_[cellI];
|
cellOwner = cellOwners_[cellI];
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -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]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user