KinematicCloud.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016-2023 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 "KinematicCloud.H"
30 #include "integrationScheme.H"
31 #include "interpolation.H"
32 #include "subCycleTime.H"
33 
34 #include "InjectionModelList.H"
35 #include "DispersionModel.H"
36 #include "PatchInteractionModel.H"
38 #include "SurfaceFilmModel.H"
39 #include "profiling.H"
40 
41 #include "PackingModel.H"
42 #include "ParticleStressModel.H"
43 #include "DampingModel.H"
44 #include "IsotropyModel.H"
45 #include "TimeScaleModel.H"
46 
47 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
48 
49 template<class CloudType>
51 {
52  dispersionModel_.reset
53  (
55  (
56  subModelProperties_,
57  *this
58  ).ptr()
59  );
60 
61  patchInteractionModel_.reset
62  (
64  (
65  subModelProperties_,
66  *this
67  ).ptr()
68  );
69 
70  stochasticCollisionModel_.reset
71  (
73  (
74  subModelProperties_,
75  *this
76  ).ptr()
77  );
78 
79  surfaceFilmModel_.reset
80  (
82  (
83  subModelProperties_,
84  *this
85  ).ptr()
86  );
87 
88  packingModel_.reset
89  (
91  (
92  subModelProperties_,
93  *this
94  ).ptr()
95  );
96 
97  dampingModel_.reset
98  (
100  (
101  subModelProperties_,
102  *this
103  ).ptr()
104  );
105 
106  isotropyModel_.reset
107  (
109  (
110  subModelProperties_,
111  *this
112  ).ptr()
113  );
114 
115  UIntegrator_.reset
116  (
118  (
119  "U",
120  solution_.integrationSchemes()
121  ).ptr()
122  );
123 }
124 
125 
126 template<class CloudType>
127 template<class TrackCloudType>
129 (
130  TrackCloudType& cloud,
131  typename parcelType::trackingData& td
132 )
133 {
134  addProfiling(prof, "cloud::solve");
135 
136  log = solution_.log();
137 
138  if (solution_.steadyState())
139  {
140  cloud.storeState();
141 
142  cloud.preEvolve(td);
143 
144  evolveCloud(cloud, td);
145 
146  if (solution_.coupled())
147  {
148  cloud.relaxSources(cloud.cloudCopy());
149  }
150  }
151  else
152  {
153  cloud.preEvolve(td);
154 
155  evolveCloud(cloud, td);
156 
157  if (solution_.coupled())
158  {
159  cloud.scaleSources();
160  }
161  }
162 
163  cloud.info();
164 
165  cloud.postEvolve(td);
166 
167  if (solution_.steadyState())
168  {
169  cloud.restoreState();
170  }
171 }
172 
173 
174 template<class CloudType>
176 {
177  if (!cellOccupancyPtr_)
178  {
179  cellOccupancyPtr_.reset
180  (
181  new List<DynamicList<parcelType*>>(mesh_.nCells())
182  );
183  }
184  else if (cellOccupancyPtr_().size() != mesh_.nCells())
185  {
186  // If the size of the mesh has changed, reset the
187  // cellOccupancy size
188 
189  cellOccupancyPtr_().setSize(mesh_.nCells());
190  }
191 
192  List<DynamicList<parcelType*>>& cellOccupancy = cellOccupancyPtr_();
193 
194  for (auto& list : cellOccupancy)
195  {
196  list.clear();
197  }
198 
199  for (parcelType& p : *this)
200  {
201  cellOccupancy[p.cell()].append(&p);
202  }
203 }
204 
205 
206 template<class CloudType>
208 {
209  // Only build the cellOccupancy if the pointer is set, i.e. it has
210  // been requested before.
211 
212  if (cellOccupancyPtr_)
213  {
214  buildCellOccupancy();
215  }
216 }
217 
218 
219 template<class CloudType>
220 template<class TrackCloudType>
222 (
223  TrackCloudType& cloud,
224  typename parcelType::trackingData& td
225 )
226 {
227  if (solution_.coupled())
228  {
229  cloud.resetSourceTerms();
230  }
231 
232  if (solution_.transient())
233  {
234  label preInjectionSize = this->size();
235 
236  this->surfaceFilm().inject(cloud);
237 
238  // Update the cellOccupancy if the size of the cloud has changed
239  // during the injection.
240  if (preInjectionSize != this->size())
241  {
242  updateCellOccupancy();
243  preInjectionSize = this->size();
244  }
245 
246  injectors_.inject(cloud, td);
247 
248  // Assume that motion will update the cellOccupancy as necessary
249  // before it is required.
250  cloud.motion(cloud, td);
251 
252  stochasticCollision().update(td, solution_.trackTime());
253  }
254  else
255  {
256 // this->surfaceFilm().injectSteadyState(cloud);
257 
258  injectors_.injectSteadyState(cloud, td, solution_.trackTime());
259 
260  td.part() = parcelType::trackingData::tpLinearTrack;
261  CloudType::move(cloud, td, solution_.trackTime());
262  }
263 }
264 
265 
266 template<class CloudType>
268 (
269  const typename parcelType::trackingData& td
270 )
271 {
272  Log_<< endl;
273 
274  if (debug)
275  {
276  this->writePositions();
277  }
278 
279  this->dispersion().cacheFields(false);
280 
281  this->patchInteraction().postEvolve();
282 
283  forces_.cacheFields(false);
284 
285  functions_.postEvolve(td);
286 
287  solution_.nextIter();
288 
289  if (this->db().time().writeTime())
290  {
291  outputProperties_.writeObject
292  (
293  IOstreamOption
294  (
295  IOstreamOption::ASCII,
296  this->db().time().writeCompression()
297  ),
298  true
299  );
300  }
301 
302  if (this->dampingModel().active())
303  {
304  this->dampingModel().cacheFields(false);
305  }
306  if (this->packingModel().active())
307  {
308  this->packingModel().cacheFields(false);
309  }
310 }
311 
312 
313 template<class CloudType>
314 void Foam::KinematicCloud<CloudType>::cloudReset(KinematicCloud<CloudType>& c)
315 {
316  CloudType::cloudReset(c);
317 
318  rndGen_ = c.rndGen_;
319 
320  forces_.transfer(c.forces_);
321 
322  functions_.transfer(c.functions_);
323 
324  injectors_.transfer(c.injectors_);
325 
326  dispersionModel_.reset(c.dispersionModel_.ptr());
327  patchInteractionModel_.reset(c.patchInteractionModel_.ptr());
328  stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr());
329  surfaceFilmModel_.reset(c.surfaceFilmModel_.ptr());
330 
331  packingModel_.reset(c.packingModel_.ptr());
332  dampingModel_.reset(c.dampingModel_.ptr());
333  isotropyModel_.reset(c.isotropyModel_.ptr());
334 
335  UIntegrator_.reset(c.UIntegrator_.ptr());
336 }
337 
338 
339 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
340 
341 template<class CloudType>
343 (
344  const word& cloudName,
345  const volScalarField& rho,
346  const volVectorField& U,
347  const volScalarField& mu,
348  const dimensionedVector& g,
349  bool readFields
350 )
351 :
352  CloudType(rho.mesh(), cloudName, false),
353  kinematicCloud(),
354  cloudCopyPtr_(nullptr),
355  mesh_(rho.mesh()),
356  particleProperties_
357  (
358  IOobject
359  (
360  cloudName + "Properties",
361  mesh_.time().constant(),
362  mesh_,
363  IOobject::MUST_READ_IF_MODIFIED,
364  IOobject::NO_WRITE
365  )
366  ),
367  outputProperties_
368  (
369  IOobject
370  (
371  cloudName + "OutputProperties",
372  mesh_.time().timeName(),
373  "uniform"/cloud::prefix/cloudName,
374  mesh_,
375  IOobject::READ_IF_PRESENT,
376  IOobject::NO_WRITE
377  )
378  ),
379  solution_(mesh_, particleProperties_.subDict("solution")),
380  constProps_(particleProperties_),
381  subModelProperties_
382  (
383  particleProperties_.subOrEmptyDict
384  (
385  "subModels",
386  keyType::REGEX,
387  solution_.active()
388  )
389  ),
390  rndGen_(Pstream::myProcNo()),
391  cellOccupancyPtr_(),
392  cellLengthScale_(mag(cbrt(mesh_.V()))),
393  rho_(rho),
394  U_(U),
395  mu_(mu),
396  g_(g),
397  pAmbient_(0.0),
398  forces_
399  (
400  *this,
401  mesh_,
402  subModelProperties_.subOrEmptyDict
403  (
404  "particleForces",
405  keyType::REGEX,
406  solution_.active()
407  ),
408  solution_.active()
409  ),
410  functions_
411  (
412  *this,
413  particleProperties_.subOrEmptyDict("cloudFunctions"),
414  solution_.active()
415  ),
416  injectors_
417  (
418  subModelProperties_.subOrEmptyDict("injectionModels"),
419  *this
420  ),
421  dispersionModel_(nullptr),
422  patchInteractionModel_(nullptr),
423  stochasticCollisionModel_(nullptr),
424  surfaceFilmModel_(nullptr),
425 
426  packingModel_(nullptr),
427  dampingModel_(nullptr),
428  isotropyModel_(nullptr),
429 
430  UIntegrator_(nullptr),
431  rhokTrans_
432  (
433  new volScalarField::Internal
434  (
435  IOobject
436  (
437  IOobject::scopedName(this->name(), "rhokTrans"),
438  this->db().time().timeName(),
439  this->db(),
440  IOobject::READ_IF_PRESENT,
441  IOobject::AUTO_WRITE
442  ),
443  mesh_,
445  )
446  ),
447  UTrans_
448  (
449  new volVectorField::Internal
450  (
451  IOobject
452  (
453  IOobject::scopedName(this->name(), "UTrans"),
454  this->db().time().timeName(),
455  this->db(),
456  IOobject::READ_IF_PRESENT,
457  IOobject::AUTO_WRITE
458  ),
459  mesh_,
461  )
462  ),
463  UCoeff_
464  (
465  new volScalarField::Internal
466  (
467  IOobject
468  (
469  IOobject::scopedName(this->name(), "UCoeff"),
470  this->db().time().timeName(),
471  this->db(),
472  IOobject::READ_IF_PRESENT,
473  IOobject::AUTO_WRITE
474  ),
475  mesh_,
477  )
478  ),
479  log(true)
480 {
481  if (solution_.active())
482  {
483  setModels();
484 
485  if (readFields)
486  {
487  parcelType::readFields(*this);
488  this->deleteLostParticles();
489  }
490  }
491 
492  if (solution_.resetSourcesOnStartup())
493  {
494  resetSourceTerms();
495  }
496 }
497 
498 
499 template<class CloudType>
501 (
502  KinematicCloud<CloudType>& c,
503  const word& name
504 )
505 :
506  CloudType(c.mesh_, name, c),
507  kinematicCloud(),
508  cloudCopyPtr_(nullptr),
509  mesh_(c.mesh_),
510  particleProperties_(c.particleProperties_),
511  outputProperties_(c.outputProperties_),
512  solution_(c.solution_),
513  constProps_(c.constProps_),
514  subModelProperties_(c.subModelProperties_),
515  rndGen_(c.rndGen_, true),
516  cellOccupancyPtr_(nullptr),
517  cellLengthScale_(c.cellLengthScale_),
518  rho_(c.rho_),
519  U_(c.U_),
520  mu_(c.mu_),
521  g_(c.g_),
522  pAmbient_(c.pAmbient_),
523  forces_(c.forces_),
524  functions_(c.functions_),
525  injectors_(c.injectors_),
526  dispersionModel_(c.dispersionModel_->clone()),
527  patchInteractionModel_(c.patchInteractionModel_->clone()),
528  stochasticCollisionModel_(c.stochasticCollisionModel_->clone()),
529  surfaceFilmModel_(c.surfaceFilmModel_->clone()),
530 
531  packingModel_(c.packingModel_->clone()),
532  dampingModel_(c.dampingModel_->clone()),
533  isotropyModel_(c.isotropyModel_->clone()),
534 
535  UIntegrator_(c.UIntegrator_->clone()),
536  rhokTrans_
537  (
538  new volScalarField::Internal
539  (
540  IOobject
541  (
542  IOobject::scopedName(this->name(), "rhokTrans"),
543  this->db().time().timeName(),
544  this->db(),
545  IOobject::NO_READ,
546  IOobject::NO_WRITE,
547  IOobject::NO_REGISTER
548  ),
549  c.rhokTrans_()
550  )
551  ),
552  UTrans_
553  (
554  new volVectorField::Internal
555  (
556  IOobject
557  (
558  IOobject::scopedName(this->name(), "UTrans"),
559  this->db().time().timeName(),
560  this->db(),
561  IOobject::NO_READ,
562  IOobject::NO_WRITE,
563  IOobject::NO_REGISTER
564  ),
565  c.UTrans_()
566  )
567  ),
568  UCoeff_
569  (
570  new volScalarField::Internal
571  (
572  IOobject
573  (
574  name + ":UCoeff",
575  this->db().time().timeName(),
576  this->db(),
577  IOobject::NO_READ,
578  IOobject::NO_WRITE,
579  IOobject::NO_REGISTER
580  ),
581  c.UCoeff_()
582  )
583  ),
584  log(c.log)
585 {}
586 
587 
588 template<class CloudType>
590 (
591  const fvMesh& mesh,
592  const word& name,
594 )
595 :
596  CloudType(mesh, name, IDLList<parcelType>()),
597  kinematicCloud(),
598  cloudCopyPtr_(nullptr),
599  mesh_(mesh),
600  particleProperties_
601  (
602  IOobject
603  (
604  name + "Properties",
605  mesh_.time().constant(),
606  mesh_,
607  IOobject::NO_READ,
608  IOobject::NO_WRITE,
609  IOobject::NO_REGISTER
610  )
611  ),
612  outputProperties_
613  (
614  IOobject
615  (
616  name + "OutputProperties",
617  mesh_.time().timeName(),
618  "uniform"/cloud::prefix/name,
619  mesh_,
620  IOobject::NO_READ,
621  IOobject::NO_WRITE,
622  IOobject::NO_REGISTER
623  )
624  ),
625  solution_(mesh),
626  constProps_(),
627  subModelProperties_(),
628  rndGen_(),
629  cellOccupancyPtr_(nullptr),
630  cellLengthScale_(c.cellLengthScale_),
631  rho_(c.rho_),
632  U_(c.U_),
633  mu_(c.mu_),
634  g_(c.g_),
635  pAmbient_(c.pAmbient_),
636  forces_(*this, mesh),
637  functions_(*this),
638  injectors_(*this),
639  dispersionModel_(nullptr),
640  patchInteractionModel_(nullptr),
641  stochasticCollisionModel_(nullptr),
642  surfaceFilmModel_(nullptr),
643 
644  packingModel_(nullptr),
645  dampingModel_(nullptr),
646  isotropyModel_(nullptr),
647 
648  UIntegrator_(nullptr),
649  rhokTrans_(nullptr),
650  UTrans_(nullptr),
651  UCoeff_(nullptr),
652  log(c.log)
653 {}
654 
655 
656 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
657 
658 template<class CloudType>
660 (
661  parcelType& parcel,
662  const scalar lagrangianDt
663 )
664 {
665  // If rho0 is given in the const properties
666  if (constProps_.rho0() != -1)
667  {
668  parcel.rho() = constProps_.rho0();
669  }
670 }
671 
672 
673 template<class CloudType>
675 (
676  parcelType& parcel,
677  const scalar lagrangianDt,
678  const bool fullyDescribed
679 )
680 {
681  const scalar carrierDt = mesh_.time().deltaTValue();
682  parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
683 
684  if (parcel.typeId() == -1)
685  {
686  parcel.typeId() = constProps_.parcelTypeId();
687  }
688 
689  if (parcel.rho() == -1)
690  {
692  << "The kinematic cloud needs rho0 in the constantProperties "
693  << " dictionary. " << nl
694  << abort(FatalError);
695  }
696 }
697 
698 
699 template<class CloudType>
701 {
702  cloudCopyPtr_.reset
703  (
704  static_cast<KinematicCloud<CloudType>*>
705  (
706  clone(this->name() + "Copy").ptr()
707  )
708  );
709 }
710 
711 
712 template<class CloudType>
714 {
715  cloudReset(cloudCopyPtr_());
716  cloudCopyPtr_.clear();
717 }
718 
719 
720 template<class CloudType>
722 {
723  rhokTrans().field() = Zero;
724  UTrans().field() = Zero;
725  UCoeff().field() = Zero;
726 }
727 
728 
729 template<class CloudType>
730 template<class Type>
732 (
734  const DimensionedField<Type, volMesh>& field0,
735  const word& name
736 ) const
737 {
738  const scalar coeff = solution_.relaxCoeff(name);
739  field = field0 + coeff*(field - field0);
740 }
741 
742 
743 template<class CloudType>
744 template<class Type>
746 (
748  const word& name
749 ) const
750 {
751  const scalar coeff = solution_.relaxCoeff(name);
752  field *= coeff;
753 }
754 
755 
756 template<class CloudType>
758 (
759  const KinematicCloud<CloudType>& cloudOldTime
760 )
761 {
762  this->relax(rhokTrans_(), cloudOldTime.rhokTrans(), "rhok");
763  this->relax(UTrans_(), cloudOldTime.UTrans(), "U");
764  this->relax(UCoeff_(), cloudOldTime.UCoeff(), "U");
765 }
766 
767 
768 template<class CloudType>
770 {
771  this->scale(rhokTrans_(), "rhok");
772  this->scale(UTrans_(), "U");
773  this->scale(UCoeff_(), "U");
774 }
775 
776 
777 template<class CloudType>
779 (
780  const typename parcelType::trackingData& td
781 )
782 {
783  // force calculation of mesh dimensions - needed for parallel runs
784  // with topology change due to lazy evaluation of valid mesh dimensions
785  label nGeometricD = mesh_.nGeometricD();
786 
787  Log_<< "\nSolving" << nGeometricD << "-D cloud " << this->name() << endl;
788 
789  this->dispersion().cacheFields(true);
790  forces_.cacheFields(true);
791 
792  pAmbient_ = constProps_.dict().template
793  getOrDefault<scalar>("pAmbient", pAmbient_);
794 
795  if (this->dampingModel().active() || this->packingModel().active())
796  {
797  const_cast<typename parcelType::trackingData&>(td).updateAverages(*this);
798  }
799 
800  if (this->dampingModel().active())
801  {
802  this->dampingModel().cacheFields(true);
803  }
804  if (this->packingModel().active())
805  {
806  this->packingModel().cacheFields(true);
807  }
808 
809  updateCellOccupancy();
810 
811  functions_.preEvolve(td);
812 }
813 
814 
815 template<class CloudType>
817 {
818  if (solution_.canEvolve())
819  {
820  typename parcelType::trackingData td(*this);
821  solve(*this, td);
822  }
823 }
824 
825 
826 template<class CloudType>
827 template<class TrackCloudType>
829 (
830  TrackCloudType& cloud,
831  typename parcelType::trackingData& td
832 )
833 {
834  td.part() = parcelType::trackingData::tpLinearTrack;
835  CloudType::move(cloud, td, solution_.trackTime());
836 
837  if (isotropyModel_->active())
838  {
839  td.updateAverages(cloud);
840  isotropyModel_->calculate();
841  }
843  updateCellOccupancy();
844 }
845 
846 
847 template<class CloudType>
849 (
850  const parcelType& p,
851  const polyPatch& pp,
852  vector& nw,
853  vector& Up
854 ) const
855 {
856  p.patchData(nw, Up);
857 
858  // If this is a wall patch, then there may be a non-zero tangential velocity
859  // component; the lid velocity in a lid-driven cavity case, for example. We
860  // want the particle to interact with this velocity, so we look it up in the
861  // velocity field and use it to set the wall-tangential component.
862  if (isA<wallPolyPatch>(pp))
863  {
864  const label patchi = pp.index();
865  const label patchFacei = pp.whichFace(p.face());
866 
867  // We only want to use the boundary condition value only if it is set
868  // by the boundary condition. If the boundary values are extrapolated
869  // (e.g., slip conditions) then they represent the motion of the fluid
870  // just inside the domain rather than that of the wall itself.
871  if (U_.boundaryField()[patchi].fixesValue())
872  {
873  const vector Uw1(U_.boundaryField()[patchi][patchFacei]);
874  const vector& Uw0 =
875  U_.oldTime().boundaryField()[patchi][patchFacei];
876 
877  const scalar f = p.currentTimeFraction();
878 
879  const vector Uw(Uw0 + f*(Uw1 - Uw0));
880 
881  const tensor nnw(nw*nw);
882 
883  Up = (nnw & Up) + Uw - (nnw & Uw);
884  }
885  }
886 }
887 
888 
889 template<class CloudType>
891 {
892  updateCellOccupancy();
893  injectors_.updateMesh();
894  cellLengthScale_ = mag(cbrt(mesh_.V()));
895 }
896 
897 
898 template<class CloudType>
900 {
902 
903  updateMesh();
904 }
905 
906 
907 template<class CloudType>
909 {
910  const vector linearMomentum =
911  returnReduce(linearMomentumOfSystem(), sumOp<vector>());
912 
913  const scalar linearKineticEnergy =
914  returnReduce(linearKineticEnergyOfSystem(), sumOp<scalar>());
915 
916  const label nTotParcel = returnReduce(this->size(), sumOp<label>());
917 
918  const scalar particlePerParcel =
919  (
920  nTotParcel
921  ? (returnReduce(totalParticlePerParcel(), sumOp<scalar>()) / nTotParcel)
922  : 0
923  );
924 
925  Log_<< "Cloud: " << this->name() << nl
926  << " Current number of parcels = " << nTotParcel << nl
927  << " Current mass in system = "
928  << returnReduce(massInSystem(), sumOp<scalar>()) << nl
929  << " Linear momentum = " << linearMomentum << nl
930  << " |Linear momentum| = " << mag(linearMomentum) << nl
931  << " Linear kinetic energy = " << linearKineticEnergy << nl
932  << " Average particle per parcel = " << particlePerParcel << nl;
933 
934 
935  injectors_.info();
936  this->surfaceFilm().info();
937  this->patchInteraction().info();
938 
939  if (this->packingModel().active())
940  {
941  tmp<volScalarField> alpha = this->theta();
942 
943  if (this->db().time().writeTime())
944  {
945  alpha().write();
946  }
947 
948  const scalar alphaMin = gMin(alpha().primitiveField());
949  const scalar alphaMax = gMax(alpha().primitiveField());
950 
951  Log_<< " Min cell volume fraction = " << alphaMin << nl
952  << " Max cell volume fraction = " << alphaMax << endl;
953 
954  if (alphaMax < SMALL)
955  {
956  return;
957  }
958 
959  scalar nMin = GREAT;
960 
961  forAll(this->mesh().cells(), celli)
962  {
963  const label n = this->cellOccupancy()[celli].size();
964 
965  if (n > 0)
966  {
967  const scalar nPack = n*alphaMax/alpha()[celli];
968 
969  if (nPack < nMin)
970  {
971  nMin = nPack;
972  }
973  }
974  }
975 
976  reduce(nMin, minOp<scalar>());
978  Log_<< " Min dense number of parcels = " << nMin << endl;
979  }
980 }
981 
982 
983 template<class CloudType>
985 {
986  parcelType::readObjects(*this, obr);
987 }
988 
989 
990 template<class CloudType>
992 {
993  parcelType::writeObjects(*this, obr);
994 }
995 
996 
997 // ************************************************************************* //
Template class for intrusive linked lists.
Definition: ILList.H:45
rDeltaTY field()
DSMCCloud< dsmcParcel > CloudType
void scaleSources()
Apply scaling to (transient) cloud sources.
void setModels()
Set cloud sub-models.
void relaxSources(const KinematicCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void storeState()
Store the current cloud state.
dimensionedScalar log(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
UEqn relax()
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:598
Type gMin(const FieldField< Field, Type > &f)
void evolveCloud(TrackCloudType &cloud, typename parcelType::trackingData &td)
Evolve the cloud.
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
void postEvolve(const typename parcelType::trackingData &td)
Post-evolve.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
void relax(DimensionedField< Type, volMesh > &field, const DimensionedField< Type, volMesh > &field0, const word &name) const
Relax field.
volVectorField::Internal & UTrans()
Return reference to momentum source.
Base class for packing models.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual void writeObjects(objectRegistry &obr) const
Write particle fields as objects into the obr registry.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:82
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
void updateCellOccupancy()
Update (i.e. build) the cellOccupancy if it has.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
void buildCellOccupancy()
Build the cellOccupancy.
Templated patch interaction model class.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
CEqn solve()
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
word timeName
Definition: getTimeIndex.H:3
void updateMesh()
Update mesh.
dimensionedScalar alphaMax("alphaMax", dimless/dimTime, laminarTransport)
#define addProfiling(Name, Descr)
Define profiling trigger with specified name and description string.
volScalarField::Internal & rhokTrans()
Return reference to mass for kinematic source.
dynamicFvMesh & mesh
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
#define Log_
Report write to Foam::Info if the class log switch is true.
const cellShapeList & cells
volScalarField::Internal & UCoeff()
Return coefficient for carrier phase U equation.
void resetSourceTerms()
Reset the cloud source terms.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
const word cloudName(propsDict.get< word >("cloud"))
A class for handling words, derived from Foam::string.
Definition: word.H:63
void motion(TrackCloudType &cloud, typename parcelType::trackingData &td)
Particle motion.
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:53
virtual void readObjects(const objectRegistry &obr)
Read particle fields from objects in the obr registry.
dimensionedScalar cbrt(const dimensionedScalar &ds)
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
errorManip< error > abort(error &err)
Definition: errorManip.H:139
Base cloud calls templated on particle type.
Definition: Cloud.H:51
const uniformDimensionedVectorField & g
regionModels::surfaceFilmModel & surfaceFilm
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
labelList f(nPoints)
Templated wall surface film model class.
const dimensionedScalar mu
Atomic mass unit.
Base class for collisional return-to-isotropy models.
void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve.
Virtual abstract base class for templated KinematicCloud.
Templated base class for kinematic cloud.
void patchData(const parcelType &p, const polyPatch &pp, vector &normal, vector &Up) const
Calculate the patch normal and velocity to interact with,.
const List< DynamicList< molecule * > > & cellOccupancy
U
Definition: pEqn.H:72
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
void evolve()
Evolve the cloud.
Templated stochastic collision model class.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const dimensionedScalar c
Speed of light in a vacuum.
Base class for dispersion modelling.
void info()
Print cloud information.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
void restoreState()
Reset the current cloud to the previously stored state.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
label n
void scale(DimensionedField< Type, volMesh > &field, const word &name) const
Scale field.
void cloudReset(KinematicCloud< CloudType > &c)
Reset state of cloud.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
volScalarField & p
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Registry of regIOobjects.
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Tensor of scalars, i.e. Tensor<scalar>.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
Base class for collisional damping models.
void solve(TrackCloudType &cloud, typename parcelType::trackingData &td)
Solve the cloud - calls all evolution functions.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127
const dimensionSet dimVelocity