40 namespace functionObjects
55 Foam::fileName Foam::functionObjects::patchCutLayerAverage::outputPath()
const
66 void Foam::functionObjects::patchCutLayerAverage::calcWeights()
68 const polyPatch& pp = mesh_.poly().boundary()[patchName_];
72 tmp<scalarField> tpointXs =
81 : tmp<pointScalarField>
85 )().boundaryField()[pp.index()].patchInternalField();
96 interpolate_ ? nLayers_ : nLayers_ + 1,
125 const SubField<scalar> distance0s(cutXs, nLayers_);
126 const SubField<scalar> distance1s(cutXs, nLayers_, 1);
127 layerDistances_.reset(((distance0s + distance1s)/2).ptr());
128 layerThicknesses_.reset((distance1s - distance0s).ptr());
132 layerPositions_.reset
163 void Foam::functionObjects::patchCutLayerAverage::clear()
166 layerDistances_.clear();
167 layerThicknesses_.clear();
168 layerPositions_.clear();
197 patchName_ =
dict.lookup<
word>(
"patch");
199 const bool haveDirection =
dict.found(
"direction");
200 const bool haveDistance =
dict.found(
"distance");
201 if (haveDirection == haveDistance)
204 <<
"keywords direction and distance both "
205 << (haveDirection ?
"" :
"un") <<
"defined in "
206 <<
"dictionary " <<
dict.name()
209 else if (haveDirection)
214 else if (haveDistance)
217 distanceName_ =
dict.lookup<
word>(
"distance");
220 nLayers_ =
dict.lookup<
label>(
"nPoints");
222 interpolate_ =
dict.lookupOrDefault<
bool>(
"interpolate",
false);
238 nOptimiseIter_ =
dict.lookupOrDefault(
"nOptimiseIter", 2);
252 result.
append(distanceName_);
267 if (!weights_.valid())
272 const polyPatch& pp = mesh_.poly().boundary()[patchName_];
274 const bool writeThickness =
302 cannotFindObject(fields_[fieldi]);
307 #define DeclareTypeFieldValues(Type, nullArg) \
308 PtrList<Field<Type>> Type##FieldValues(fieldNames.size());
310 #undef DeclareTypeFieldValues
313 scalarFieldValues.set(0,
new scalarField(layerThicknesses_));
317 #define CollapseTypeFields(Type, nullArg) \
318 if (mesh_.foundObject<VolField<Type>>(fieldNames[fieldi])) \
320 const VolField<Type>& field = \
321 mesh_.lookupObject<VolField<Type>>(fieldNames[fieldi]); \
323 Type##FieldValues.set \
326 cutPlot::applyWeights \
330 field.boundaryField()[pp.index()] \
335 #undef CollapseTypeFields
384 if (&map.
mesh() == &mesh_)
396 if (&map.
mesh() == &mesh_)
408 if (&map.
mesh() == &mesh_)
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
static volPointInterpolation & New(const word &name, const fvMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Generic GeometricField class.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
fileName globalPath() const
Return the global path.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static bool master(const label communicator=0)
Am I the master process.
Holds list of sampling positions.
static const NamedEnum< axisType, 6 > axisTypeNames_
String representation of axis enums.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
const word & name() const
Return const reference to name.
A class for handling file names.
Abstract base-class for Time/database functionObjects.
const Time & time_
Reference to time.
const word & name() const
Return the name of this functionObject.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
This function object writes graphs of patch face values, area-averaged in planes perpendicular to a g...
patchCutLayerAverage(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual wordList fields() const
Return the list of fields required.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual ~patchCutLayerAverage()
Destructor.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual void movePoints(const polyMesh &)
Update for mesh point-motion.
virtual bool execute()
Execute, currently does nothing.
virtual bool write()
Write the patchCutLayerAverage.
virtual bool read(const dictionary &)
Read the patchCutLayerAverage data.
static const word outputPrefix
Directory prefix.
const word & name() const
Return reference to name.
Motion of the mesh specified as a list of pointMeshMovers.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
const polyMesh & mesh() const
Return polyMesh.
Class containing mesh-to-mesh mapping information.
const polyMesh & mesh() const
Return polyMesh.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
A patch is a list of labels that address the faces in the global face list.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const
Return polyMesh.
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
tmp< PointField< Type > > interpolate(const VolField< Type > &) const
Interpolate volField using inverse distance weighting.
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static List< word > fieldNames
List< weight > calcWeights(const polyMesh &mesh, const generatedCellZone &zone, const scalarField &pointXs, const scalarField &cellMinXs, const scalarField &cellMaxXs, const labelList &cellMinOrder, const scalarField &cutXs, const bool interpolate, const bool normalise)
tmp< Field< Type > > applyWeights(const label n, const List< cutPlot::weight > &weights, const Field< Type > &cellValues)
Construct plot values from cell values given a set of weights.
defineTypeNameAndDebug(fvMeshFunctionObject, 0)
addToRunTimeSelectionTable(functionObject, fvModel, dictionary)
void writeLayers(const SubList< face > &faces, const List< patchCutPlot::weight > &weights, const word &functionName, const fvMesh &functionMesh)
Write the layers as components of a tensor field for debugging.
List< weight > calcWeights(const faceList &faces, const UList< vector > &faceAreas, const UList< vector > &faceNormals, const pointField &points, const scalarField &pointXs, const scalarField &faceMinXs, const scalarField &faceMaxXs, const labelList &faceMinOrder, const scalarField &cutXs, const bool interpolate, const bool normalise)
tmp< scalarField > calcCutXs(const faceList &faces, const Field< vector > &faceAreas, const Field< vector > &faceNormals, const pointField &points, const scalarField &pointXs, const bool interpolate, const label nCuts, const label nIter, const bool debug=false, const word &functionName=word::null, const polyMesh &functionMesh=NullObjectRef< polyMesh >(), const setWriter &functionFormatter=NullObjectRef< setWriter >())
Compute and return evenly-spaced cut coordinates.
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PointField< scalar > pointScalarField
VolField< scalar > volScalarField
dimensionSet normalised(const dimensionSet &)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
#define TypeFieldValuesParameter(Type, nullArg)
#define FoundTypeField(Type, nullArg)
#define DeclareTypeFieldValues(Type, nullArg)
#define CollapseTypeFields(Type, nullArg)