37 namespace functionObjects
50 bool Foam::functionObjects::sampledSurfaces::verbose_ =
false;
51 Foam::scalar Foam::functionObjects::sampledSurfaces::mergeTol_ = 1
e-10;
77 outputPath_ = outputPath_/mesh_.name();
116 Pout<<
"Creating directory " 117 << outputPath_/mesh_.time().timeName() <<
nl <<
endl;
121 mkDir(outputPath_/mesh_.time().timeName());
128 #define FoundFieldType(Type, nullArg) \ 129 || foundObject<VolField<Type>>(fields_[fieldi]) \ 130 || foundObject<SurfaceField<Type>>(fields_[fieldi]) 133 fieldNames.append(fields_[fieldi]);
137 cannotFindObject(fields_[fieldi]);
139 #undef FoundFieldType 144 #define DeclareInterpolations(Type, nullArg) \ 145 HashPtrTable<interpolation<Type>> interpolation##Type##s; 147 #undef DeclareInterpolations 154 #define GenerateFieldTypeValues(Type, nullArg) \ 155 PtrList<Field<Type>> field##Type##Values = \ 156 sampleType<Type>(surfi, fieldNames, interpolation##Type##s); 158 #undef GenerateFieldTypeValues 165 && (mergeList_[surfi].faces.size() || writeEmpty_)
170 outputPath_/mesh_.time().timeName(),
172 mergeList_[surfi].points,
173 mergeList_[surfi].faces,
176 #define FieldTypeValuesParameter(Type, nullArg) \ 177 , field##Type##Values 179 #undef FieldTypeValuesParameter 189 outputPath_/mesh_.time().timeName(),
195 #define FieldTypeValuesParameter(Type, nullArg) \ 196 , field##Type##Values 198 #undef FieldTypeValuesParameter 211 bool surfacesFound = dict.
found(
"surfaces");
215 dict.
lookup(
"fields") >> fields_;
217 dict.
lookup(
"interpolationScheme") >> interpolationScheme_;
221 const word writeType(dict.
lookup(
"surfaceFormat"));
235 mergeList_.setSize(size());
243 Info<<
"Reading surface description:" <<
nl;
246 Info<<
" " << operator[](si).name() <<
nl;
254 Pout<<
"sample fields:" << fields_ <<
nl 255 <<
"sample surfaces:" <<
nl <<
"(" <<
nl;
259 Pout<<
" " << operator[](si) <<
endl;
295 if (&map.
mesh() == &mesh_)
329 if (
operator[](si).needsUpdate())
341 bool justExpired =
false;
345 if (
operator[](si).expire())
353 mergeList_[si].clear();
364 bool updated =
false;
376 if (
operator[](si).update())
386 scalar mergeDim = mergeTol_ * mesh_.bounds().mag();
390 Pout<<
nl <<
"Merging all points within " 391 << mergeDim <<
" metre" <<
endl;
416 mergeList_[si].faces,
417 mergeList_[si].pointsMap
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
virtual bool execute()
Execute, currently does nothing.
A list of keyword definitions, which are a keyword followed by any number of values (e...
An abstract class for surfaces with sampling.
const word & name() const
Name of surface.
#define DeclareInterpolations(Type, nullArg)
sampledSurfaces(const word &name, const Time &time, const dictionary &dict)
Construct from Time and dictionary.
void size(const label)
Override size to be inconsistent with allocated storage.
addToRunTimeSelectionTable(functionObject, Qdot, dictionary)
bool interpolate() const
Interpolation requested for surface.
static const fileName null
An empty fileName.
virtual bool needsUpdate() const
Does any of the surfaces need an update?
virtual wordList fields() const
Return the list of fields required.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion - expires the surfaces.
static bool master(const label communicator=0)
Am I the master process.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
static List< word > fieldNames
virtual const faceList & faces() const =0
Faces of surface.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A list of faces which address into the list of points.
A List obtained as a section of another List.
bool read(const char *, int32_t &)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
virtual bool write()
Sample and write.
static const word outputPrefix
Directory prefix.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
#define FieldTypeValuesParameter(Type, nullArg)
void append(const T &)
Append an element at the end of the list.
#define GenerateFieldTypeValues(Type, nullArg)
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
virtual ~sampledSurfaces()
Destructor.
static const word null
An empty word.
static autoPtr< surfaceWriter > New(const word &writeType, const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression)
Select given write options.
const polyMesh & mesh() const
Return polyMesh.
virtual bool update()=0
Update the surface as required.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map - expires the surfaces.
virtual bool expire()
Mark the surfaces as needing an update.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
word name(const complex &)
Return a string representation of a complex.
defineTypeNameAndDebug(Qdot, 0)
static bool & parRun()
Is this a parallel run?
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
void verbose(const bool verbosity=true)
Set verbosity level.
virtual bool update()
Update the surfaces as required and merge surface points (parallel).
virtual const pointField & points() const =0
Points of surface.
prefixOSstream Pout(cout, "Pout")
virtual bool read(const dictionary &)
Read the sampledSurfaces dictionary.
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
readUpdateState
Enumeration defining the state of the mesh after a read update.
Class containing mesh-to-mesh mapping information.
#define FoundFieldType(Type, nullArg)
virtual void readUpdate(const polyMesh::readUpdateState state)
Update topology using the given map due to readUpdate.
Class used for the PtrLists read-construction.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.