fvMeshStitcherTemplates.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 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 Description
25  Perform mapping of finite volume fields required by stitching.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "volFields.H"
30 #include "surfaceFields.H"
31 #include "fvPatchFieldMapper.H"
32 #include "fvMeshStitcher.H"
33 #include "setSizeFieldMapper.H"
34 #include "nonConformalBoundary.H"
38 #include "processorFvPatch.H"
39 #include "surfaceToVolVelocity.H"
40 
41 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
42 
43 template<class Type, template<class> class GeoField>
44 void Foam::fvMeshStitcher::storeOldTimeFields()
45 {
46  HashTable<GeoField<Type>*> fields(mesh_.lookupClass<GeoField<Type>>());
47  forAllIter(typename HashTable<GeoField<Type>*>, fields, iter)
48  {
49  iter()->storeOldTimes();
50  }
51 }
52 
53 
54 template<template<class> class GeoField>
55 void Foam::fvMeshStitcher::storeOldTimeFields()
56 {
57  #define StoreOldTimeFields(Type, nullArg) \
58  storeOldTimeFields<Type, GeoField>();
60  #undef StoreOldTimeFields
61 }
62 
63 
64 template<class Type, template<class> class GeoField>
65 void Foam::fvMeshStitcher::resizePatchFields()
66 {
67  struct fvPatchFieldSetSizer
68  :
69  public fvPatchFieldMapper,
70  public setSizeFieldMapper
71  {
72  fvPatchFieldSetSizer(const label size)
73  :
74  setSizeFieldMapper(size)
75  {}
76  };
77 
78  HashTable<GeoField<Type>*> fields(mesh_.lookupClass<GeoField<Type>>());
79  forAllIter(typename HashTable<GeoField<Type>*>, fields, iter)
80  {
81  forAll(mesh_.boundary(), patchi)
82  {
83  typename GeoField<Type>::Patch& pf =
84  iter()->boundaryFieldRef()[patchi];
85 
86  if (isA<nonConformalFvPatch>(pf.patch()))
87  {
88  pf.autoMap(fvPatchFieldSetSizer(pf.patch().size()));
89  }
90  }
91  }
92 }
93 
94 
95 template<template<class> class GeoField>
96 void Foam::fvMeshStitcher::resizePatchFields()
97 {
98  #define ResizePatchFields(Type, nullArg) \
99  resizePatchFields<Type, GeoField>();
101  #undef ResizePatchFields
102 }
103 
104 
105 template<class Type>
106 void Foam::fvMeshStitcher::preConformSurfaceFields()
107 {
108  HashTable<SurfaceField<Type>*> fields
109  (
110  mesh_.lookupClass<SurfaceField<Type>>()
111  );
112 
113  const surfaceScalarField* phiPtr =
114  mesh_.foundObject<surfaceScalarField>("meshPhi")
115  ? &mesh_.lookupObject<surfaceScalarField>("meshPhi")
116  : nullptr;
117 
118  forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
119  {
120  SurfaceField<Type>& field = *iter();
121 
122  if
123  (
124  &field == static_cast<const regIOobject*>(phiPtr)
125  || field.isOldTime()
126  ) continue;
127 
128  autoPtr<SurfaceField<Type>> nccFieldPtr
129  (
130  new SurfaceField<Type>
131  (
132  IOobject
133  (
134  nccFieldPrefix_ + field.name(),
135  mesh_.time().timeName(),
136  mesh_
137  ),
138  field
139  )
140  );
141 
142  for (label i = 0; i <= field.nOldTimes(); ++ i)
143  {
144  SurfaceField<Type>& field0 = field.oldTime(i);
145 
146  nccFieldPtr->oldTime(i).boundaryFieldRef() =
147  conformalNccBoundaryField<Type>(field0.boundaryField());
148 
149  field0.boundaryFieldRef() =
150  conformalOrigBoundaryField<Type>(field0.boundaryField());
151  }
152 
153  nccFieldPtr.ptr()->store();
154  }
155 }
156 
157 
158 inline void Foam::fvMeshStitcher::preConformSurfaceFields()
159 {
160  #define PreConformSurfaceFields(Type, nullArg) \
161  preConformSurfaceFields<Type>();
163  #undef PreConformSurfaceFields
164 }
165 
166 
167 template<class Type>
168 void Foam::fvMeshStitcher::postNonConformSurfaceFields()
169 {
170  HashTable<SurfaceField<Type>*> fields
171  (
172  mesh_.lookupClass<SurfaceField<Type>>()
173  );
174 
175  const surfaceScalarField* phiPtr =
176  mesh_.foundObject<surfaceScalarField>("meshPhi")
177  ? &mesh_.lookupObject<surfaceScalarField>("meshPhi")
178  : nullptr;
179 
180  forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
181  {
182  if (iter.key()(nccFieldPrefix_.size()) == nccFieldPrefix_) continue;
183 
184  SurfaceField<Type>& field = *iter();
185 
186  if
187  (
188  &field == static_cast<const regIOobject*>(phiPtr)
189  || field.isOldTime()
190  || mesh_.topoChanged()
191  ) continue;
192 
193  const word nccFieldName = nccFieldPrefix_ + field.name();
194 
195  const SurfaceField<Type>& nccField =
196  mesh_.lookupObject<SurfaceField<Type>>(nccFieldName);
197 
198  for (label i = 0; i <= field.nOldTimes(); ++ i)
199  {
200  SurfaceField<Type>& field0 = field.oldTime(i);
201 
202  field0.boundaryFieldRef() =
203  nonConformalBoundaryField<Type>
204  (
205  nccField.oldTime(i).boundaryField(),
206  field0.boundaryField()
207  );
208 
209  field0.boundaryFieldRef() =
210  synchronisedBoundaryField<Type>(field0.boundaryField());
211  }
212  }
213 
214  // Remove NCC fields after all fields have been mapped. This is so that
215  // old-time fields aren't removed by current-time fields in advance of the
216  // old-time field being mapped.
217  forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
218  {
219  if (iter.key()(nccFieldPrefix_.size()) == nccFieldPrefix_) continue;
220 
221  SurfaceField<Type>& field = *iter();
222 
223  if
224  (
225  &field == static_cast<const regIOobject*>(phiPtr)
226  || field.isOldTime()
227  ) continue;
228 
229  const word nccFieldName = nccFieldPrefix_ + field.name();
230 
231  SurfaceField<Type>& nccField =
232  mesh_.lookupObjectRef<SurfaceField<Type>>(nccFieldName);
233 
234  nccField.checkOut();
235  }
236 
237  // Check there are no NCC fields left over
238  fields = mesh_.lookupClass<SurfaceField<Type>>();
239  forAllIter(typename HashTable<SurfaceField<Type>*>, fields, iter)
240  {
241  if (iter.key()(nccFieldPrefix_.size()) != nccFieldPrefix_) continue;
242 
244  << "Stitching mapping field \"" << iter()->name()
245  << "\" found, but the field it corresponds to no longer exists"
246  << exit(FatalError);
247  }
248 }
249 
250 
251 inline void Foam::fvMeshStitcher::postNonConformSurfaceFields()
252 {
253  #define PostNonConformSurfaceFields(Type, nullArg) \
254  postNonConformSurfaceFields<Type>();
256  #undef PostNonConformSurfaceFields
257 }
258 
259 
260 template<class Type>
261 void Foam::fvMeshStitcher::evaluateVolFields()
262 {
263  HashTable<VolField<Type>*> fields(mesh_.lookupClass<VolField<Type>>());
264  forAllIter(typename HashTable<VolField<Type>*>, fields, iter)
265  {
266  const label nReq = Pstream::nRequests();
267 
268  forAll(mesh_.boundary(), patchi)
269  {
270  typename VolField<Type>::Patch& pf =
271  iter()->boundaryFieldRef()[patchi];
272 
273  if (isA<nonConformalFvPatch>(pf.patch()))
274  {
275  pf.initEvaluate(Pstream::defaultCommsType);
276  }
277  }
278 
279  if
280  (
283  )
284  {
285  Pstream::waitRequests(nReq);
286  }
287 
288  forAll(mesh_.boundary(), patchi)
289  {
290  typename VolField<Type>::Patch& pf =
291  iter()->boundaryFieldRef()[patchi];
292 
293  if (isA<nonConformalFvPatch>(pf.patch()))
294  {
295  pf.evaluate(Pstream::defaultCommsType);
296  }
297  }
298  }
299 }
300 
301 
302 inline void Foam::fvMeshStitcher::evaluateVolFields()
303 {
304  #define EvaluateVolFields(Type, nullArg) \
305  evaluateVolFields<Type>();
307  #undef EvaluateVolFields
308 }
309 
310 
311 inline void Foam::fvMeshStitcher::postNonConformSurfaceVelocities()
312 {
313  if (mesh_.topoChanged())
314  {
315  HashTable<surfaceVectorField*> Ufs
316  (
317  mesh_.lookupClass<surfaceVectorField>()
318  );
319 
320  forAllIter(HashTable<surfaceVectorField*>, Ufs, iter)
321  {
322  surfaceVectorField& Uf = *iter();
323 
324  const volVectorField& U = surfaceToVolVelocity(Uf);
325 
326  if (!isNull(U))
327  {
328  forAll(Uf.boundaryField(), patchi)
329  {
330  if (isA<nonConformalFvPatch>(mesh_.boundary()[patchi]))
331  {
332  Uf.boundaryFieldRef()[patchi] ==
333  U.boundaryField()[patchi];
334  }
335  }
336  }
337  }
338  }
339 }
340 
341 
342 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
343 
344 template<class GeoBoundaryField>
346 (
347  const SurfaceFieldBoundary<label>& polyFacesBf,
348  GeoBoundaryField& fieldBf
349 )
350 {
351  struct fvPatchFieldSetSizer
352  :
353  public fvPatchFieldMapper,
354  public setSizeFieldMapper
355  {
356  fvPatchFieldSetSizer(const label size)
357  :
358  setSizeFieldMapper(size)
359  {}
360  };
361 
362  forAll(polyFacesBf, nccPatchi)
363  {
364  if (isA<nonConformalFvPatch>(polyFacesBf[nccPatchi].patch()))
365  {
366  fieldBf[nccPatchi].autoMap
367  (
368  fvPatchFieldSetSizer(polyFacesBf[nccPatchi].size())
369  );
370  }
371  }
372 }
373 
374 template<class GeoField>
376 (
377  const SurfaceFieldBoundary<label>& polyFacesBf,
378  GeoField& field
379 )
380 {
381  for (label i = 0; i <= field.nOldTimes(); ++ i)
382  {
384  (
385  polyFacesBf,
386  field.oldTime(i).boundaryFieldRef()
387  );
388  }
389 }
390 
391 
392 template<class Type>
394 (
395  const Field<Type>& f,
396  const label size,
397  const labelUList& addr
398 )
399 {
400  tmp<Field<Type>> tresult(new Field<Type>(size, Zero));
401  forAll(addr, i)
402  {
403  tresult.ref()[addr[i]] += f[i];
404  }
405  return tresult;
406 }
407 
408 
409 template<class Type>
411 (
412  const tmp<Field<Type>>& f,
413  const label size,
414  const labelUList& addr
415 )
416 {
417  tmp<Field<Type>> tresult = fieldRMapSum(f(), size, addr);
418  f.clear();
419  return tresult;
420 }
421 
422 
425 {
426  const fvBoundaryMesh& fvbm = mesh_.boundary();
427 
428  const surfaceScalarField::Boundary& magSfb =
429  fvbm.mesh().magSf().boundaryField();
430 
431  tmp<surfaceScalarField::Boundary> tOrigNccMagSfb
432  (
434  (
435  fvbm,
438  )
439  );
440 
441  surfaceScalarField::Boundary& origNccMagSfb = tOrigNccMagSfb.ref();
442 
443  origNccMagSfb == 0;
444 
445  forAll(fvbm, nccPatchi)
446  {
447  const fvPatch& fvp = fvbm[nccPatchi];
448 
449  if (isA<nonConformalCoupledFvPatch>(fvp))
450  {
451  const nonConformalCoupledFvPatch& nccFvp =
452  refCast<const nonConformalCoupledFvPatch>(fvp);
453 
454  const label origPatchi = nccFvp.origPatchID();
455  const fvPatch& origFvp = nccFvp.origPatch();
456 
457  const labelList nccOrigPatchFace =
458  nccFvp.polyFaces() - origFvp.start();
459 
460  origNccMagSfb[origPatchi] +=
462  (
463  magSfb[nccPatchi],
464  origFvp.size(),
465  nccOrigPatchFace
466  );
467  }
468  }
469 
470  return tOrigNccMagSfb;
471 }
472 
473 
474 template<class Type>
477 (
478  const SurfaceFieldBoundary<Type>& fieldb
479 ) const
480 {
481  const bool isFluxField = isFlux(fieldb[0].internalField());
482 
483  const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
484 
485  const surfaceScalarField::Boundary& magSfb =
486  fvbm.mesh().magSf().boundaryField();
487 
489  (
491  (
493  fieldb
494  )
495  );
496 
497  SurfaceFieldBoundary<Type>& nccFieldb = tnccFieldb.ref();
498 
499  nccFieldb == pTraits<Type>::zero;
500 
501  const surfaceScalarField::Boundary origNccMagSfb
502  (
505  );
506 
507  // Accumulate the non-conformal parts of the field into the original faces
508  forAll(fvbm, nccPatchi)
509  {
510  const fvPatch& fvp = fvbm[nccPatchi];
511 
512  if (isA<nonConformalCoupledFvPatch>(fvp))
513  {
514  const nonConformalCoupledFvPatch& nccFvp =
515  refCast<const nonConformalCoupledFvPatch>(fvbm[nccPatchi]);
516 
517  const label origPatchi = nccFvp.origPatchID();
518  const fvPatch& origFvp = nccFvp.origPatch();
519 
520  const labelList nccOrigPatchFace =
521  nccFvp.polyFaces() - origFvp.start();
522 
523  // If this is a flux then sum
524  if (isFluxField)
525  {
526  nccFieldb[origPatchi] +=
528  (
529  fieldb[nccPatchi],
530  origFvp.size(),
531  nccOrigPatchFace
532  );
533  }
534 
535  // If not a flux then do an area-weighted sum
536  else
537  {
538  nccFieldb[origPatchi] +=
540  (
541  fieldb[nccPatchi]*magSfb[nccPatchi],
542  origFvp.size(),
543  nccOrigPatchFace
544  );
545  }
546  }
547  }
548 
549  const labelList origPatchIDs =
551 
552  // Scale or average as appropriate
553  forAll(origPatchIDs, i)
554  {
555  const label origPatchi = origPatchIDs[i];
556 
557  // If this is a flux then scale to the total size of the face
558  if (isFluxField)
559  {
560  const scalarField origSumMagSf
561  (
562  magSfb[origPatchi] + origNccMagSfb[origPatchi]
563  );
564 
565  nccFieldb[origPatchi] *=
566  origSumMagSf
567  /max(origNccMagSfb[origPatchi], small*origSumMagSf);
568  }
569 
570  // If this is not a flux then convert to an area-weighted average
571  else
572  {
573  nccFieldb[origPatchi] /=
574  max(origNccMagSfb[origPatchi], vSmall);
575  }
576  }
577 
578  return tnccFieldb;
579 }
580 
581 
582 template<class Type>
585 (
586  const SurfaceFieldBoundary<Type>& fieldb
587 ) const
588 {
589  const bool isFluxField = isFlux(fieldb[0].internalField());
590 
591  const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
592 
593  const surfaceScalarField::Boundary& magSfb =
594  fvbm.mesh().magSf().boundaryField();
595 
596  tmp<SurfaceFieldBoundary<Type>> torigFieldb
597  (
599  (
601  fieldb
602  )
603  );
604 
605  // If this is a flux then scale up to the total face areas
606  if (isFluxField)
607  {
608  const surfaceScalarField::Boundary origNccMagSfb
609  (
612  );
613 
614  SurfaceFieldBoundary<Type>& origFieldb = torigFieldb.ref();
615 
616  const labelList origPatchIDs =
618 
619  forAll(origPatchIDs, i)
620  {
621  const label origPatchi = origPatchIDs[i];
622 
623  const scalarField origSumMagSf
624  (
625  magSfb[origPatchi] + origNccMagSfb[origPatchi]
626  );
627 
628  origFieldb[origPatchi] *=
629  origSumMagSf
630  /max(magSfb[origPatchi], small*origSumMagSf);
631  }
632  }
633 
634  return torigFieldb;
635 }
636 
637 
638 template<class Type>
641 (
642  const SurfaceFieldBoundary<Type>& nccFieldb,
643  const SurfaceFieldBoundary<Type>& origFieldb
644 ) const
645 {
646  const bool isFluxField = isFlux(origFieldb[0].internalField());
647 
648  const fvBoundaryMesh& fvbm = origFieldb[0].patch().boundaryMesh();
649 
650  const surfaceScalarField::Boundary& magSfb =
651  fvbm.mesh().magSf().boundaryField();
652 
654  (
656  (
658  origFieldb
659  )
660  );
661 
662  SurfaceFieldBoundary<Type>& fieldb = tfieldb.ref();
663 
664  // Set the coupled values
665  forAll(fvbm, nccPatchi)
666  {
667  const fvPatch& fvp = fvbm[nccPatchi];
668 
669  if (isA<nonConformalCoupledFvPatch>(fvp))
670  {
671  const nonConformalCoupledFvPatch& nccFvp =
672  refCast<const nonConformalCoupledFvPatch>(fvp);
673 
674  const label origPatchi = nccFvp.origPatchID();
675  const fvPatch& origFvp = nccFvp.origPatch();
676 
677  const labelList nccOrigPatchFace =
678  nccFvp.polyFaces() - origFvp.start();
679 
680  // Set the cyclic values
681  fieldb[nccPatchi] =
682  Field<Type>(nccFieldb[origPatchi], nccOrigPatchFace);
683  }
684  }
685 
686  // If a flux then scale down to the part face area
687  if (isFluxField)
688  {
689  const surfaceScalarField::Boundary origNccMagSfb
690  (
693  );
694 
695  forAll(fvbm, nccPatchi)
696  {
697  const fvPatch& fvp = fvbm[nccPatchi];
698 
699  if (isA<nonConformalCoupledFvPatch>(fvp))
700  {
701  const nonConformalCoupledFvPatch& nccFvp =
702  refCast<const nonConformalCoupledFvPatch>(fvp);
703 
704  const label origPatchi = nccFvp.origPatchID();
705  const fvPatch& origFvp = nccFvp.origPatch();
706 
707  const labelList nccOrigPatchFace =
708  nccFvp.polyFaces() - origFvp.start();
709 
710  const scalarField origSumMagSf
711  (
712  magSfb[origPatchi] + origNccMagSfb[origPatchi]
713  );
714  const scalarField nccSumMagSf(origSumMagSf, nccOrigPatchFace);
715 
716  fieldb[nccPatchi] *= magSfb[nccPatchi]/nccSumMagSf;
717 
718  if (!isA<processorFvPatch>(fvp))
719  {
720  fieldb[origPatchi] *= magSfb[origPatchi]/origSumMagSf;
721  }
722  }
723  }
724  }
725 
726  // Set error values
727  forAll(fvbm, patchi)
728  {
729  const fvPatch& fvp = fvbm[patchi];
730 
731  if (isA<nonConformalErrorFvPatch>(fvp))
732  {
733  const label errorPatchi = patchi;
734 
735  const nonConformalErrorFvPatch& errorFvp =
736  refCast<const nonConformalErrorFvPatch>(fvp);
737 
738  const label origPatchi = errorFvp.origPatchID();
739  const fvPatch& origFvp = errorFvp.origPatch();
740 
741  const labelList errorOrigPatchFace =
742  errorFvp.polyFaces() - origFvp.start();
743 
744  if (isFluxField)
745  {
746  fieldb[errorPatchi] = Zero;
747  }
748  else
749  {
750  fieldb[errorPatchi] =
751  Field<Type>(origFieldb[origPatchi], errorOrigPatchFace);
752  }
753  }
754  }
755 
756  return tfieldb;
757 }
758 
759 
760 template<class Type>
763 (
764  const SurfaceFieldBoundary<Type>& fieldb,
765  const bool flip,
766  const scalar ownerWeight,
767  const scalar neighbourWeight
768 ) const
769 {
770  const fvBoundaryMesh& fvbm = fieldb[0].patch().boundaryMesh();
771 
772  tmp<SurfaceFieldBoundary<Type>> tsyncFieldb
773  (
775  (
777  fieldb
778  )
779  );
780 
781  SurfaceFieldBoundary<Type>& syncFieldb = tsyncFieldb.ref();
782 
784  (
786  fieldb.boundaryNeighbourField()
787  );
788 
789  forAll(fvbm, patchi)
790  {
791  const fvPatch& fvp = fvbm[patchi];
792 
793  if (fvp.coupled())
794  {
795  const coupledFvPatch& cfvp = refCast<const coupledFvPatch>(fvp);
796 
797  const scalar w = cfvp.owner() ? ownerWeight : neighbourWeight;
798  const scalar v = cfvp.owner() ? neighbourWeight : ownerWeight;
799 
800  syncFieldb[patchi] =
801  w*syncFieldb[patchi] + (flip ? -v : +v)*fieldbNbr[patchi];
802  }
803  }
804 
805  return tsyncFieldb;
806 }
807 
808 
809 template<class Type>
812 (
813  const SurfaceFieldBoundary<Type>& fieldb
814 ) const
815 {
816  const bool isFluxField = isFlux(fieldb[0].internalField());
817 
818  return synchronisedBoundaryField<Type>
819  (
820  fieldb,
821  isFluxField,
822  0.5,
823  0.5
824  );
825 }
826 
827 
828 // ************************************************************************* //
Foam::surfaceFields.
static tmp< Field< Type > > fieldRMapSum(const Field< Type > &f, const label size, const labelUList &addr)
Reverse-map sum the values of a field.
tmp< SurfaceFieldBoundary< Type > > conformalNccBoundaryField(const SurfaceFieldBoundary< Type > &fieldb) const
Extract the non-conformal-coupled parts of the boundary field.
Return the vol-field velocity corresponding to a given surface-field velocity.
Field sizing mapper which sets the field size and does not map values.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
virtual bool owner() const
Does this side own the patch ?
tmp< SurfaceFieldBoundary< Type > > nonConformalBoundaryField(const SurfaceFieldBoundary< Type > &nccFieldb, const SurfaceFieldBoundary< Type > &origFieldb) const
Combine non-conformal-coupled and original parts of the.
Non-conformal error FV patch. As nonConformalFvPatch. This patch is a non-coupled non-conformal patch...
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
virtual label start() const
Return start label of this patch in the polyMesh face list.
Definition: fvPatch.H:151
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:181
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
An abstract base class for patches that couple regions of the computational domain e...
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
#define PreConformSurfaceFields(Type, nullArg)
const volVectorField & surfaceToVolVelocity(const surfaceVectorField &Uf)
Get the cell velocity field corresponding to a given face velocity, or a.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
Traits class for primitives.
Definition: pTraits.H:50
static label nRequests()
Get number of outstanding requests.
Definition: UPstream.C:137
Generic GeometricField class.
const labelList & polyFaces() const
Return face face-poly-faces.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:59
#define StoreOldTimeFields(Type, nullArg)
#define PostNonConformSurfaceFields(Type, nullArg)
tmp< SurfaceFieldBoundary< scalar > > getOrigNccMagSfb() const
Return the total non-conformal area associated with each.
void resizeBoundaryFieldPatchFields(const SurfaceFieldBoundary< label > &polyFacesBf, GeoBoundaryField &fieldBf)
Resize the patch field of a given field to match the mesh.
bool isNull(const T &t)
Return true if t is a reference to the nullObject of type T.
Definition: nullObjectI.H:46
tmp< SurfaceFieldBoundary< Type > > conformalOrigBoundaryField(const SurfaceFieldBoundary< Type > &fieldb) const
Extract the original parts of the boundary field and store it.
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
Pre-declare SubField and related Field type.
Definition: Field.H:56
const fvMesh & mesh() const
Return the mesh reference.
void resizeFieldPatchFields(const SurfaceFieldBoundary< label > &polyFacesBf, GeoField &field)
Resize the patch field of a given field to match the mesh.
void clear()
Clear the list, i.e. set size to zero.
Definition: ListI.H:125
tmp< SurfaceFieldBoundary< Type > > synchronisedBoundaryField(const SurfaceFieldBoundary< Type > &fieldb, const bool flip, const scalar ownerWeight, const scalar neighbourWeight) const
Synchronise the boundary field by combining corresponding.
labelList allOrigPatchIDs() const
Return a list of the orig patch indices.
Foam::fvPatchFieldMapper.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
static const zero Zero
Definition: zero.H:97
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField of the values on the other side of couples.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
virtual label size() const
Return size.
Definition: fvPatch.H:157
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
#define ResizePatchFields(Type, nullArg)
static nonConformalBoundary & New(polyMesh &mesh)
Definition: MeshObject.C:54
labelList f(nPoints)
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
Definition: UPstream.C:147
Non-conformal coupled FV patch. As nonConformalFvPatch, but is also coupled to another non-conformal ...
Generic GeometricBoundaryField class.
Definition: fvMesh.H:80
const labelList & polyFaces() const
Return face face-poly-faces.
bool isFlux(const DimensionedField< Type, surfaceMesh > &df)
Check if surfaceField is a flux.
Definition: surfaceFields.H:55
#define EvaluateVolFields(Type, nullArg)
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:272
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:399
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
Definition: createFields.H:131
label patchi
PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
const fvPatch & origPatch() const
Original patch.
Foam::fvBoundaryMesh.
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
label origPatchID() const
Original patch ID.
A class for managing temporary objects.
Definition: PtrList.H:53
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
virtual bool coupled() const
Return true if this patch is coupled.
Definition: fvPatch.H:163
HashTable< const Type * > lookupClass(const bool strict=false) const
Lookup and return all objects of the given Type.