mappedPatchFieldBase.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2018-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "mappedPatchFieldBase.H"
30 #include "mappedPatchBase.H"
31 #include "interpolationCell.H"
32 
33 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
34 
35 template<class Type>
37 (
38  const dictionary& dict,
39  const bool mandatory
40 )
41 {
42  if (mandatory)
43  {
44  return dict.get<Type>("average");
45  }
46 
47  return Zero;
48 }
49 
50 
51 template<class Type>
52 template<class T>
54 (
55  const objectRegistry& obr,
56  const word& region,
57  const word& patch,
58  const labelListList& procToMap,
59  const word& fieldName,
60  const Field<T>& fld
61 ) const
62 {
63  // Store my data onto database
64  //const label myRank = Pstream::myProcNo(0); // comm_
65  const label nProcs = Pstream::nProcs(0); // comm_
66 
67  for (label domain = 0; domain < nProcs; domain++)
68  {
69  const labelList& map = procToMap[domain];
70  if (map.size())
71  {
72  const Field<T> subFld(fld, map);
73 
74  const objectRegistry& subObr = mappedPatchBase::subRegistry
75  (
76  obr,
77  mapper_.sendPath(domain)
78  / region
79  / patch
80  );
81 
83  {
84  Pout<< "*** STORING :"
85  << " field:" << fieldName
86  << " values:" << flatOutput(subFld)
87  << " as:" << subObr.objectPath() << endl;
88  }
89 
90  mappedPatchBase::storeField
91  (
92  const_cast<objectRegistry&>(subObr),
93  fieldName,
94  subFld
95  );
96  }
97  }
98 }
99 
100 
101 template<class Type>
102 template<class T>
104 (
105  const bool allowUnset,
106  const objectRegistry& obr,
107  const word& region,
108  const word& patch,
109  const labelListList& procToMap,
110  const word& fieldName,
111  Field<T>& fld
112 ) const
113 {
114  // Store my data onto database
115  //const label myRank = Pstream::myProcNo(0); // comm_
116  const label nProcs = Pstream::nProcs(0); // comm_
117 
118  for (label domain = 0; domain < nProcs; domain++)
119  {
120  const labelList& map = procToMap[domain];
121  if (map.size())
122  {
123  const objectRegistry& subObr = mappedPatchBase::subRegistry
124  (
125  obr,
126  mapper_.receivePath(domain)
127  / region
128  / patch
129  );
130 
131  //const IOField<T>& subFld = subObr.lookupObject<IOField<T>>
132  //(
133  // fieldName
134  //);
135  const IOField<T>* subFldPtr = subObr.getObjectPtr<IOField<T>>
136  (
137  fieldName
138  );
139  if (subFldPtr)
140  {
141  UIndirectList<T>(fld, map) = *subFldPtr;
142 
144  {
145  Pout<< "*** RETRIEVED :"
146  << " field:" << fieldName
147  << " values:" << flatOutput(fld)
148  << " from:" << subObr.objectPath() << endl;
149  }
150  }
151  else if (allowUnset)
152  {
153  WarningInFunction << "Not found"
154  << " field:" << fieldName
155  << " in:" << subObr.objectPath() << endl;
156  }
157  else
158  {
159  // Not found. Make it fail
160  (void)subObr.lookupObject<IOField<T>>(fieldName);
161  }
162  }
163  }
164 }
165 
166 
167 template<class Type>
168 template<class T>
170 (
171  const objectRegistry& obr,
172  const word& region,
173  const word& patch,
174  const mapDistribute& map,
175  const word& fieldName,
176  const Field<T>& fld
177 ) const
178 {
179  // Store my data onto database
180  //const label myRank = Pstream::myProcNo(0); // comm_
181  const label nProcs = Pstream::nProcs(0); // comm_
182 
183  for (label domain = 0; domain < nProcs; domain++)
184  {
185  const labelList& constructMap = map.constructMap()[domain];
186  if (constructMap.size())
187  {
188  const objectRegistry& subObr = mappedPatchBase::subRegistry
189  (
190  obr,
191  mapper_.receivePath(domain)
192  / region
193  / patch
194  );
195 
196  const Field<T> receiveFld(fld, constructMap);
197 
199  {
200  Pout<< "*** STORING INITIAL :"
201  << " field:" << fieldName << " values:"
202  << flatOutput(receiveFld)
203  << " from:" << flatOutput(fld)
204  << " constructMap:" << flatOutput(constructMap)
205  << " as:" << subObr.objectPath() << endl;
206  }
207 
208  mappedPatchBase::storeField
209  (
210  const_cast<objectRegistry&>(subObr),
211  fieldName,
212  receiveFld
213  );
214  }
215  }
216 }
217 
218 
219 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
220 
221 template<class Type>
223 (
224  const mappedPatchBase& mapper,
225  const fvPatchField<Type>& patchField,
226  const word& fieldName,
227  const bool setAverage,
228  const Type average,
229  const word& interpolationScheme
230 )
231 :
232  mapper_(mapper),
233  patchField_(patchField),
234  fieldName_(fieldName),
235  setAverage_(setAverage),
236  average_(average),
237  interpolationScheme_(interpolationScheme)
238 {}
239 
240 
241 template<class Type>
243 (
244  const mappedPatchBase& mapper,
245  const fvPatchField<Type>& patchField,
246  const dictionary& dict
247 )
248 :
249  mapper_(mapper),
250  patchField_(patchField),
251  fieldName_
252  (
253  dict.template getOrDefault<word>
254  (
255  "field",
256  patchField_.internalField().name()
257  )
258  ),
259  setAverage_(dict.getOrDefault("setAverage", false)),
260  average_(getAverage(dict, setAverage_)),
261  interpolationScheme_(interpolationCell<Type>::typeName)
262 {
263  if
264  (
265  mapper_.sampleDatabase()
266  && mapper_.mode() != mappedPatchBase::NEARESTPATCHFACE
267  )
268  {
270  << "Mapping using the database only supported for "
271  << "sampleMode "
272  << mappedPatchBase::sampleModeNames_
273  [
274  mappedPatchBase::NEARESTPATCHFACE
275  ]
276  << exit(FatalError);
277  }
278 
279  if (mapper_.mode() == mappedPatchBase::NEARESTCELL)
280  {
281  dict.readEntry("interpolationScheme", interpolationScheme_);
282  }
283 
284  // Note: in database mode derived boundary conditions need to initialise
285  // fields
286 }
287 
288 
289 template<class Type>
291 (
292  const mappedPatchBase& mapper,
293  const fvPatchField<Type>& patchField,
294  const dictionary& dict,
295  const Field<Type>& fld
296 )
297 :
299 {
300  if
301  (
302  mapper_.mode() == mappedPatchBase::NEARESTPATCHFACE
303  && mapper_.sampleDatabase()
304  )
305  {
306  // Store my data on receive buffers so we have some initial data
307  initRetrieveField
308  (
309  patchField_.internalField().time(),
310  patchField_.patch().boundaryMesh().mesh().name(),
311  patchField_.patch().name(),
312  mapper_.map(),
313  patchField_.internalField().name(),
314  patchField_
315  );
316  }
317 }
318 
319 
320 template<class Type>
322 (
323  const mappedPatchBase& mapper,
324  const fvPatchField<Type>& patchField
325 )
326 :
327  mapper_(mapper),
328  patchField_(patchField),
329  fieldName_(patchField_.internalField().name()),
330  setAverage_(false),
331  average_(Zero),
332  interpolationScheme_(interpolationCell<Type>::typeName)
333 {}
334 
335 
336 template<class Type>
338 (
339  const mappedPatchFieldBase<Type>& mapper
340 )
341 :
342  mapper_(mapper.mapper_),
343  patchField_(mapper.patchField_),
344  fieldName_(mapper.fieldName_),
345  setAverage_(mapper.setAverage_),
346  average_(mapper.average_),
347  interpolationScheme_(mapper.interpolationScheme_)
348 {}
349 
350 
351 template<class Type>
353 (
354  const mappedPatchBase& mapper,
355  const fvPatchField<Type>& patchField,
356  const mappedPatchFieldBase<Type>& base
357 )
358 :
359  mapper_(mapper),
360  patchField_(patchField),
361  fieldName_(base.fieldName_),
362  setAverage_(base.setAverage_),
363  average_(base.average_),
364  interpolationScheme_(base.interpolationScheme_)
365 {}
366 
367 
368 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
369 
370 template<class Type>
371 template<class Type2>
374 {
376 
377  if (mapper_.sameRegion())
378  {
379  if (fieldName == patchField_.internalField().name())
380  {
381  // Optimisation: bypass field lookup
382  return
383  dynamic_cast<const fieldType&>
384  (
385  patchField_.internalField()
386  );
387  }
388  else
389  {
390  const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh();
391  return thisMesh.template lookupObject<fieldType>(fieldName);
392  }
393  }
394 
395  const fvMesh& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
396  return nbrMesh.template lookupObject<fieldType>(fieldName);
397 }
398 
399 
400 template<class Type>
403 {
404  return sampleField<Type>(fieldName_);
405 }
406 
407 
408 template<class Type>
409 template<class T>
411 (
412  const word& fieldName,
413  Field<T>& newValues
414 ) const
415 {
416  if (mapper_.sampleDatabase())
417  {
418  // Store my data on send buffers
419  storeField
420  (
421  patchField_.internalField().time(),
422  patchField_.patch().boundaryMesh().mesh().name(),
423  patchField_.patch().name(),
424  mapper_.map().subMap(),
425  fieldName,
426  newValues
427  );
428  // Construct my data from receive buffers
429  newValues.setSize(mapper_.map().constructSize());
430  retrieveField
431  (
432  true, // allow unset
433  patchField_.internalField().time(),
434  mapper_.sampleRegion(),
435  mapper_.samplePatch(),
436  mapper_.map().constructMap(),
437  fieldName,
438  newValues
439  );
440  }
441  else
442  {
443  mapper_.distribute(newValues);
444  }
445 }
446 
447 
448 template<class Type>
449 //template<class T>
452 (
453 // const GeometricField<T, fvPatchField, volMesh>& fld
454 ) const
455 {
457 
458  // Since we're inside initEvaluate/evaluate there might be processor
459  // comms underway. Change the tag we use.
460  int oldTag = UPstream::msgType();
461  UPstream::msgType() = oldTag + 1;
462 
463  const fvMesh& thisMesh = patchField_.patch().boundaryMesh().mesh();
464 
465  // Result of obtaining remote values
466  auto tnewValues = tmp<Field<Type>>::New();
467  auto& newValues = tnewValues.ref();
468 
469  switch (mapper_.mode())
470  {
471  case mappedPatchBase::NEARESTCELL:
472  {
473  const fieldType& fld = sampleField();
474  const mapDistribute& distMap = mapper_.map();
475 
476  if (interpolationScheme_ != interpolationCell<Type>::typeName)
477  {
478  if (!mapper_.sameWorld() || mapper_.sampleDatabase())
479  {
481  << "Interpolating cell values from different world"
482  << " or database currently not supported"
483  << exit(FatalError);
484  }
485 
486  const fvMesh& nbrMesh =
487  refCast<const fvMesh>(mapper_.sampleMesh());
488 
489  // Send back sample points to the processor that holds the cell
490  vectorField samples(mapper_.samplePoints());
491 
492  distMap.reverseDistribute
493  (
494  (
495  mapper_.sameRegion()
496  ? thisMesh.nCells()
497  : nbrMesh.nCells()
498  ),
499  point::max,
500  samples
501  );
502 
503  auto interpolator =
505  (
506  interpolationScheme_,
507  fld
508  );
509 
510  const auto& interp = *interpolator;
511 
512  newValues.setSize(samples.size(), pTraits<Type>::max);
513  forAll(samples, celli)
514  {
515  if (samples[celli] != point::max)
516  {
517  newValues[celli] = interp.interpolate
518  (
519  samples[celli],
520  celli
521  );
522  }
523  }
524  }
525  else
526  {
527  newValues = fld;
528  }
529 
530  distribute(fieldName_, newValues);
531 
532  break;
533  }
534  case mappedPatchBase::NEARESTPATCHFACE:
535  case mappedPatchBase::NEARESTPATCHFACEAMI:
536  {
537  if (mapper_.sameWorld())
538  {
539  const fvMesh& nbrMesh =
540  refCast<const fvMesh>(mapper_.sampleMesh());
541  const fieldType& fld = sampleField();
542 
543  const label nbrPatchID =
544  nbrMesh.boundaryMesh().findPatchID(mapper_.samplePatch());
545 
546  if (nbrPatchID < 0)
547  {
549  << "Unable to find sample patch " << mapper_.samplePatch()
550  << " in region " << mapper_.sampleRegion()
551  << " for patch " << patchField_.patch().name() << nl
552  << abort(FatalError);
553  }
554 
555  const auto& nbrField = fld;
556 
557  newValues = nbrField.boundaryField()[nbrPatchID];
558  }
559  else
560  {
561  // Start off from my patch values, let distribute function below
562  // do all the work
563  newValues = patchField_;
564  }
565  distribute(fieldName_, newValues);
566 
567  break;
568  }
569  case mappedPatchBase::NEARESTFACE:
570  {
571  Field<Type> allValues;
572  if (mapper_.sameWorld())
573  {
574  const fvMesh& nbrMesh =
575  refCast<const fvMesh>(mapper_.sampleMesh());
576  const fieldType& fld = sampleField();
577 
578  allValues.setSize(nbrMesh.nFaces(), Zero);
579 
580  const auto& nbrField = fld;
581 
582  for (const fvPatchField<Type>& pf : nbrField.boundaryField())
583  {
584  label faceStart = pf.patch().start();
585 
586  forAll(pf, facei)
587  {
588  allValues[faceStart++] = pf[facei];
589  }
590  }
591  }
592  else
593  {
594  // Start off from my patch values. Let distribute function below
595  // do all the work
596  allValues.setSize(thisMesh.nFaces(), Zero);
597 
598  const fieldType& thisFld = dynamic_cast<const fieldType&>
599  (
600  patchField_.internalField()
601  );
602 
603  for (const fvPatchField<Type>& pf : thisFld.boundaryField())
604  {
605  label faceStart = pf.patch().start();
606 
607  forAll(pf, facei)
608  {
609  allValues[faceStart++] = pf[facei];
610  }
611  }
612  }
613 
614  distribute(fieldName_, allValues);
615  newValues.transfer(allValues);
616 
617  break;
618  }
619  default:
620  {
622  << "Unknown sampling mode: " << mapper_.mode() << nl
623  << abort(FatalError);
624  }
625  }
626 
627  if (setAverage_)
628  {
629  Type averagePsi =
630  gSum(patchField_.patch().magSf()*newValues)
631  /gSum(patchField_.patch().magSf());
632 
633  if (mag(averagePsi)/mag(average_) > 0.5)
634  {
635  newValues *= mag(average_)/mag(averagePsi);
636  }
637  else
638  {
639  newValues += (average_ - averagePsi);
640  }
641  }
642 
643  // Restore tag
644  UPstream::msgType() = oldTag;
645 
646  return tnewValues;
647 }
648 
649 
650 //template<class Type>
651 //Foam::tmp<Foam::Field<Type>>
652 //Foam::mappedPatchFieldBase<Type>::mappedField() const
653 //{
654 // const GeometricField<Type, fvPatchField, volMesh>& fld = sampleField();
655 // return mappedField<Type>(fld);
656 //}
657 
658 
659 template<class Type>
662 {
663  // Swap to obtain full local values of neighbour internal field
664  tmp<Field<Type>> tnbrIntFld(new Field<Type>());
665  Field<Type>& nbrIntFld = tnbrIntFld.ref();
666 
667  if (mapper_.sameWorld())
668  {
669  // Same world so lookup
670  const label nbrPatchID = mapper_.samplePolyPatch().index();
671  const auto& nbrField = this->sampleField();
672  nbrIntFld = nbrField.boundaryField()[nbrPatchID].patchInternalField();
673  }
674  else
675  {
676  // Different world so use my region,patch. Distribution below will
677  // do the reordering
678  nbrIntFld = patchField_.patchInternalField();
679  }
680 
681  // Since we're inside initEvaluate/evaluate there might be processor
682  // comms underway. Change the tag we use.
683  int oldTag = UPstream::msgType();
684  UPstream::msgType() = oldTag+1;
685 
686  distribute(fieldName_, nbrIntFld);
687 
688  // Restore tag
689  UPstream::msgType() = oldTag;
690 
691  return tnbrIntFld;
692 }
693 
694 
695 template<class Type>
698 {
699  // Swap to obtain full local values of neighbour internal field
700  tmp<scalarField> tnbrKDelta(new scalarField());
701  scalarField& nbrKDelta = tnbrKDelta.ref();
702 
703  if (mapper_.sameWorld())
704  {
705  // Same world so lookup
706  const auto& nbrMesh = refCast<const fvMesh>(this->mapper_.sampleMesh());
707  const label nbrPatchID = mapper_.samplePolyPatch().index();
708  const auto& nbrPatch = nbrMesh.boundary()[nbrPatchID];
709  nbrKDelta = nbrPatch.deltaCoeffs();
710  }
711  else
712  {
713  // Different world so use my region,patch. Distribution below will
714  // do the reordering
715  nbrKDelta = patchField_.patch().deltaCoeffs();
716  }
717 
718 
719  // Since we're inside initEvaluate/evaluate there might be processor
720  // comms underway. Change the tag we use.
721  const int oldTag = UPstream::msgType();
722  UPstream::msgType() = oldTag+1;
723 
724  distribute(fieldName_ + "_deltaCoeffs", nbrKDelta);
725 
726  // Restore tag
727  UPstream::msgType() = oldTag;
728 
729  return tnbrKDelta;
730 }
731 
732 
733 template<class Type>
735 (
736  const word& fieldName,
737  tmp<scalarField>& thisWeights,
738  tmp<scalarField>& nbrWeights
739 ) const
740 {
741  thisWeights = new scalarField(patchField_.patch().deltaCoeffs());
742  if (!fieldName.empty())
743  {
744  thisWeights.ref() *=
745  patchField_.patch().template lookupPatchField
746  <
748  scalar
749  >
750  (
751  fieldName
752  ).patchInternalField();
753  }
754 
755 
756  // Swap to obtain full local values of neighbour internal field
757 
758  if (mapper_.sameWorld())
759  {
760  // Same world so lookup
761  const auto& nbrMesh = refCast<const fvMesh>(mapper_.sampleMesh());
762  const label nbrPatchID = mapper_.samplePolyPatch().index();
763  const auto& nbrPatch = nbrMesh.boundary()[nbrPatchID];
764 
765  nbrWeights = new scalarField(nbrPatch.deltaCoeffs());
766 
767  if (!fieldName.empty())
768  {
769  // Weightfield is volScalarField
770  const auto& nbrWeightField =
771  nbrMesh.template lookupObject<volScalarField>(fieldName);
772  nbrWeights.ref() *=
773  nbrWeightField.boundaryField()[nbrPatchID].patchInternalField();
774  }
775  }
776  else
777  {
778  // Different world so use my region,patch. Distribution below will
779  // do the reordering
780  nbrWeights = new scalarField(thisWeights());
781  }
782 
783  // Since we're inside initEvaluate/evaluate there might be processor
784  // comms underway. Change the tag we use.
785  int oldTag = UPstream::msgType();
786  UPstream::msgType() = oldTag+1;
787 
788  distribute(fieldName_ + "_weights", nbrWeights.ref());
789 
790  // Restore tag
791  UPstream::msgType() = oldTag;
792 }
793 
794 
795 template<class Type>
797 (
798  const fvPatch& p,
800 )
801 {
802  if (!isA<mappedPatchBase>(p.patch()))
803  {
805  << "Incorrect patch type " << p.patch().type()
806  << " for patch " << p.patch().name()
807  << " of field " << iF.name()
808  << " in file " << iF.objectPath() << nl
809  << "Type should be a mappedPatch"
810  << exit(FatalError);
811  }
812  return refCast<const mappedPatchBase>(p.patch());
813 }
814 
815 
816 template<class Type>
817 template<class T>
819 (
820  const word& fieldName,
821  const Field<T>& fld
822 ) const
823 {
824  if (mapper_.sampleDatabase())
825  {
826  // Store my data on receive buffers (reverse of storeField;
827  // i.e. retrieveField will obtain patchField)
828  initRetrieveField
829  (
830  patchField_.internalField().time(),
831  mapper_.sampleRegion(),
832  mapper_.samplePatch(),
833  mapper_.map(),
834  fieldName,
835  fld
836  );
837  }
838 }
839 
840 
841 template<class Type>
843 {
844  os.writeEntry("field", fieldName_);
845 
846  if (setAverage_)
847  {
848  os.writeEntry("setAverage", "true");
849  os.writeEntry("average", average_);
850  }
851 
852  if (mapper_.mode() == mappedPatchBase::NEARESTCELL)
853  {
854  os.writeEntry("interpolationScheme", interpolationScheme_);
855  }
856 }
857 
858 
859 // ************************************************************************* //
Foam::fvPatchField
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: volSurfaceMapping.H:50
Foam::objectRegistry::getObjectPtr
Type * getObjectPtr(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:423
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::mappedPatchFieldBase::average_
const Type average_
Definition: mappedPatchFieldBase.H:130
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::IOField
A primitive field of type <T> with automated input and output.
Definition: foamVtkLagrangianWriter.H:61
Foam::mappedPatchFieldBase::mappedPatchFieldBase
mappedPatchFieldBase(const mappedPatchBase &mapper, const fvPatchField< Type > &patchField, const word &fieldName, const bool setAverage, const Type average, const word &interpolationScheme)
Construct from components.
Definition: mappedPatchFieldBase.C:223
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
Foam::mappedPatchFieldBase::patchField_
const fvPatchField< Type > & patchField_
Underlying patch field.
Definition: mappedPatchFieldBase.H:120
Foam::primitiveMesh::nFaces
label nFaces() const
Number of mesh faces.
Definition: primitiveMeshI.H:90
interpolationCell.H
Foam::mappedPatchFieldBase::mappedField
virtual tmp< Field< Type > > mappedField() const
Map sampleField onto *this patch.
Definition: mappedPatchFieldBase.C:452
mappedPatchFieldBase.H
Foam::polyMesh::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:444
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::gSum
Type gSum(const FieldField< Field, Type > &f)
Definition: FieldFieldFunctions.C:594
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::mappedPatchBase
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
Definition: mappedPatchBase.H:112
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::interpolationCell
Uses the cell value for any point in the cell.
Definition: interpolationCell.H:50
Foam::mappedPatchFieldBase::fieldName_
word fieldName_
Name of field to sample.
Definition: mappedPatchFieldBase.H:123
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::mappedPatchFieldBase::storeField
void storeField(const objectRegistry &obr, const word &region, const word &patch, const labelListList &procToMap, const word &fieldName, const Field< T > &fld) const
Store elements of field onto (sub) registry.
Definition: mappedPatchFieldBase.C:54
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:228
Foam::primitiveMesh::nCells
label nCells() const
Number of mesh cells.
Definition: primitiveMeshI.H:96
Foam::Field< T >
Foam::fac::average
tmp< GeometricField< Type, faPatchField, areaMesh > > average(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Area-weighted average a edgeField creating a areaField.
Definition: facAverage.C:47
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:163
Foam::mappedPatchFieldBase::distribute
void distribute(const word &fieldName, Field< T > &newValues) const
Definition: mappedPatchFieldBase.C:411
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
samples
scalarField samples(nIntervals, Zero)
Foam::polyBoundaryMesh::mesh
const polyMesh & mesh() const
Return the mesh reference.
Definition: polyBoundaryMesh.H:144
Foam::volScalarField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:57
Foam::objectRegistry::lookupObject
const Type & lookupObject(const word &name, const bool recursive=false) const
Definition: objectRegistryTemplates.C:434
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Definition: polyBoundaryMesh.C:766
Foam::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::mappedPatchFieldBase
Functionality for sampling fields using mappedPatchBase. Every call to mappedField() returns a sample...
Definition: mappedPatchFieldBase.H:104
Foam::mappedPatchFieldBase::mapper
static const mappedPatchBase & mapper(const fvPatch &p, const DimensionedField< Type, volMesh > &iF)
Check that patch is of correct type.
Definition: mappedPatchFieldBase.C:797
Foam::mappedPatchFieldBase::mappedWeightField
virtual tmp< scalarField > mappedWeightField() const
Map optional weightField onto *this patch. Default is deltaCoeffs.
Definition: mappedPatchFieldBase.C:697
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam::flatOutput
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition: FlatOutput.H:217
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::mappedPatchFieldBase::interpolationScheme_
word interpolationScheme_
Interpolation scheme to use for nearestcell mode.
Definition: mappedPatchFieldBase.H:133
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::mappedPatchFieldBase::write
virtual void write(Ostream &os) const
Write.
Definition: mappedPatchFieldBase.C:842
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::mappedPatchFieldBase::mapper_
const mappedPatchBase & mapper_
Mapping engine.
Definition: mappedPatchFieldBase.H:117
Foam::mappedPatchFieldBase::sampleField
const GeometricField< Type, fvPatchField, volMesh > & sampleField() const
Field to sample. Either on my or nbr mesh.
Definition: mappedPatchFieldBase.C:402
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::List< labelList >
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:54
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::mappedPatchFieldBase::mappedInternalField
virtual tmp< Field< Type > > mappedInternalField() const
Map internal of sampleField onto *this patch.
Definition: mappedPatchFieldBase.C:661
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:232
Foam::mapDistribute::reverseDistribute
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
Definition: mapDistributeTemplates.C:182
Foam::UIndirectList
A List with indirect addressing.
Definition: faMatrix.H:60
Foam::mappedPatchFieldBase::initRetrieveField
void initRetrieveField(const objectRegistry &obr, const word &region, const word &patch, const mapDistribute &map, const word &fieldName, const Field< T > &fld) const
Construct field from registered elements.
Definition: mappedPatchFieldBase.C:170
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:209
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::mapDistributeBase::constructMap
const labelListList & constructMap() const
From subsetted data to new reconstructed data.
Definition: mapDistributeBase.H:301
Foam::mappedPatchFieldBase::setAverage_
const bool setAverage_
If true adjust the mapped field to maintain average value average_.
Definition: mappedPatchFieldBase.H:126
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::mappedPatchFieldBase::retrieveField
void retrieveField(const bool allowUnset, const objectRegistry &obr, const word &region, const word &patch, const labelListList &procToMap, const word &fieldName, Field< T > &fld) const
Construct field from registered elements.
Definition: mappedPatchFieldBase.C:104
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
mappedPatchBase.H