38 namespace patchCutPlot
62 const label facei = faceMinOrder[i];
64 const scalar a = faceAreas[facei] & faceNormals[facei];
69 cuti < cutXs.
size() - 1
70 && faceMinXs[facei] > cutXs[cuti + 1]
80 cutj < cutXs.
size() - 1
81 && faceMaxXs[facei] > cutXs[cutj]
85 dynWeights.
append({facei, cutj, a});
88 if (faceMinXs[facei] < cutXs[cutj])
90 dynWeights.
last().value -=
105 ) & faceNormals[facei];
109 if (faceMaxXs[facei] > cutXs[cutj + 1])
111 dynWeights.
last().value -=
126 ) & faceNormals[facei];
143 cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
151 weights[weighti].value /=
152 (cutWeightSums[weights[weighti].cuti] + vSmall);
184 const label facei = faceMinOrder[i];
186 const scalar a = faceAreas[facei] & faceNormals[facei];
192 && faceMinXs[facei] > cutXs[cuti + 1]
203 && faceMaxXs[facei] > cutXs[
max(cutj - 1, 0)]
207 dynWeights.
append({facei, cutj, 0});
210 if (cutj > 0 && faceMinXs[facei] < cutXs[cutj])
214 forAll(faces[facei], facePointi)
216 const label pointi = faces[facei][facePointi];
218 (pointXs[pointi] - cutXs[cutj - 1])
219 /(cutXs[cutj] - cutXs[cutj - 1]);
230 dynWeights.
last().value += faceF*a;
233 if (faceMinXs[facei] < cutXs[cutj - 1])
235 dynWeights.
last().value -=
252 ).second() & faceNormals[facei];
256 if (faceMaxXs[facei] > cutXs[cutj])
258 dynWeights.
last().value -=
275 ).second() & faceNormals[facei];
280 if (cutj < cutXs.
size() - 1 && faceMaxXs[facei] > cutXs[cutj])
284 forAll(faces[facei], facePointi)
286 const label pointi = faces[facei][facePointi];
288 (cutXs[cutj + 1] - pointXs[pointi])
289 /(cutXs[cutj + 1] - cutXs[cutj]);
300 dynWeights.
last().value += faceF*a;
303 if (faceMinXs[facei] < cutXs[cutj])
305 dynWeights.
last().value -=
322 ).second() & faceNormals[facei];
326 if (faceMaxXs[facei] > cutXs[cutj + 1])
328 dynWeights.
last().value -=
345 ).second() & faceNormals[facei];
365 cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
373 weights[weighti].value /=
374 (cutWeightSums[weights[weighti].cuti] + vSmall);
383 weights[weighti].cuti == 0
384 || weights[weighti].cuti == cutXs.
size() - 1
387 weights[weighti].value *= 2;
456 forAll(faces[facei], facePointi)
458 const label pointi = faces[facei][facePointi];
459 faceMinXs[facei] =
min(faceMinXs[facei], pointXs[pointi]);
460 faceMaxXs[facei] =
max(faceMaxXs[facei], pointXs[pointi]);
512 forAll(faces[facei], facePointi)
514 const label pointi = faces[facei][facePointi];
515 faceMinXs[facei] =
min(faceMinXs[facei], pointXs[pointi]);
516 faceMaxXs[facei] =
max(faceMaxXs[facei], pointXs[pointi]);
530 cutXs.first() =
xMin;
536 #define DeclareTypeFieldValues(Type, nullArg) \
537 PtrList<Field<Type>> Type##FieldValues;
539 #undef DeclareTypeFieldValues
543 for (
label iteri = 0; iteri < nIter + debug; ++ iteri)
572 #define ResizeTypeFieldValues(Type, nullArg) \
573 Type##FieldValues.resize(nFields);
575 #undef ResizeTypeFieldValues
583 scalarFieldValues.set(nFields0, (distance0s + distance1s)/2);
586 scalarFieldValues.set(nFields0 + 1, distance1s - distance0s);
591 scalarFieldValues.set(nFields0,
new scalarField(cutXs));
595 scalarFieldValues.set(nFields - 1,
new scalarField(intervalCounts));
597 if (iteri == nIter)
break;
602 for (
label cuti = 0; cuti < nCuts - 1; ++ cuti)
604 cutSumCounts[cuti + 1] =
608 ? (intervalCounts[cuti + 1] + intervalCounts[cuti])/2
609 : intervalCounts[cuti]
614 const scalar intervalCount = cutSumCounts.
last()/(nCuts - 1);
619 cutXs.first() =
xMin;
621 for (
label cuti0 = 0; cuti0 < nCuts - 1; ++ cuti0)
626 && cutSumCounts[cuti0 + 1] > cuti*intervalCount
630 (cuti*intervalCount - cutSumCounts[cuti0])
631 /(cutSumCounts[cuti0 + 1] - cutSumCounts[cuti0]);
633 cutXs[cuti] = (1 -
f)*cut0Xs[cuti0] +
f*cut0Xs[cuti0 + 1];
645 /functionObjects::writeFile::outputPrefix
647 functionMesh.
name() != polyMesh::defaultRegion
648 ? functionMesh.
name()
656 functionFormatter.
write
679 const fvMesh& functionMesh
694 label meshFacei0 = -1;
697 if (&functionMesh.
faces()[meshFacei] == &faces[0])
699 meshFacei0 = meshFacei;
712 const label patchFacei =
726 const label patchFacei =
746 const fvMesh& functionMesh
769 const label patchFacei =
783 const label patchFacei =
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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Generic GeometricField class.
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const word & name() const
Return name.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
Pre-declare related SubField type.
A List obtained as a section of another List.
fileName globalPath() const
Return the global path.
A List with indirect addressing.
const List< label > & addressing() const
Return the list addressing.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
T & last()
Return the last element of the list.
Holds list of sampling positions.
Generic dimensioned Type class.
const word & name() const
Return const reference to name.
A class for handling file names.
A functionName is a word starting with '#'.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const polyMesh & poly() const
Return reference to polyMesh.
const Time & time() const
Return time.
const labelList & patchIndices() const
Boundary face patch indices.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
virtual const faceList & faces() const
Return raw faces.
label nInternalFaces() const
const scalarField & magFaceAreas() const
virtual bool write(const bool write=true) const
Write using setting from DB.
Base class for writing coordinate sets with data.
virtual void write(const fileName &outputDir, const fileName &setName, const coordSet &set, const wordList &valueSetNames #define TypeValueSetsConstArg(Type, nullArg)) const =0
Write a coordSet and associated data.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
#define FOR_ALL_FIELD_TYPES(Macro,...)
volScalarField scalarField(fieldObject, mesh)
static List< word > fieldNames
tmp< Field< Type > > applyWeights(const label n, const List< cellCutPlot::weight > &weights, const Field< Type > &cellValues)
Construct plot values from cell values given a set of weights.
Tuple2< vector, std::tuple< AreaIntegralType< Types > ... > > faceCutAreaIntegral(const face &f, const vector &fArea, const std::tuple< Types ... > &fPsis, const List< labelPair > &fCuts, const pointField &ps, const std::tuple< const Field< Types > &... > &pPsis, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the face-cut-area and face-cut-area-integral of the given properties.
vector faceCutArea(const face &f, const vector &fArea, const List< labelPair > &fCuts, const pointField &ps, const scalarField &pAlphas, const scalar isoAlpha, const bool below)
Compute the face-cut-area.
Tuple2< vector, std::tuple< Types ... > > faceAreaAverage(const FaceValues< point > &fPs, const point &fPAvg, const std::tuple< FaceValues< Types > ... > &fPsis, const std::tuple< Types ... > &fPsiAvgs)
Compute the face-area and face-area-averages of the given properties.
List< labelPair > faceCuts(const face &f, const scalarField &pAlphas, const scalar isoAlpha)
Return the cuts for a given face. This returns a list of pairs of.
const dimensionSet dimless
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
List< weight > calcNonInterpolatingWeights(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 normalise)
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 > calcInterpolatingWeights(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 normalise)
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.
Type gMin(const UList< Type > &f, const label comm)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< scalarField > linearSequence01(const label n)
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
quaternion normalise(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
#define TypeFieldValuesParameter(Type, nullArg)
#define DeclareTypeFieldValues(Type, nullArg)
#define ResizeTypeFieldValues(Type, nullArg)
Structure containing the weight for a given mesh element and cut index.
const label nIntervals(pdfDictionary.lookup< label >("nIntervals"))