meshToMeshTemplates.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 | Copyright (C) 2012-2014 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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 "fvMesh.H"
27 #include "volFields.H"
29 #include "calculatedFvPatchField.H"
30 #include "fvcGrad.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37  //- Helper class for list
38  template<class Type>
39  class ListPlusEqOp
40  {
41  public:
42  void operator()(List<Type>& x, const List<Type> y) const
43  {
44  if (y.size())
45  {
46  if (x.size())
47  {
48  label sz = x.size();
49  x.setSize(sz + y.size());
50  forAll(y, i)
51  {
52  x[sz++] = y[i];
53  }
54  }
55  else
56  {
57  x = y;
58  }
59  }
60  }
61  };
62 }
63 
64 
65 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
66 
67 template<class Type>
69 (
71  const label offset
72 ) const
73 {
74  forAll(fld, i)
75  {
76  fld[i] += offset;
77  }
78 }
79 
80 
81 template<class Type, class CombineOp>
83 (
84  const UList<Type>& srcField,
85  const CombineOp& cop,
86  List<Type>& result
87 ) const
88 {
89  if (result.size() != tgtToSrcCellAddr_.size())
90  {
92  << "Supplied field size is not equal to target mesh size" << nl
93  << " source mesh = " << srcToTgtCellAddr_.size() << nl
94  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
95  << " supplied field = " << result.size()
96  << abort(FatalError);
97  }
98 
100 
101  if (singleMeshProc_ == -1)
102  {
103  const mapDistribute& map = srcMapPtr_();
104 
105  List<Type> work(srcField);
106  map.distribute(work);
107 
108  forAll(result, cellI)
109  {
110  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
111  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
112 
113  if (srcAddress.size())
114  {
115  result[cellI] *= (1.0 - sum(srcWeight));
116  forAll(srcAddress, i)
117  {
118  label srcI = srcAddress[i];
119  scalar w = srcWeight[i];
120  cbop(result[cellI], cellI, work[srcI], w);
121  }
122  }
123  }
124  }
125  else
126  {
127  forAll(result, cellI)
128  {
129  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
130  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
131 
132  if (srcAddress.size())
133  {
134  result[cellI] *= (1.0 - sum(srcWeight));
135  forAll(srcAddress, i)
136  {
137  label srcI = srcAddress[i];
138  scalar w = srcWeight[i];
139  cbop(result[cellI], cellI, srcField[srcI], w);
140  }
141  }
142  }
143  }
144 }
145 
146 
147 template<class Type, class CombineOp>
149 (
150  const UList<Type>& srcField,
151  const UList<typename outerProduct<vector, Type>::type>& srcGradField,
152  const CombineOp& cop,
153  List<Type>& result
154 ) const
155 {
156  if (result.size() != tgtToSrcCellAddr_.size())
157  {
159  << "Supplied field size is not equal to target mesh size" << nl
160  << " source mesh = " << srcToTgtCellAddr_.size() << nl
161  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
162  << " supplied field = " << result.size()
163  << abort(FatalError);
164  }
165 
167 
168  if (singleMeshProc_ == -1)
169  {
170  if (returnReduce(tgtToSrcCellVec_.size(), sumOp<label>()) == 0)
171  {
172  // No correction vectors calculated. Fall back to first order.
173  mapSrcToTgt(srcField, cop, result);
174  return;
175  }
176 
177  const mapDistribute& map = srcMapPtr_();
178 
179  List<Type> work(srcField);
180  map.distribute(work);
181 
183  (
184  srcGradField
185  );
186  map.distribute(workGrad);
187 
188  forAll(result, cellI)
189  {
190  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
191  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
192  const pointList& srcVec = tgtToSrcCellVec_[cellI];
193 
194  if (srcAddress.size())
195  {
196  result[cellI] *= (1.0 - sum(srcWeight));
197  forAll(srcAddress, i)
198  {
199  label srcI = srcAddress[i];
200  scalar w = srcWeight[i];
201  const vector& v = srcVec[i];
202  const Type srcVal = work[srcI]+(workGrad[srcI]&v);
203  cbop(result[cellI], cellI, srcVal, w);
204  }
205  }
206  }
207  }
208  else
209  {
210  if (tgtToSrcCellVec_.empty())
211  {
212  // No correction vectors calculated. Fall back to first order.
213  mapSrcToTgt(srcField, cop, result);
214  return;
215  }
216 
217  forAll(result, cellI)
218  {
219  const labelList& srcAddress = tgtToSrcCellAddr_[cellI];
220  const scalarList& srcWeight = tgtToSrcCellWght_[cellI];
221  const pointList& srcVec = tgtToSrcCellVec_[cellI];
222 
223  if (srcAddress.size())
224  {
225  // Do non-conservative interpolation
226  result[cellI] *= (1.0 - sum(srcWeight));
227  forAll(srcAddress, i)
228  {
229  label srcI = srcAddress[i];
230  scalar w = srcWeight[i];
231  const vector& v = srcVec[i];
232  const Type srcVal = srcField[srcI]+(srcGradField[srcI]&v);
233  cbop(result[cellI], cellI, srcVal, w);
234  }
235  }
236  }
237  }
238 }
239 
240 
241 template<class Type, class CombineOp>
243 (
244  const Field<Type>& srcField,
245  const CombineOp& cop
246 ) const
247 {
248  tmp<Field<Type> > tresult
249  (
250  new Field<Type>
251  (
252  tgtToSrcCellAddr_.size(),
254  )
255  );
256 
257  mapSrcToTgt(srcField, cop, tresult());
258 
259  return tresult;
260 }
261 
262 
263 template<class Type, class CombineOp>
265 (
266  const tmp<Field<Type> >& tsrcField,
267  const CombineOp& cop
268 ) const
269 {
270  return mapSrcToTgt(tsrcField(), cop);
271 }
272 
273 
274 template<class Type>
276 (
277  const Field<Type>& srcField
278 ) const
279 {
280  return mapSrcToTgt(srcField, plusEqOp<Type>());
281 }
282 
283 
284 template<class Type>
286 (
287  const tmp<Field<Type> >& tsrcField
288 ) const
289 {
290  return mapSrcToTgt(tsrcField());
291 }
292 
293 
294 template<class Type, class CombineOp>
296 (
297  const UList<Type>& tgtField,
298  const CombineOp& cop,
299  List<Type>& result
300 ) const
301 {
302  if (result.size() != srcToTgtCellAddr_.size())
303  {
305  << "Supplied field size is not equal to source mesh size" << nl
306  << " source mesh = " << srcToTgtCellAddr_.size() << nl
307  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
308  << " supplied field = " << result.size()
309  << abort(FatalError);
310  }
311 
313 
314  if (singleMeshProc_ == -1)
315  {
316  const mapDistribute& map = tgtMapPtr_();
317 
318  List<Type> work(tgtField);
319  map.distribute(work);
320 
321  forAll(result, cellI)
322  {
323  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
324  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
325 
326  if (tgtAddress.size())
327  {
328  result[cellI] *= (1.0 - sum(tgtWeight));
329  forAll(tgtAddress, i)
330  {
331  label tgtI = tgtAddress[i];
332  scalar w = tgtWeight[i];
333  cbop(result[cellI], cellI, work[tgtI], w);
334  }
335  }
336  }
337  }
338  else
339  {
340  forAll(result, cellI)
341  {
342  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
343  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
344 
345  if (tgtAddress.size())
346  {
347  result[cellI] *= (1.0 - sum(tgtWeight));
348  forAll(tgtAddress, i)
349  {
350  label tgtI = tgtAddress[i];
351  scalar w = tgtWeight[i];
352  cbop(result[cellI], cellI, tgtField[tgtI], w);
353  }
354  }
355  }
356  }
357 }
358 
359 
360 template<class Type, class CombineOp>
362 (
363  const UList<Type>& tgtField,
364  const UList<typename outerProduct<vector, Type>::type>& tgtGradField,
365  const CombineOp& cop,
366  List<Type>& result
367 ) const
368 {
369  if (result.size() != srcToTgtCellAddr_.size())
370  {
372  << "Supplied field size is not equal to source mesh size" << nl
373  << " source mesh = " << srcToTgtCellAddr_.size() << nl
374  << " target mesh = " << tgtToSrcCellAddr_.size() << nl
375  << " supplied field = " << result.size()
376  << abort(FatalError);
377  }
378 
380 
381  if (singleMeshProc_ == -1)
382  {
383  if (returnReduce(srcToTgtCellVec_.size(), sumOp<label>()) == 0)
384  {
385  // No correction vectors calculated. Fall back to first order.
386  mapTgtToSrc(tgtField, cop, result);
387  return;
388  }
389 
390  const mapDistribute& map = tgtMapPtr_();
391 
392  List<Type> work(tgtField);
393  map.distribute(work);
394 
396  (
397  tgtGradField
398  );
399  map.distribute(workGrad);
400 
401  forAll(result, cellI)
402  {
403  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
404  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
405  const pointList& tgtVec = srcToTgtCellVec_[cellI];
406 
407  if (tgtAddress.size())
408  {
409  result[cellI] *= (1.0 - sum(tgtWeight));
410  forAll(tgtAddress, i)
411  {
412  label tgtI = tgtAddress[i];
413  scalar w = tgtWeight[i];
414  const vector& v = tgtVec[i];
415  const Type tgtVal = work[tgtI]+(workGrad[tgtI]&v);
416  cbop(result[cellI], cellI, tgtVal, w);
417  }
418  }
419  }
420  }
421  else
422  {
423  forAll(result, cellI)
424  {
425  const labelList& tgtAddress = srcToTgtCellAddr_[cellI];
426  const scalarList& tgtWeight = srcToTgtCellWght_[cellI];
427  const pointList& tgtVec = srcToTgtCellVec_[cellI];
428 
429  if (tgtAddress.size())
430  {
431  result[cellI] *= (1.0 - sum(tgtWeight));
432  forAll(tgtAddress, i)
433  {
434  label tgtI = tgtAddress[i];
435  scalar w = tgtWeight[i];
436  const vector& v = tgtVec[i];
437  const Type tgtVal = tgtField[tgtI]+(tgtGradField[tgtI]&v);
438  cbop(result[cellI], cellI, tgtVal, w);
439  }
440  }
441  }
442  }
443 }
444 
445 
446 template<class Type, class CombineOp>
448 (
449  const Field<Type>& tgtField,
450  const CombineOp& cop
451 ) const
452 {
453  tmp<Field<Type> > tresult
454  (
455  new Field<Type>
456  (
457  srcToTgtCellAddr_.size(),
459  )
460  );
461 
462  mapTgtToSrc(tgtField, cop, tresult());
463 
464  return tresult;
465 }
466 
467 
468 template<class Type, class CombineOp>
470 (
471  const tmp<Field<Type> >& ttgtField,
472  const CombineOp& cop
473 ) const
474 {
475  return mapTgtToSrc(ttgtField(), cop);
476 }
477 
478 
479 template<class Type>
481 (
482  const Field<Type>& tgtField
483 ) const
484 {
485  return mapTgtToSrc(tgtField, plusEqOp<Type>());
486 }
487 
488 
489 template<class Type>
491 (
492  const tmp<Field<Type> >& ttgtField
493 ) const
494 {
495  return mapTgtToSrc(ttgtField(), plusEqOp<Type>());
496 }
497 
498 
499 template<class Type, class CombineOp>
501 (
503  const CombineOp& cop,
505  const bool secondOrder
506 ) const
507 {
508  if (secondOrder && returnReduce(tgtToSrcCellVec_.size(), sumOp<label>()))
509  {
510  mapSrcToTgt
511  (
512  field,
513  fvc::grad(field)().internalField(),
514  cop,
515  result.internalField()
516  );
517  }
518  else
519  {
520  mapSrcToTgt(field, cop, result.internalField());
521  }
522 }
523 
524 
525 template<class Type, class CombineOp>
527 (
528  const AMIPatchToPatchInterpolation& AMI,
529  const Field<Type>& srcField,
530  Field<Type>& tgtField,
531  const CombineOp& cop
532 ) const
533 {
534  tgtField = pTraits<Type>::zero;
535 
537  (
538  srcField,
540  tgtField,
542  );
543 }
544 
545 
546 template<class Type, class CombineOp>
548 (
550  const CombineOp& cop,
552  const bool secondOrder
553 ) const
554 {
555  mapInternalSrcToTgt(field, cop, result, secondOrder);
556 
557 
558  const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
559 
560  forAll(AMIList, i)
561  {
562  label srcPatchI = srcPatchID_[i];
563  label tgtPatchI = tgtPatchID_[i];
564 
565  const fvPatchField<Type>& srcField = field.boundaryField()[srcPatchI];
566  fvPatchField<Type>& tgtField = result.boundaryField()[tgtPatchI];
567 
568 
569  // Clone and map (since rmap does not do general mapping)
570  tmp<fvPatchField<Type> > tnewTgt
571  (
573  (
574  srcField,
575  tgtField.patch(),
576  result.dimensionedInternalField(),
578  (
579  AMIList[i].singlePatchProc(),
580  (
581  AMIList[i].singlePatchProc() == -1
582  ? &AMIList[i].srcMap()
583  : NULL
584  ),
585  AMIList[i].tgtAddress(),
586  AMIList[i].tgtWeights()
587  )
588  )
589  );
590 
591  // Transfer all mapped quantities (value and e.g. gradient) onto
592  // tgtField
593  tgtField.rmap(tnewTgt(), identity(tgtField.size()));
594 
595 
596  // Override value to account for CombineOp (note: is dummy template
597  // specialisation for plusEqOp)
598  mapAndOpSrcToTgt(AMIList[i], srcField, tgtField, cop);
599  }
600 
601  forAll(cuttingPatches_, i)
602  {
603  label patchI = cuttingPatches_[i];
604  fvPatchField<Type>& pf = result.boundaryField()[patchI];
605  pf == pf.patchInternalField();
606  }
607 }
608 
609 
610 template<class Type, class CombineOp>
613 (
615  const CombineOp& cop,
616  const bool secondOrder
617 ) const
618 {
620 
621  const fvMesh& tgtMesh = static_cast<const fvMesh&>(tgtRegion_);
622 
623  const fvBoundaryMesh& tgtBm = tgtMesh.boundary();
624  const typename fieldType::GeometricBoundaryField& srcBfld =
625  field.boundaryField();
626 
627  PtrList<fvPatchField<Type> > tgtPatchFields(tgtBm.size());
628 
629  // constuct tgt boundary patch types as copy of 'field' boundary types
630  // note: this will provide place holders for fields with additional
631  // entries, but these values will need to be reset
632  forAll(tgtPatchID_, i)
633  {
634  label srcPatchI = srcPatchID_[i];
635  label tgtPatchI = tgtPatchID_[i];
636 
637  if (!tgtPatchFields.set(tgtPatchI))
638  {
639  tgtPatchFields.set
640  (
641  tgtPatchI,
643  (
644  srcBfld[srcPatchI],
645  tgtMesh.boundary()[tgtPatchI],
648  (
649  labelList(tgtMesh.boundary()[tgtPatchI].size(), -1)
650  )
651  )
652  );
653  }
654  }
655 
656  // Any unset tgtPatchFields become calculated
657  forAll(tgtPatchFields, tgtPatchI)
658  {
659  if (!tgtPatchFields.set(tgtPatchI))
660  {
661  // Note: use factory New method instead of direct generation of
662  // calculated so we keep constraints
663  tgtPatchFields.set
664  (
665  tgtPatchI,
667  (
669  tgtMesh.boundary()[tgtPatchI],
671  )
672  );
673  }
674  }
675 
676  tmp<fieldType> tresult
677  (
678  new fieldType
679  (
680  IOobject
681  (
682  type() + ":interpolate(" + field.name() + ")",
683  tgtMesh.time().timeName(),
684  tgtMesh,
685  IOobject::NO_READ,
686  IOobject::NO_WRITE
687  ),
688  tgtMesh,
689  field.dimensions(),
691  tgtPatchFields
692  )
693  );
694 
695  mapSrcToTgt(field, cop, tresult(), secondOrder);
696 
697  return tresult;
698 }
699 
700 
701 template<class Type, class CombineOp>
704 (
706  const CombineOp& cop,
707  const bool secondOrder
708 ) const
709 {
710  return mapSrcToTgt(tfield(), cop, secondOrder);
711 }
712 
713 
714 template<class Type>
717 (
719  const bool secondOrder
720 ) const
721 {
722  return mapSrcToTgt(field, plusEqOp<Type>(), secondOrder);
723 }
724 
725 
726 template<class Type>
729 (
731  const bool secondOrder
732 ) const
733 {
734  return mapSrcToTgt(tfield(), plusEqOp<Type>(), secondOrder);
735 }
736 
737 
738 template<class Type, class CombineOp>
740 (
742  const CombineOp& cop,
744  const bool secondOrder
745 ) const
746 {
747  if (secondOrder && returnReduce(srcToTgtCellVec_.size(), sumOp<label>()))
748  {
749  mapTgtToSrc
750  (
751  field,
752  fvc::grad(field)().internalField(),
753  cop,
754  result.internalField()
755  );
756  }
757  else
758  {
759  mapTgtToSrc(field, cop, result.internalField());
760  }
761 }
762 
763 
764 template<class Type, class CombineOp>
766 (
767  const AMIPatchToPatchInterpolation& AMI,
768  Field<Type>& srcField,
769  const Field<Type>& tgtField,
770  const CombineOp& cop
771 ) const
772 {
773  srcField = pTraits<Type>::zero;
774 
776  (
777  tgtField,
779  srcField,
781  );
782 }
783 
784 
785 template<class Type, class CombineOp>
787 (
789  const CombineOp& cop,
791  const bool secondOrder
792 ) const
793 {
794  mapInternalTgtToSrc(field, cop, result, secondOrder);
795 
796 
797  const PtrList<AMIPatchToPatchInterpolation>& AMIList = patchAMIs();
798 
799  forAll(AMIList, i)
800  {
801  label srcPatchI = srcPatchID_[i];
802  label tgtPatchI = tgtPatchID_[i];
803 
804  fvPatchField<Type>& srcField = result.boundaryField()[srcPatchI];
805  const fvPatchField<Type>& tgtField = field.boundaryField()[tgtPatchI];
806 
807 
808  // Clone and map (since rmap does not do general mapping)
809  tmp<fvPatchField<Type> > tnewSrc
810  (
812  (
813  tgtField,
814  srcField.patch(),
815  result.dimensionedInternalField(),
817  (
818  AMIList[i].singlePatchProc(),
819  (
820  AMIList[i].singlePatchProc() == -1
821  ? &AMIList[i].tgtMap()
822  : NULL
823  ),
824  AMIList[i].srcAddress(),
825  AMIList[i].srcWeights()
826  )
827  )
828  );
829 
830  // Transfer all mapped quantities (value and e.g. gradient) onto
831  // tgtField
832  srcField.rmap(tnewSrc(), identity(srcField.size()));
833 
834 
835  // Override value to account for CombineOp (could be dummy for
836  // plusEqOp)
837  mapAndOpTgtToSrc(AMIList[i], srcField, tgtField, cop);
838  }
839 
840  forAll(cuttingPatches_, i)
841  {
842  label patchI = cuttingPatches_[i];
843  fvPatchField<Type>& pf = result.boundaryField()[patchI];
844  pf == pf.patchInternalField();
845  }
846 }
847 
848 
849 template<class Type, class CombineOp>
852 (
854  const CombineOp& cop,
855  const bool secondOrder
856 ) const
857 {
859 
860  const fvMesh& srcMesh = static_cast<const fvMesh&>(srcRegion_);
861 
862  const fvBoundaryMesh& srcBm = srcMesh.boundary();
863  const typename fieldType::GeometricBoundaryField& tgtBfld =
864  field.boundaryField();
865 
866  PtrList<fvPatchField<Type> > srcPatchFields(srcBm.size());
867 
868  // constuct src boundary patch types as copy of 'field' boundary types
869  // note: this will provide place holders for fields with additional
870  // entries, but these values will need to be reset
871  forAll(srcPatchID_, i)
872  {
873  label srcPatchI = srcPatchID_[i];
874  label tgtPatchI = tgtPatchID_[i];
875 
876  if (!srcPatchFields.set(tgtPatchI))
877  {
878  srcPatchFields.set
879  (
880  srcPatchI,
882  (
883  tgtBfld[srcPatchI],
884  srcMesh.boundary()[tgtPatchI],
887  (
888  labelList(srcMesh.boundary()[srcPatchI].size(), -1)
889  )
890  )
891  );
892  }
893  }
894 
895  // Any unset srcPatchFields become calculated
896  forAll(srcPatchFields, srcPatchI)
897  {
898  if (!srcPatchFields.set(srcPatchI))
899  {
900  // Note: use factory New method instead of direct generation of
901  // calculated so we keep constraints
902  srcPatchFields.set
903  (
904  srcPatchI,
906  (
908  srcMesh.boundary()[srcPatchI],
910  )
911  );
912  }
913  }
914 
915  tmp<fieldType> tresult
916  (
917  new fieldType
918  (
919  IOobject
920  (
921  type() + ":interpolate(" + field.name() + ")",
922  srcMesh.time().timeName(),
923  srcMesh,
924  IOobject::NO_READ,
925  IOobject::NO_WRITE
926  ),
927  srcMesh,
928  field.dimensions(),
930  srcPatchFields
931  )
932  );
933 
934  mapTgtToSrc(field, cop, tresult(), secondOrder);
935 
936  return tresult;
937 }
938 
939 
940 template<class Type, class CombineOp>
943 (
945  const CombineOp& cop,
946  const bool secondOrder
947 ) const
948 {
949  return mapTgtToSrc(tfield(), cop, secondOrder);
950 }
951 
952 
953 template<class Type>
956 (
958  const bool secondOrder
959 ) const
960 {
961  return mapTgtToSrc(field, plusEqOp<Type>(), secondOrder);
962 }
963 
964 
965 template<class Type>
968 (
970  const bool secondOrder
971 ) const
972 {
973  return mapTgtToSrc(tfield(), plusEqOp<Type>(), secondOrder);
974 }
975 
976 
977 // ************************************************************************* //
Foam::fvPatchField< Type >
volFields.H
Foam::IOobject
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Foam::meshToMesh::mapTgtToSrc
void mapTgtToSrc(const UList< Type > &tgtFld, const CombineOp &cop, List< Type > &result) const
Map field from tgt to src mesh with defined operation.
Definition: meshToMeshTemplates.C:296
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:52
w
volScalarField w(IOobject("w", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE), mesh, dimensionedScalar("w", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0))
Foam::GeometricField::dimensionedInternalField
DimensionedInternalField & dimensionedInternalField()
Return dimensioned internal field.
Definition: GeometricField.C:713
Foam::labelList
List< label > labelList
A List of labels.
Definition: labelList.H:56
Foam::returnReduce
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Definition: PstreamReduceOps.H:86
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::meshToMesh::mapAndOpSrcToTgt
void mapAndOpSrcToTgt(const AMIPatchToPatchInterpolation &AMI, const Field< Type > &srcField, Field< Type > &tgtField, const CombineOp &cop) const
Helper function to interpolate patch field. Template.
Definition: meshToMeshTemplates.C:527
Foam::outerProduct::type
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
Definition: products.H:72
calculatedFvPatchField.H
Foam::ListPlusEqOp::operator()
void operator()(List< Type > &x, const List< Type > y) const
Definition: meshToMeshTemplates.C:42
Foam::GeometricField::boundaryField
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
Definition: GeometricField.C:735
Foam::meshToMesh::mapSrcToTgt
void mapSrcToTgt(const UList< Type > &srcFld, const CombineOp &cop, List< Type > &result) const
Map field from src to tgt mesh with defined operation.
Definition: meshToMeshTemplates.C:83
Foam::AMIInterpolation::interpolateToTarget
void interpolateToTarget(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from source to target with supplied op.
Definition: AMIInterpolation.C:1321
Foam::fvBoundaryMesh
Foam::fvBoundaryMesh.
Definition: fvBoundaryMesh.H:52
Foam::primitiveMesh::nCells
label nCells() const
Definition: primitiveMeshI.H:64
Foam::PtrList::set
bool set(const label) const
Is element set.
Foam::label
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
Foam::AMIInterpolation::interpolateToSource
void interpolateToSource(const UList< Type > &fld, const CombineOp &cop, List< Type > &result, const UList< Type > &defaultValues=UList< Type >::null()) const
Interpolate from target to source with supplied op.
Definition: AMIInterpolation.C:1406
Foam::Field< Type >
Foam::meshToMesh::mapInternalSrcToTgt
void mapInternalSrcToTgt(const GeometricField< Type, fvPatchField, volMesh > &field, const CombineOp &cop, GeometricField< Type, fvPatchField, volMesh > &result, const bool secondOrder) const
Helper function to interpolate internal field. Optionally uses.
Definition: meshToMeshTemplates.C:501
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::mapDistribute
Class containing processor-to-processor mapping information.
Definition: mapDistribute.H:152
Foam::fvPatchField::patchInternalField
virtual tmp< Field< Type > > patchInternalField() const
Return internal field next to patch as patch field.
Definition: fvPatchField.C:208
Foam::GeometricField::internalField
InternalField & internalField()
Return internal field.
Definition: GeometricField.C:724
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
directFvPatchFieldMapper.H
Foam::mapDistribute::distribute
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
Definition: mapDistributeTemplates.C:155
Foam::identity
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Definition: ListOps.C:104
Foam::fvPatchField::rmap
virtual void rmap(const fvPatchField< Type > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Definition: fvPatchField.C:286
Foam::FatalError
error FatalError
fld
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::plusEqOp
Definition: ops.H:71
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
fvMesh.H
Foam::calculatedFvPatchField
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
Definition: calculatedFvPatchField.H:65
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
internalField
conserve internalField()+
Foam::fvMesh::boundary
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Definition: fvMesh.C:550
Foam::multiplyWeightedOp
Definition: ops.H:185
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::sumOp
Definition: ops.H:162
Foam::Vector< scalar >
Foam::Time::timeName
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:741
Foam::List< Type >
Foam::pTraits
Traits class for primitives.
Definition: pTraits.H:50
Foam::meshToMesh::add
void add(UList< Type > &fld, const label offset) const
Helper function to add a constant offset to a list.
Definition: meshToMeshTemplates.C:69
fvcGrad.H
Calculate the gradient of the given field.
Foam::AMIInterpolation
Interpolation class dealing with transfer of data between two primitive patches with an arbitrary mes...
Definition: AMIInterpolation.H:77
Foam::UList< Type >
Foam::PtrList::size
label size() const
Return the number of elements in the PtrList.
Definition: PtrListI.H:32
Foam::sum
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:333
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::directFvPatchFieldMapper
direct fvPatchFieldMapper
Definition: directFvPatchFieldMapper.H:45
Foam::fvMesh::time
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:243
distributedWeightedFvPatchFieldMapper.H
Foam::fvPatchField::patch
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:300
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::meshToMesh::mapAndOpTgtToSrc
void mapAndOpTgtToSrc(const AMIPatchToPatchInterpolation &AMI, Field< Type > &srcField, const Field< Type > &tgtField, const CombineOp &cop) const
Helper function to interpolate patch field. Template.
Definition: meshToMeshTemplates.C:766
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
Foam::distributedWeightedFvPatchFieldMapper
FieldMapper with weighted mapping from (optionally remote) quantities.
Definition: distributedWeightedFvPatchFieldMapper.H:46
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51
Foam::meshToMesh::mapInternalTgtToSrc
void mapInternalTgtToSrc(const GeometricField< Type, fvPatchField, volMesh > &field, const CombineOp &cop, GeometricField< Type, fvPatchField, volMesh > &result, const bool secondOrder) const
Helper function to interpolate internal field. Optionally uses.
Definition: meshToMeshTemplates.C:740
y
scalar y
Definition: LISASMDCalcMethod1.H:14