patchCutPlot.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "patchCutPlot.H"
27 #include "cutPolyIntegral.H"
28 #include "OSspecific.H"
29 #include "setWriter.H"
30 #include "SubField.H"
31 #include "volFields.H"
32 #include "writeFile.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 namespace patchCutPlot
39 {
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
44 (
45  const faceList& faces,
46  const UList<vector>& faceAreas,
47  const UList<vector>& faceNormals,
48  const pointField& points,
49  const scalarField& pointXs,
50  const scalarField& faceMinXs,
51  const scalarField& faceMaxXs,
52  const labelList& faceMinOrder,
53  const scalarField& cutXs,
54  const bool normalise
55 )
56 {
57  // Generate weights for each face in turn
58  DynamicList<weight> dynWeights(faces.size()*2);
59  label cuti = 0;
60  forAll(faceMinOrder, i)
61  {
62  const label facei = faceMinOrder[i];
63 
64  const scalar a = faceAreas[facei] & faceNormals[facei];
65 
66  // Find the next relevant cut
67  while
68  (
69  cuti < cutXs.size() - 1
70  && faceMinXs[facei] > cutXs[cuti + 1]
71  )
72  {
73  cuti ++;
74  }
75 
76  // Loop over all relevant cut intervals
77  label cutj = cuti;
78  while
79  (
80  cutj < cutXs.size() - 1
81  && faceMaxXs[facei] > cutXs[cutj]
82  )
83  {
84  // Add a new weight
85  dynWeights.append({facei, cutj, a});
86 
87  // Left interval
88  if (faceMinXs[facei] < cutXs[cutj])
89  {
90  dynWeights.last().value -=
92  (
93  faces[facei],
94  faceAreas[facei],
96  (
97  faces[facei],
98  pointXs,
99  cutXs[cutj]
100  ),
101  points,
102  pointXs,
103  cutXs[cutj],
104  true
105  ) & faceNormals[facei];
106  }
107 
108  // Right interval
109  if (faceMaxXs[facei] > cutXs[cutj + 1])
110  {
111  dynWeights.last().value -=
113  (
114  faces[facei],
115  faceAreas[facei],
117  (
118  faces[facei],
119  pointXs,
120  cutXs[cutj + 1]
121  ),
122  points,
123  pointXs,
124  cutXs[cutj + 1],
125  false
126  ) & faceNormals[facei];
127  }
128 
129  cutj ++;
130  }
131  }
132 
133  // Transfer to non-dynamic storage
134  List<weight> weights;
135  weights.transfer(dynWeights);
136 
137  // Normalise, if requested
138  if (normalise)
139  {
140  scalarField cutWeightSums(cutXs.size() - 1, scalar(0));
141  forAll(weights, weighti)
142  {
143  cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
144  }
145 
147  Pstream::listCombineScatter(cutWeightSums);
148 
149  forAll(weights, weighti)
150  {
151  weights[weighti].value /=
152  (cutWeightSums[weights[weighti].cuti] + vSmall);
153  }
154  }
155 
156  return weights;
157 }
158 
159 
161 (
162  const faceList& faces,
163  const UList<vector>& faceAreas,
164  const UList<vector>& faceNormals,
165  const pointField& points,
166  const scalarField& pointXs,
167  const scalarField& faceMinXs,
168  const scalarField& faceMaxXs,
169  const labelList& faceMinOrder,
170  const scalarField& cutXs,
171  const bool normalise
172 )
173 {
174  // Values of the (piecewise linear) interpolation basis function. Different
175  // for every interval. Is constantly being set on a sub-set of the
176  // currently relevant points in the loop below.
177  scalarField pointFs(points.size(), scalar(0));
178 
179  // Generate weights for each face in turn
180  DynamicList<weight> dynWeights(faces.size()*2);
181  label cuti = 0;
182  forAll(faceMinOrder, i)
183  {
184  const label facei = faceMinOrder[i];
185 
186  const scalar a = faceAreas[facei] & faceNormals[facei];
187 
188  // Find the next relevant cut
189  while
190  (
191  cuti < cutXs.size()
192  && faceMinXs[facei] > cutXs[cuti + 1]
193  )
194  {
195  cuti ++;
196  }
197 
198  // Loop over all relevant cuts
199  label cutj = cuti;
200  while
201  (
202  cutj < cutXs.size()
203  && faceMaxXs[facei] > cutXs[max(cutj - 1, 0)]
204  )
205  {
206  // Add a new weight
207  dynWeights.append({facei, cutj, 0});
208 
209  // Left interval
210  if (cutj > 0 && faceMinXs[facei] < cutXs[cutj])
211  {
212  // Update the basis function on the relevant points and
213  // calculate the area-average value on the face
214  forAll(faces[facei], facePointi)
215  {
216  const label pointi = faces[facei][facePointi];
217  pointFs[pointi] =
218  (pointXs[pointi] - cutXs[cutj - 1])
219  /(cutXs[cutj] - cutXs[cutj - 1]);
220  }
221  const scalar faceF =
223  (
224  faces[facei],
225  points,
226  pointFs
227  ).second();
228 
229  // Add the whole face's contribution
230  dynWeights.last().value += faceF*a;
231 
232  // Cut off anything before the left point
233  if (faceMinXs[facei] < cutXs[cutj - 1])
234  {
235  dynWeights.last().value -=
237  (
238  faces[facei],
239  faceAreas[facei],
240  faceF,
242  (
243  faces[facei],
244  pointXs,
245  cutXs[cutj - 1]
246  ),
247  points,
248  pointFs,
249  pointXs,
250  cutXs[cutj - 1],
251  true
252  ).second() & faceNormals[facei];
253  }
254 
255  // Cut off anything after the middle point
256  if (faceMaxXs[facei] > cutXs[cutj])
257  {
258  dynWeights.last().value -=
260  (
261  faces[facei],
262  faceAreas[facei],
263  faceF,
265  (
266  faces[facei],
267  pointXs,
268  cutXs[cutj]
269  ),
270  points,
271  pointFs,
272  pointXs,
273  cutXs[cutj],
274  false
275  ).second() & faceNormals[facei];
276  }
277  }
278 
279  // Right interval
280  if (cutj < cutXs.size() - 1 && faceMaxXs[facei] > cutXs[cutj])
281  {
282  // Update the basis function on the relevant points and
283  // calculate the area-average value on the face
284  forAll(faces[facei], facePointi)
285  {
286  const label pointi = faces[facei][facePointi];
287  pointFs[pointi] =
288  (cutXs[cutj + 1] - pointXs[pointi])
289  /(cutXs[cutj + 1] - cutXs[cutj]);
290  }
291  const scalar faceF =
293  (
294  faces[facei],
295  points,
296  pointFs
297  ).second();
298 
299  // Add the whole face's contribution
300  dynWeights.last().value += faceF*a;
301 
302  // Cut off anything before the middle point
303  if (faceMinXs[facei] < cutXs[cutj])
304  {
305  dynWeights.last().value -=
307  (
308  faces[facei],
309  faceAreas[facei],
310  faceF,
312  (
313  faces[facei],
314  pointXs,
315  cutXs[cutj]
316  ),
317  points,
318  pointFs,
319  pointXs,
320  cutXs[cutj],
321  true
322  ).second() & faceNormals[facei];
323  }
324 
325  // Cut off anything after the right point
326  if (faceMaxXs[facei] > cutXs[cutj + 1])
327  {
328  dynWeights.last().value -=
330  (
331  faces[facei],
332  faceAreas[facei],
333  faceF,
335  (
336  faces[facei],
337  pointXs,
338  cutXs[cutj + 1]
339  ),
340  points,
341  pointFs,
342  pointXs,
343  cutXs[cutj + 1],
344  false
345  ).second() & faceNormals[facei];
346  }
347  }
348 
349  cutj ++;
350  }
351  }
352 
353  // Transfer to non-dynamic storage
354  List<weight> weights;
355  weights.transfer(dynWeights);
356 
357  // Normalise, if requested. Otherwise, double the weight values on the ends
358  // to account for the fact that these points only have half a basis function
359  // contributing to their sums.
360  if (normalise)
361  {
362  scalarField cutWeightSums(cutXs.size(), scalar(0));
363  forAll(weights, weighti)
364  {
365  cutWeightSums[weights[weighti].cuti] += weights[weighti].value;
366  }
367 
369  Pstream::listCombineScatter(cutWeightSums);
370 
371  forAll(weights, weighti)
372  {
373  weights[weighti].value /=
374  (cutWeightSums[weights[weighti].cuti] + vSmall);
375  }
376  }
377  else
378  {
379  forAll(weights, weighti)
380  {
381  if
382  (
383  weights[weighti].cuti == 0
384  || weights[weighti].cuti == cutXs.size() - 1
385  )
386  {
387  weights[weighti].value *= 2;
388  }
389  }
390  }
391 
392  return weights;
393 }
394 
395 
397 (
398  const faceList& faces,
399  const UList<vector>& faceAreas,
400  const UList<vector>& faceNormals,
401  const pointField& points,
402  const scalarField& pointXs,
403  const scalarField& faceMinXs,
404  const scalarField& faceMaxXs,
405  const labelList& faceMinOrder,
406  const scalarField& cutXs,
407  const bool interpolate,
408  const bool normalise
409 )
410 {
411  return
412  (
416  )
417  (
418  faces,
419  faceAreas,
420  faceNormals,
421  points,
422  pointXs,
423  faceMinXs,
424  faceMaxXs,
425  faceMinOrder,
426  cutXs,
427  normalise
428  );
429 }
430 
431 
432 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
433 
434 } // End namespace patchCutPlot
435 } // End namespace Foam
436 
437 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
438 
440 (
441  const faceList& faces,
442  const UList<vector>& faceAreas,
443  const UList<vector>& faceNormals,
444  const pointField& points,
445  const scalarField& pointXs,
446  const scalarField& cutXs,
447  const bool interpolate,
448  const bool normalise
449 )
450 {
451  // Determine face min and max coordinates
452  scalarField faceMinXs(faces.size(), vGreat);
453  scalarField faceMaxXs(faces.size(), -vGreat);
454  forAll(faces, facei)
455  {
456  forAll(faces[facei], facePointi)
457  {
458  const label pointi = faces[facei][facePointi];
459  faceMinXs[facei] = min(faceMinXs[facei], pointXs[pointi]);
460  faceMaxXs[facei] = max(faceMaxXs[facei], pointXs[pointi]);
461  }
462  }
463 
464  // Create orderings of the faces based on their min and max coordinates
465  labelList faceMinOrder(faces.size());
466  sortedOrder(faceMinXs, faceMinOrder);
467 
468  // Calculate and return the weights
469  return
471  (
472  faces,
473  faceAreas,
474  faceNormals,
475  points,
476  pointXs,
477  faceMinXs,
478  faceMaxXs,
479  faceMinOrder,
480  cutXs,
481  interpolate,
482  normalise
483  );
484 }
485 
486 
488 (
489  const faceList& faces,
490  const Field<vector>& faceAreas,
491  const Field<vector>& faceNormals,
492  const pointField& points,
493  const scalarField& pointXs,
494  const bool interpolate,
495  const label nCuts,
496  const label nIter,
497  const bool debug,
498  const word& functionName,
499  const polyMesh& functionMesh,
500  const setWriter& functionFormatter
501 )
502 {
503  const label nIntervals = interpolate ? nCuts : nCuts - 1;
504 
505  const scalarField faceMagAreas(mag(faceAreas));
506 
507  // Determine face min and max coordinates
508  scalarField faceMinXs(faces.size(), vGreat);
509  scalarField faceMaxXs(faces.size(), -vGreat);
510  forAll(faces, facei)
511  {
512  forAll(faces[facei], facePointi)
513  {
514  const label pointi = faces[facei][facePointi];
515  faceMinXs[facei] = min(faceMinXs[facei], pointXs[pointi]);
516  faceMaxXs[facei] = max(faceMaxXs[facei], pointXs[pointi]);
517  }
518  }
519 
520  // Create orderings of the faces based on their min and max coordinates
521  labelList faceMinOrder(faces.size());
522  sortedOrder(faceMinXs, faceMinOrder);
523 
524  // Assume equal spacing to begin with
525  scalar xMin = gMin(pointXs), xMax = gMax(pointXs);
526  xMin -= max(rootVSmall, 2*small*mag(xMin));
527  xMax += max(rootVSmall, 2*small*mag(xMax));
528  tmp<scalarField> tcutXs = xMin + linearSequence01(nCuts)*(xMax - xMin);
529  scalarField& cutXs = tcutXs.ref();
530  cutXs.first() = xMin;
531  cutXs.last() = xMax;
532 
533  // Names and fields for debug output of the counts, to observe the effect
534  // of iterative improvement of the spacing
536  #define DeclareTypeFieldValues(Type, nullArg) \
537  PtrList<Field<Type>> Type##FieldValues;
539  #undef DeclareTypeFieldValues
540 
541  // Iteratively optimise the spacing between the cut points to achieve an
542  // approximately equal number of data points in each interval
543  for (label iteri = 0; iteri < nIter + debug; ++ iteri)
544  {
545  // Determine the count of faces that contribute to each interval
546  const List<patchCutPlot::weight> weights =
548  (
549  faces,
550  faceAreas,
551  faceNormals,
552  points,
553  pointXs,
554  faceMinXs,
555  faceMaxXs,
556  faceMinOrder,
557  cutXs,
558  interpolate,
559  false
560  );
561  const scalarField intervalCounts
562  (
563  cutPlot::applyWeights(nIntervals, weights, faceMagAreas)
564  );
565 
566  if (debug)
567  {
568  const label nFields0 = (2 + !interpolate)*iteri;
569  const label nFields = (2 + !interpolate)*(iteri + 1);
570 
571  fieldNames.resize(nFields);
572  #define ResizeTypeFieldValues(Type, nullArg) \
573  Type##FieldValues.resize(nFields);
575  #undef ResizeTypeFieldValues
576 
577  if (!interpolate)
578  {
579  const SubField<scalar> distance0s(cutXs, nIntervals);
580  const SubField<scalar> distance1s(cutXs, nIntervals, 1);
581 
582  fieldNames[nFields0] = "distance-" + Foam::name(iteri);
583  scalarFieldValues.set(nFields0, (distance0s + distance1s)/2);
584 
585  fieldNames[nFields0 + 1] = "thickness-" + Foam::name(iteri);
586  scalarFieldValues.set(nFields0 + 1, distance1s - distance0s);
587  }
588  else
589  {
590  fieldNames[nFields0] = "distance-" + Foam::name(iteri);
591  scalarFieldValues.set(nFields0, new scalarField(cutXs));
592  }
593 
594  fieldNames[nFields - 1] = "count-" + Foam::name(iteri);
595  scalarFieldValues.set(nFields - 1, new scalarField(intervalCounts));
596 
597  if (iteri == nIter) break;
598  }
599 
600  // Do a cumulative sum of the interval counts across all cut points
601  scalarField cutSumCounts(nCuts, 0);
602  for (label cuti = 0; cuti < nCuts - 1; ++ cuti)
603  {
604  cutSumCounts[cuti + 1] =
605  cutSumCounts[cuti]
606  + (
608  ? (intervalCounts[cuti + 1] + intervalCounts[cuti])/2
609  : intervalCounts[cuti]
610  );
611  }
612 
613  // Compute the desired count in each interval
614  const scalar intervalCount = cutSumCounts.last()/(nCuts - 1);
615 
616  // Compute the new spacing between the points
617  scalarField cut0Xs(cutXs);
618  cutXs = -vGreat;
619  cutXs.first() = xMin;
620  label cuti = 1;
621  for (label cuti0 = 0; cuti0 < nCuts - 1; ++ cuti0)
622  {
623  while
624  (
625  cuti < nCuts
626  && cutSumCounts[cuti0 + 1] > cuti*intervalCount
627  )
628  {
629  const scalar f =
630  (cuti*intervalCount - cutSumCounts[cuti0])
631  /(cutSumCounts[cuti0 + 1] - cutSumCounts[cuti0]);
632 
633  cutXs[cuti] = (1 - f)*cut0Xs[cuti0] + f*cut0Xs[cuti0 + 1];
634 
635  cuti ++;
636  }
637  }
638  cutXs.last() = xMax;
639  }
640 
641  if (debug)
642  {
643  const fileName outputPath =
644  functionMesh.time().globalPath()
645  /functionObjects::writeFile::outputPrefix
646  /(
647  functionMesh.name() != polyMesh::defaultRegion
648  ? functionMesh.name()
649  : word()
650  )
651  /functionName
652  /functionMesh.time().name();
653 
654  mkDir(outputPath);
655 
656  functionFormatter.write
657  (
658  outputPath,
659  functionName + "_count",
661  fieldNames
662  #define TypeFieldValuesParameter(Type, nullArg) \
663  , Type##FieldValues
666  );
667  }
668 
669  // Finally, calculate and return the actual normalised weights
670  return tcutXs;
671 }
672 
673 
675 (
676  const SubList<face>& faces,
677  const List<patchCutPlot::weight>& weights,
678  const word& functionName,
679  const fvMesh& functionMesh
680 )
681 {
682  volTensorField layers
683  (
684  IOobject
685  (
686  functionName + ":layers",
687  functionMesh.time().name(),
688  functionMesh
689  ),
690  functionMesh,
691  dimensionedTensor(dimless, tensor::uniform(-1))
692  );
693 
694  label meshFacei0 = -1;
695  forAll(functionMesh.faces(), meshFacei)
696  {
697  if (&functionMesh.faces()[meshFacei] == &faces[0])
698  {
699  meshFacei0 = meshFacei;
700  break;
701  }
702  }
703 
704  forAll(weights, weighti)
705  {
706  const patchCutPlot::weight& w = weights[weighti];
707 
708  const label facei = meshFacei0 + w.elementi;
709  const label patchi =
710  functionMesh.poly().boundary().patchIndices()
711  [w.elementi + meshFacei0 - functionMesh.nInternalFaces()];
712  const label patchFacei =
713  facei - functionMesh.poly().boundary()[patchi].start();
714 
715  layers.boundaryFieldRef()[patchi][patchFacei] = tensor::zero;
716  }
717 
718  forAll(weights, weighti)
719  {
720  const patchCutPlot::weight& w = weights[weighti];
721 
722  const label facei = meshFacei0 + w.elementi;
723  const label patchi =
724  functionMesh.poly().boundary().patchIndices()
725  [w.elementi + meshFacei0 - functionMesh.nInternalFaces()];
726  const label patchFacei =
727  facei - functionMesh.poly().boundary()[patchi].start();
728 
729  const direction i = w.cuti % tensor::nComponents;
730 
731  layers.boundaryFieldRef()[patchi][patchFacei][i] =
732  w.value/functionMesh.magFaceAreas()[facei];
733  }
734 
735  Info<< functionName << ": Writing " << layers.name() << endl;
736 
737  layers.write();
738 }
739 
740 
742 (
743  const UIndirectList<face>& faces,
744  const List<patchCutPlot::weight>& weights,
745  const word& functionName,
746  const fvMesh& functionMesh
747 )
748 {
749  volTensorField layers
750  (
751  IOobject
752  (
753  functionName + ":layers",
754  functionMesh.time().name(),
755  functionMesh
756  ),
757  functionMesh,
758  dimensionedTensor(dimless, tensor::uniform(-1))
759  );
760 
761  forAll(weights, weighti)
762  {
763  const patchCutPlot::weight& w = weights[weighti];
764 
765  const label facei = faces.addressing()[w.elementi];
766  const label patchi =
767  functionMesh.poly().boundary().patchIndices()
768  [w.elementi - functionMesh.nInternalFaces()];
769  const label patchFacei =
770  facei - functionMesh.poly().boundary()[patchi].start();
771 
772  layers.boundaryFieldRef()[patchi][patchFacei] = tensor::zero;
773  }
774 
775  forAll(weights, weighti)
776  {
777  const patchCutPlot::weight& w = weights[weighti];
778 
779  const label facei = faces.addressing()[w.elementi];
780  const label patchi =
781  functionMesh.poly().boundary().patchIndices()
782  [w.elementi - functionMesh.nInternalFaces()];
783  const label patchFacei =
784  facei - functionMesh.poly().boundary()[patchi].start();
785 
786  const direction i = w.cuti % tensor::nComponents;
787 
788  layers.boundaryFieldRef()[patchi][patchFacei][i] =
789  w.value/functionMesh.magFaceAreas()[facei];
790  }
791 
792  Info<< functionName << ": Writing " << layers.name() << endl;
793 
794  layers.write();
795 }
796 
797 
798 // ************************************************************************* //
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.
Definition: UList.H:449
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:78
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Definition: DynamicListI.H:296
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...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:307
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Definition: List.C:342
void resize(const label)
Alias for setSize(const label)
Definition: ListI.H:138
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
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.
Definition: SubField.H:63
A List obtained as a section of another List.
Definition: SubList.H:56
fileName globalPath() const
Return the global path.
Definition: TimePaths.H:132
A List with indirect addressing.
Definition: UIndirectList.H:61
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...
Definition: UList.H:74
T & last()
Return the last element of the list.
Definition: UListI.H:128
Holds list of sampling positions.
Definition: coordSet.H:51
Generic dimensioned Type class.
const word & name() const
Return const reference to name.
A class for handling file names.
Definition: fileName.H:82
A functionName is a word starting with '#'.
Definition: functionName.H:60
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:433
const polyMesh & poly() const
Return reference to polyMesh.
Definition: fvMesh.H:456
const Time & time() const
Return time.
const labelList & patchIndices() const
Boundary face patch indices.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
const polyBoundaryMesh & boundary() const
Return boundary mesh.
Definition: polyMesh.H:393
virtual const faceList & faces() const
Return raw faces.
Definition: polyMesh.C:1308
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.
Definition: setWriter.H:64
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.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
A class for handling words, derived from string.
Definition: word.H:63
#define FOR_ALL_FIELD_TYPES(Macro,...)
Definition: fieldTypes.H:51
volScalarField scalarField(fieldObject, mesh)
label patchi
static List< word > fieldNames
Definition: globalFoam.H:46
const pointField & points
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.
Definition: cutPoly.C:61
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)
Definition: patchCutPlot.C:44
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.
Definition: patchCutPlot.C:675
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)
Definition: patchCutPlot.C:161
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)
Definition: patchCutPlot.C:397
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.
Definition: patchCutPlot.C:488
Namespace for OpenFOAM.
Type gMin(const UList< Type > &f, const label comm)
List< label > labelList
A List of labels.
Definition: labelList.H:56
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
messageStream Info
tmp< scalarField > linearSequence01(const label n)
Definition: scalarField.C:107
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.
Definition: quaternionI.H:603
uint8_t direction
Definition: direction.H:45
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
#define TypeFieldValuesParameter(Type, nullArg)
#define DeclareTypeFieldValues(Type, nullArg)
#define ResizeTypeFieldValues(Type, nullArg)
labelList f(nPoints)
Structure containing the weight for a given mesh element and cut index.
Definition: cutPlot.H:51
const scalar xMin
Definition: createFields.H:29
mkDir(pdfPath)
const label nIntervals(pdfDictionary.lookup< label >("nIntervals"))
const scalar xMax
Definition: createFields.H:30