phaseSystem.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) 2017-2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "phaseSystem.H"
29 #include "surfaceTensionModel.H"
30 #include "porousModel.H"
31 
32 #include "HashPtrTable.H"
33 
34 #include "surfaceInterpolate.H"
35 #include "fvcGrad.H"
36 #include "fvcSnGrad.H"
37 #include "fvcDiv.H"
38 #include "fvMatrix.H"
39 
44 
45 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49  defineTypeNameAndDebug(phaseSystem, 0);
50 }
51 
52 /* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */
53 
54 const Foam::word Foam::phaseSystem::phasePropertiesName("phaseProperties");
55 
56 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
57 
59 {
60  mu_ = mu()();
61 }
62 
63 
66 {
67  phaseModelTable phaseModels;
68 
69  for (const word& phaseName : phaseNames)
70  {
71  phaseModels.insert
72  (
73  phaseName,
75  (
76  *this,
77  phaseName
78  )
79  );
80  }
81 
82  return phaseModels;
83 }
84 
85 
87 (
88  const phaseModelTable& phaseModels
89 ) const
90 {
91  auto iter = phaseModels.cbegin();
92 
93  auto tmpPhi = tmp<surfaceScalarField>::New
94  (
95  "phi",
96  fvc::interpolate(iter()()) * iter()->phi()
97  );
98 
99  for (++iter; iter != phaseModels.cend(); ++iter)
100  {
101  tmpPhi.ref() += fvc::interpolate(iter()()) * iter()->phi();
102  }
103 
104  return tmpPhi;
105 }
106 
107 
109 {
110  forAllConstIters(modelDicts, iter)
111  {
112  const phasePairKey& key = iter.key();
113 
114  // pair already exists
115  if (phasePairs_.found(key))
116  {
117  // do nothing ...
118  }
119  else if (key.ordered())
120  {
121  // New ordered pair
122  phasePairs_.insert
123  (
124  key,
126  (
127  new orderedPhasePair
128  (
129  phaseModels_[key.first()],
130  phaseModels_[key.second()]
131  )
132  )
133  );
134  }
135  else
136  {
137  // New unordered pair
138  phasePairs_.insert
139  (
140  key,
142  (
143  new phasePair
144  (
145  phaseModels_[key.first()],
146  phaseModels_[key.second()]
147  )
148  )
149  );
150  }
151  }
152 }
153 
154 
156 {
157  forAllConstIters(phaseModels_, phaseIter1)
158  {
159  forAllConstIters(phaseModels_, phaseIter2)
160  {
161  if (phaseIter1()->name() != phaseIter2()->name())
162  {
163  phasePairKey key
164  (
165  phaseIter1()->name(),
166  phaseIter2()->name(),
167  true
168  );
169 
170  phasePairKey keyInverse
171  (
172  phaseIter2()->name(),
173  phaseIter1()->name(),
174  true
175  );
176 
177  if
178  (
179  !totalPhasePairs_.found(key)
180  && !totalPhasePairs_.found(keyInverse)
181  )
182  {
183  totalPhasePairs_.set
184  (
185  key,
187  (
188  new phasePair
189  (
190  phaseModels_[key.first()],
191  phaseModels_[key.second()]
192  )
193  )
194  );
195  }
196  }
197  }
198  }
199 }
200 
201 
202 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
203 
205 (
206  const fvMesh& mesh
207 )
208 :
209  basicThermo(mesh, word::null, phasePropertiesName),
210  mesh_(mesh),
211  mu_
212  (
213  IOobject
214  (
215  "mu",
216  mesh_.time().timeName(),
217  mesh_
218  ),
219  mesh_,
221  calculatedFvPatchScalarField::typeName
222  ),
223  phaseNames_(get<wordList>("phases")),
224  phi_
225  (
226  IOobject
227  (
228  "phi",
229  mesh_.time().timeName(),
230  mesh_,
233  ),
234  mesh_,
236  ),
237  rhoPhi_
238  (
239  IOobject
240  (
241  "rhoPhi",
242  mesh_.time().timeName(),
243  mesh_
244  ),
245  mesh_,
247  ),
248  phaseModels_(generatePhaseModels(phaseNames_)),
249  phasePairs_(),
250  totalPhasePairs_(),
251  Prt_
252  (
254  (
255  "Prt", *this, 1.0
256  )
257  )
258 {
259  rhoPhi_.setOriented();
260  phi_.setOriented();
261 
262  // sub models
263  if (found("surfaceTension"))
264  {
265  generatePairsAndSubModels
266  (
267  "surfaceTension",
268  mesh_,
269  surfaceTensionModels_
270  );
271  }
272  if (found("interfacePorous"))
273  {
274  generatePairsAndSubModels
275  (
276  "interfacePorous",
277  mesh_,
278  interfacePorousModelTable_
279  );
280  }
281 
282  // Total phase pair
283  generatePairsTable();
284 
285  // Update mu_
286  calcMu();
287 }
288 
289 
290 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
291 
293 {}
294 
295 
296 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
297 
299 (
300  const volScalarField& p,
301  const volScalarField& T
302 ) const
303 {
305  return nullptr;
306 }
307 
308 
310 (
311  const scalarField& p,
312  const scalarField& T,
313  const labelList& cells
314 ) const
315 {
317  return nullptr;
318 }
319 
320 
322 (
323  const scalarField& p,
324  const scalarField& T,
325  const label patchI
326 ) const
327 {
329  return nullptr;
330 }
331 
332 
334 {
335  auto iter = phaseModels_.cbegin();
336 
337  tmp<volScalarField> tAlphaHc
338  (
339  iter()() * iter()->hc()
340  );
341 
342  for (++iter; iter != phaseModels_.cend(); ++iter)
343  {
344  tAlphaHc.ref() += iter()() * iter()->hc();
345  }
346 
347  return tAlphaHc;
348 }
349 
350 
352 (
353  const scalarField& e,
354  const scalarField& p,
355  const scalarField& T0,
356  const labelList& cells
357 ) const
358 {
360  return nullptr;
361 }
362 
363 
365 (
366  const scalarField& e,
367  const scalarField& p,
368  const scalarField& T0,
369  const label patchI
370 ) const
371 {
373  return nullptr;
374 }
375 
376 
378 {
379  auto iter = phaseModels_.cbegin();
380 
381  tmp<volScalarField> tmpRho
382  (
383  iter()() * iter()->rho()
384  );
385 
386  for (++iter; iter != phaseModels_.cend(); ++iter)
387  {
388  tmpRho.ref() += iter()() * iter()->rho();
389  }
390 
391  return tmpRho;
392 }
393 
394 
396 {
397  auto iter = phaseModels_.cbegin();
398 
399  tmp<scalarField> tmpRho
400  (
401  iter()().boundaryField()[patchI]
402  * iter()->rho()().boundaryField()[patchI]
403  );
404 
405  for (++iter; iter != phaseModels_.cend(); ++iter)
406  {
407  tmpRho.ref() +=
408  (
409  iter()().boundaryField()[patchI]
410  * iter()->rho()().boundaryField()[patchI]
411  );
412  }
413 
414  return tmpRho;
415 }
416 
417 
419 {
420  auto iter = phaseModels_.cbegin();
421 
422  tmp<volScalarField> tmpCp
423  (
424  iter()() * iter()->Cp()
425  );
426 
427  for (++iter; iter != phaseModels_.cend(); ++iter)
428  {
429  tmpCp.ref() += iter()() * iter()->Cp();
430  }
431 
432  return tmpCp;
433 }
434 
435 
437 (
438  const scalarField& p,
439  const scalarField& T,
440  const label patchI
441 ) const
442 {
443  auto iter = phaseModels_.cbegin();
444 
445  tmp<scalarField> tmpCp
446  (
447  iter()() * iter()->Cp(p, T, patchI)
448  );
449 
450  for (++iter; iter != phaseModels_.cend(); ++iter)
451  {
452  tmpCp.ref() += iter()() * iter()->Cp(p, T, patchI);
453  }
454 
455  return tmpCp;
456 }
457 
458 
460 {
461  auto iter = phaseModels_.cbegin();
462 
463  tmp<volScalarField> tmpCv
464  (
465  iter()() * iter()->Cv()
466  );
467 
468  for (++iter; iter != phaseModels_.cend(); ++iter)
469  {
470  tmpCv.ref() += iter()() * iter()->Cv();
471  }
472 
473  return tmpCv;
474 }
475 
476 
478 (
479  const scalarField& p,
480  const scalarField& T,
481  const label patchI
482 ) const
483 {
484  auto iter = phaseModels_.cbegin();
485 
486  tmp<scalarField> tmpCv
487  (
488  iter()() * iter()->Cv(p, T, patchI)
489  );
490 
491  for (++iter; iter != phaseModels_.cend(); ++iter)
492  {
493  tmpCv.ref() += iter()() * iter()->Cv(p, T, patchI);
494  }
495 
496  return tmpCv;
497 }
498 
499 
501 {
502  auto iter = phaseModels_.cbegin();
503 
504  tmp<volScalarField> tmpCp
505  (
506  iter()() * iter()->Cp()
507  );
508 
509  tmp<volScalarField> tmpCv
510  (
511  iter()() * iter()->Cv()
512  );
513 
514  for (++iter; iter != phaseModels_.cend(); ++iter)
515  {
516  tmpCp.ref() += iter()() * iter()->Cp();
517  tmpCv.ref() += iter()() * iter()->Cv();
518  }
519 
520  return (tmpCp/tmpCv);
521 }
522 
523 
525 (
526  const scalarField& p,
527  const scalarField& T,
528  const label patchI
529 ) const
530 {
531  return
532  (
533  gamma()().boundaryField()[patchI]
534  );
535 }
536 
537 
539 {
540  auto iter = phaseModels_.cbegin();
541 
542  tmp<volScalarField> tmpCpv
543  (
544  iter()() * iter()->Cpv()
545  );
546 
547  for (++iter; iter != phaseModels_.cend(); ++iter)
548  {
549  tmpCpv.ref() += iter()() * iter()->Cpv();
550  }
551 
552  return tmpCpv;
553 }
554 
555 
557 (
558  const scalarField& p,
559  const scalarField& T,
560  const label patchI
561 ) const
562 {
563  auto iter = phaseModels_.cbegin();
564 
565  tmp<scalarField> tmpCpv
566  (
567  iter()() * iter()->Cpv(p, T, patchI)
568  );
569 
570  for (++iter; iter != phaseModels_.cend(); ++iter)
571  {
572  tmpCpv.ref() += iter()() * iter()->Cpv(p, T, patchI);
573  }
574 
575  return tmpCpv;
576 }
577 
578 
580 {
581  auto iter = phaseModels_.cbegin();
582 
583  tmp<volScalarField> tmpCpByCpv
584  (
585  iter()() * iter()->CpByCpv()
586  );
587 
588  for (++iter; iter != phaseModels_.cend(); ++iter)
589  {
590  tmpCpByCpv.ref() += iter()() * iter()->CpByCpv();
591  }
592 
593  return tmpCpByCpv;
594 }
595 
596 
598 (
599  const scalarField& p,
600  const scalarField& T,
601  const label patchI
602 ) const
603 {
604  auto iter = phaseModels_.cbegin();
605 
606  tmp<scalarField> tmpCpv
607  (
608  iter()().boundaryField()[patchI]
609  * iter()->CpByCpv(p, T, patchI)
610  );
611 
612  for (++iter; iter != phaseModels_.cend(); ++iter)
613  {
614  tmpCpv.ref() +=
615  (
616  iter()().boundaryField()[patchI]
617  * iter()->CpByCpv(p, T, patchI)
618  );
619  }
620 
621  return tmpCpv;
622 }
623 
624 
626 {
628  return nullptr;
629 }
630 
631 
633 {
634  auto iter = phaseModels_.cbegin();
635 
636  tmp<volScalarField> tmpkappa
637  (
638  iter()() * iter()->kappa()
639  );
640 
641  for (++iter; iter != phaseModels_.cend(); ++iter)
642  {
643  tmpkappa.ref() += iter()() * iter()->kappa();
644  }
645 
646  return tmpkappa;
647 }
648 
649 
651 {
652  auto iter = phaseModels_.cbegin();
653 
654  tmp<scalarField> tmpKappa
655  (
656  iter()().boundaryField()[patchI]
657  * iter()->kappa(patchI)
658  );
659 
660  for (++iter; iter != phaseModels_.cend(); ++iter)
661  {
662  tmpKappa.ref() +=
663  (
664  iter()().boundaryField()[patchI]
665  * iter()->kappa(patchI)
666  );
667  }
668 
669  return tmpKappa;
670 }
671 
672 
674 {
675  phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
676 
677  tmp<volScalarField> talphaEff
678  (
679  phaseModelIter()()*phaseModelIter()->alphahe()
680  );
681 
682  for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
683  {
684  talphaEff.ref() += phaseModelIter()()*phaseModelIter()->alphahe();
685  }
686 
687  return talphaEff;
688 }
689 
690 
692 (
693  const label patchi
694 ) const
695 {
696  phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
697 
698  tmp<scalarField> talphaEff
699  (
700  phaseModelIter()().boundaryField()[patchi]
701  *phaseModelIter()->alphahe(patchi)
702  );
703 
704  for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
705  {
706  talphaEff.ref() +=
707  phaseModelIter()().boundaryField()[patchi]
708  *phaseModelIter()->alphahe(patchi);
709  }
710 
711  return talphaEff;
712 }
713 
714 
716 (
717  const volScalarField& kappat
718 ) const
719 {
720  tmp<volScalarField> kappaEff(kappa() + kappat);
721  kappaEff.ref().rename("kappaEff");
722  return kappaEff;
723 }
724 
725 
727 (
728  const scalarField& kappat,
729  const label patchI
730 ) const
731 {
732  return kappa(patchI) + kappat;
733 }
734 
735 
737 (
738  const volScalarField& alphat
739 ) const
740 {
741  auto iter = phaseModels_.cbegin();
742 
743  tmp<volScalarField> tmpAlpha
744  (
745  iter()() * iter()->alpha()
746  );
747 
748  for (++iter; iter != phaseModels_.cend(); ++iter)
749  {
750  tmpAlpha.ref() += iter()() * iter()->alpha();
751  }
752 
753  tmpAlpha.ref() += alphat;
754 
755  return tmpAlpha;
756 }
757 
758 
760 (
761  const scalarField& alphat,
762  const label patchI
763 ) const
764 {
765  auto iter = phaseModels_.cbegin();
766 
767  tmp<scalarField> tmpAlpha
768  (
769  iter()().boundaryField()[patchI]
770  * iter()->alpha(patchI)
771  );
772 
773  for (++iter; iter != phaseModels_.cend(); ++iter)
774  {
775  tmpAlpha.ref() +=
776  (
777  iter()().boundaryField()[patchI]
778  * iter()->alpha(patchI)
779  );
780  }
781 
782  tmpAlpha.ref() += alphat;
783 
784  return tmpAlpha;
785 }
786 
787 
789 {
790  return Prt_;
791 }
792 
793 
795 {
796  auto iter = phaseModels_.cbegin();
797 
798  tmp<volScalarField> tmpMu
799  (
800  iter()() * iter()->mu()
801  );
802 
803  for (++iter; iter != phaseModels_.cend(); ++iter)
804  {
805  tmpMu.ref() += iter()() * iter()->mu();
806  }
807 
808  return tmpMu;
809 }
810 
811 
813 {
814  auto iter = phaseModels_.cbegin();
815 
816  tmp<scalarField> tmpMu
817  (
818  iter()().boundaryField()[patchI]
819  * iter()->mu(patchI)
820  );
821 
822  for (++iter; iter != phaseModels_.cend(); ++iter)
823  {
824  tmpMu.ref() +=
825  (
826  iter()().boundaryField()[patchI]
827  * iter()->mu(patchI)
828  );
829  }
830 
831  return tmpMu;
832 }
833 
834 
836 {
837  auto iter = phaseModels_.cbegin();
838 
839  tmp<volScalarField> tmpNu
840  (
841  iter()() * iter()->nu()
842  );
843 
844  for (++iter; iter != phaseModels_.cend(); ++iter)
845  {
846  tmpNu.ref() += iter()() * iter()->nu();
847  }
848 
849  return tmpNu;
850 }
851 
852 
854 {
855  auto iter = phaseModels_.cbegin();
856 
857  tmp<scalarField> tmpNu
858  (
859  iter()().boundaryField()[patchI]
860  * iter()->nu(patchI)
861  );
862 
863  for (++iter; iter != phaseModels_.cend(); ++iter)
864  {
865  tmpNu.ref() +=
866  (
867  iter()().boundaryField()[patchI]
868  * iter()->nu(patchI)
869  );
870  }
871 
872  return tmpNu;
873 }
874 
875 
877 {
878  return phi_;
879 }
880 
881 
883 {
884  return phi_;
885 }
886 
887 
889 {
890  return rhoPhi_;
891 }
892 
893 
895 {
896  return rhoPhi_;
897 }
898 
899 
901 {
902  forAllIters(phaseModels_, iter)
903  {
904  iter()->correct();
905  }
906 
907  calcMu();
908 }
909 
910 
912 {
913  forAllIters(phaseModels_, iter)
914  {
915  iter()->correctTurbulence();
916  }
917 }
918 
919 
921 {
922  return phaseModels_;
923 }
924 
925 
927 {
928  return phaseModels_;
929 }
930 
931 
934 {
935  return totalPhasePairs_;
936 }
937 
938 
940 {
941  return totalPhasePairs_;
942 }
943 
944 
946 {
947  forAllConstIters(phaseModels_, iter)
948  {
949  if (!iter()->thermo().incompressible())
950  {
951  return false;
952  }
953  }
954 
955  return true;
956 }
957 
958 
959 bool Foam::phaseSystem::incompressible(const word phaseName) const
960 {
961  return phaseModels_[phaseName]->thermo().incompressible();
962 }
963 
964 
966 {
967  forAllConstIters(phaseModels_, iter)
968  {
969  if (!iter()->thermo().isochoric())
970  {
971  return false;
972  }
973  }
974 
975  return true;
976 }
977 
978 
980 {
981  return mesh_;
982 }
983 
984 
987 {
988  auto tstf = tmp<surfaceScalarField>::New
989  (
990  IOobject
991  (
992  "surfaceTensionForce",
993  mesh_.time().timeName(),
994  mesh_
995  ),
996  mesh_,
997  dimensionedScalar({1, -2, -2, 0, 0, 0}, Zero)
998  );
999 
1000  auto& stf = tstf.ref();
1001  stf.setOriented();
1002 
1003  if (surfaceTensionModels_.size())
1004  {
1005  forAllConstIters(phaseModels_, iter1)
1006  {
1007  const volScalarField& alpha1 = iter1()();
1008 
1009  auto iter2 = iter1;
1010 
1011  for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1012  {
1013  const volScalarField& alpha2 = iter2()();
1014 
1015  stf +=
1017  (
1018  surfaceTensionCoeff
1019  (
1020  phasePairKey(iter1()->name(), iter2()->name())
1021  )
1022  )
1024  (
1027  );
1028  }
1029  }
1030  }
1031 
1032  return tstf;
1033 }
1034 
1035 
1037 {
1038  auto tstf = tmp<volVectorField>::New
1039  (
1040  IOobject
1041  (
1042  "U",
1043  mesh_.time().timeName(),
1044  mesh_
1045  ),
1046  mesh_,
1048  );
1049 
1050  auto& stf = tstf.ref();
1051 
1052  forAllConstIters(phaseModels_, iter)
1053  {
1054  stf += iter()() * iter()->U();
1055  }
1056 
1057  return tstf;
1058 }
1059 
1060 
1063 {
1064  return surfaceTensionModels_[key]->sigma();
1065 }
1066 
1067 
1070  const word& key
1071 ) const
1072 {
1073  return 1.0/(phaseModels_[key]->thermo().rho());
1074 }
1075 
1076 
1078 {
1079  const scalarField& Vc = mesh_.V();
1080  scalarField& Udiag = UEqn.diag();
1081 
1082  forAllConstIters(phaseModels_, iteri)
1083  {
1084  const phaseModel& phasei = iteri()();
1085 
1086  auto iterk = iteri;
1087 
1088  for (++iterk; iterk != phaseModels_.cend(); ++iterk)
1089  {
1090  if (iteri()().name() != iterk()().name())
1091  {
1092  const phaseModel& phasek = iterk()();
1093 
1094  // Phase i and k
1095  const phasePairKey keyik
1096  (
1097  phasei.name(),
1098  phasek.name(),
1099  false
1100  );
1101 
1102  if (interfacePorousModelTable_.found(keyik))
1103  {
1104  autoPtr<porousModel>& interfacePtr =
1105  interfacePorousModelTable_[keyik];
1106 
1107  Udiag += Vc*interfacePtr->S();
1108  }
1109  }
1110  }
1111  }
1112 }
1113 
1114 
1117  const volScalarField& alpha1,
1118  const volScalarField& alpha2
1119 ) const
1120 {
1121  tmp<surfaceVectorField> tnHatfv = nHatfv(alpha1, alpha2);
1122 
1123  // Simple expression for curvature
1124  return -fvc::div(tnHatfv.ref() & mesh_.Sf());
1125 }
1126 
1127 
1130  const volScalarField& alpha1,
1131  const volScalarField& alpha2
1132 ) const
1133 {
1134  return
1135  (
1136  pos(alpha1 - 0.1)*pos(0.9 - alpha1)
1137  *pos(alpha2 - 0.1)*pos(0.9 - alpha2)
1138  );
1139 }
1140 
1141 
1143 {
1144  auto tnearInt = tmp<volScalarField>::New
1145  (
1146  IOobject
1147  (
1148  "nearInterface",
1149  mesh_.time().timeName(),
1150  mesh_
1151  ),
1152  mesh_,
1154  );
1155 
1156  auto& nearInt = tnearInt.ref();
1157 
1158  forAllConstIters(phaseModels_, iter1)
1159  {
1160  const volScalarField& alpha1 = iter1()();
1161 
1162  auto iter2 = iter1;
1163 
1164  for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1165  {
1166  const volScalarField& alpha2 = iter2()();
1167 
1168  nearInt +=
1169  (
1170  pos(alpha1 - 0.1)*pos(0.9 - alpha1)
1171  *pos(alpha2 - 0.1)*pos(0.9 - alpha2)
1172  );
1173  }
1174  }
1175 
1176  return tnearInt;
1177 }
1178 
1179 
1182  const volScalarField& alpha1,
1183  const volScalarField& alpha2
1184 ) const
1185 {
1186 
1187  surfaceVectorField gradAlphaf
1188  (
1191  );
1192 
1193  const dimensionedScalar deltaN
1194  (
1195  "deltaN",
1196  1e-8/cbrt(average(mesh_.V()))
1197  );
1198 
1199  // Face unit interface normal
1200  return gradAlphaf/(mag(gradAlphaf) + deltaN);
1201 }
1202 
1203 
1206  const volScalarField& alpha1,
1207  const volScalarField& alpha2
1208 ) const
1209 {
1210  // Face unit interface normal flux
1211  return nHatfv(alpha1, alpha2) & mesh_.Sf();
1212 }
1213 
1214 
1216 {
1217  if (regIOobject::read())
1218  {
1219  return true;
1220  }
1221 
1222  return false;
1223 }
1224 
1225 
1226 // ************************************************************************* //
Foam::Pair::second
const T & second() const noexcept
Return second element, which is also the last element.
Definition: PairI.H:122
Foam::phaseSystem::totalPhasePairs
const phasePairTable & totalPhasePairs() const
Constant access the total phase pairs.
Definition: phaseSystem.C:933
Foam::phaseSystem::surfaceTensionForce
tmp< surfaceScalarField > surfaceTensionForce() const
Calculate surface tension of the mixture.
Definition: phaseSystem.C:986
Foam::phaseModel
Single incompressible phase derived from the phase-fraction. Used as part of the multiPhaseMixture fo...
Definition: phaseModel.H:54
Foam::phaseSystem::Cpv
virtual tmp< volScalarField > Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: phaseSystem.C:538
Foam::fvc::snGrad
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:47
Foam::phaseSystem::Cv
virtual tmp< volScalarField > Cv() const
Return Cv of the mixture.
Definition: phaseSystem.C:459
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
Foam::phasePair
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:53
Foam::phaseSystem::alphahe
virtual tmp< volScalarField > alphahe() const
Thermal diffusivity for energy of mixture [kg/m/s].
Definition: phaseSystem.C:673
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:129
Foam::dimless
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Dimensionless.
Definition: dimensionSets.H:50
Foam::fvc::grad
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcGrad.C:54
Foam::phaseSystem::nu
virtual tmp< volScalarField > nu() const
Kinematic viscosity of mixture [m^2/s].
Definition: phaseSystem.C:835
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::constant::physicoChemical::mu
const dimensionedScalar mu
Atomic mass unit.
Definition: createFieldRefs.H:4
phaseSystem.H
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::dimVelocity
const dimensionSet dimVelocity
Foam::phaseSystem::nearInterface
tmp< volScalarField > nearInterface() const
Near Interface of alpha'n.
Definition: phaseSystem.C:1142
Foam::dimDensity
const dimensionSet dimDensity
alpha2
const volScalarField & alpha2
Definition: setRegionFluidFields.H:9
Foam::HashTable::cbegin
const_iterator cbegin() const
const_iterator set to the beginning of the HashTable
Definition: HashTableIterI.H:248
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
Foam::phaseSystem::nHatf
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal volume vector.
Definition: phaseSystem.C:1205
Foam::phaseSystem::Prt
const dimensionedScalar & Prt() const
Return Prandt number.
Definition: phaseSystem.C:788
gradientEnergyFvPatchScalarField.H
thermo
psiReactionThermo & thermo
Definition: createFields.H:28
fvcSnGrad.H
Calculate the snGrad of the given volField.
kappaEff
kappaEff
Definition: TEqn.H:10
Foam::phaseSystem::phaseSystem
phaseSystem(const fvMesh &mesh)
Construct from fvMesh.
Definition: phaseSystem.C:205
Cv
const volScalarField & Cv
Definition: EEqn.H:8
Foam::regIOobject::read
virtual bool read()
Read object.
Definition: regIOobjectRead.C:202
fvcDiv.H
Calculate the divergence of the given field.
Foam::HashTable::insert
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
Definition: HashTableI.H:180
Foam::phaseSystem::THE
virtual tmp< scalarField > THE(const scalarField &h, const scalarField &p, const scalarField &T0, const labelList &cells) const
Temperature from enthalpy/internal energy for cell-set.
Definition: phaseSystem.C:352
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:49
Foam::HashTable::cend
constexpr const_iterator cend() const noexcept
const_iterator to signal the end (for any HashTable)
Definition: HashTableIterI.H:272
Foam::phaseSystem::phi
const surfaceScalarField & phi() const
Constant access to the total flux.
Definition: phaseSystem.C:876
Foam::basicThermo
Abstract base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:63
phasei
label phasei
Definition: pEqn.H:27
fvMatrix.H
Foam::phaseSystem::U
tmp< volVectorField > U() const
Mixture U.
Definition: phaseSystem.C:1036
Foam::phaseSystem::mu
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: phaseSystem.C:794
Foam::phaseSystem::generatePairsTable
void generatePairsTable()
Generate pair table.
Definition: phaseSystem.C:155
alpha1
const volScalarField & alpha1
Definition: setRegionFluidFields.H:8
Foam::phaseSystem::~phaseSystem
virtual ~phaseSystem()
Destructor.
Definition: phaseSystem.C:292
Foam::phaseSystem::mu_
volScalarField mu_
Dynamic viscocity.
Definition: phaseSystem.H:121
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
rho
rho
Definition: readInitialConditions.H:88
Foam::phaseSystem::gamma
virtual tmp< volScalarField > gamma() const
Gamma = Cp/Cv [].
Definition: phaseSystem.C:500
Foam::phaseSystem::he
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
Definition: phaseSystem.H:271
Foam::phaseSystem::nHatfv
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
Definition: phaseSystem.C:1181
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::phaseSystem::K
tmp< volScalarField > K(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface curvature.
Definition: phaseSystem.C:1116
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:445
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:228
Foam::Field< scalar >
Foam::phaseSystem::alphaEff
virtual tmp< volScalarField > alphaEff(const volScalarField &alphat) const
Effective thermal diffusivity of mixture [kg/m/s].
Definition: phaseSystem.C:737
Foam::phaseSystem::CpByCpv
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: phaseSystem.C:579
porousModel.H
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::porousModel::S
virtual tmp< volScalarField > S() const =0
Momentum source.
Foam::phaseSystem::kappaEff
virtual tmp< volScalarField > kappaEff(const volScalarField &kappat) const
Effective thermal diffusivity for temperature.
Definition: phaseSystem.C:716
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:122
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::orderedPhasePair
Definition: orderedPhasePair.H:49
Foam::phaseSystem::correct
virtual void correct()
Correct the mixture thermos.
Definition: phaseSystem.C:900
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:43
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::phasePairKey
Definition: phasePairKey.H:57
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:223
Foam::dimViscosity
const dimensionSet dimViscosity
Foam::phaseSystem::Cp
virtual tmp< volScalarField > Cp() const
Return Cp of the mixture.
Definition: phaseSystem.C:418
Foam::phaseSystem::W
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol] of the mixture.
Definition: phaseSystem.C:625
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned< scalar >
Foam::phaseSystem::hc
virtual tmp< volScalarField > hc() const
Chemical enthalpy of the mixture [J/kg].
Definition: phaseSystem.C:333
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:52
Foam::phaseSystem::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: phaseSystem.C:632
Foam::fvc::interpolate
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
Foam::dimensioned< scalar >::getOrAddToDict
static dimensioned< scalar > getOrAddToDict(const word &name, dictionary &dict, const dimensionSet &dims=dimless, const scalar &deflt=scalar(Zero))
Construct dimensioned from dictionary, with default value.
Definition: dimensionedType.C:374
Foam::phasePairKey::ordered
bool ordered() const
Return the ordered flag.
Definition: phasePairKey.C:46
fixedEnergyFvPatchScalarField.H
Foam::phaseSystem::calcMu
void calcMu()
Calculate and return the laminar viscosity.
Definition: phaseSystem.C:58
Foam::phaseSystem::mesh
const fvMesh & mesh() const
Return mesh.
Definition: phaseSystem.C:979
Foam::HashTable< autoPtr< phaseModel > >
found
bool found
Definition: TABSMDCalcMethod2.H:32
Foam::phaseModel::name
const word & name() const
Definition: phaseModel.H:140
Foam::autoPtr< phasePair >
mixedEnergyFvPatchScalarField.H
Foam::phaseSystem::correctTurbulence
virtual void correctTurbulence()
Correct the turbulence.
Definition: phaseSystem.C:911
Foam::phaseSystem::surfaceTensionCoeff
virtual tmp< volScalarField > surfaceTensionCoeff(const phasePairKey &key) const
Return the surface tension coefficient.
Definition: phaseSystem.C:1062
forAllConstIters
forAllConstIters(mixture.phases(), phase)
Definition: pEqn.H:28
Foam::phaseSystem::phasePropertiesName
static const word phasePropertiesName
Default name of the phase properties dictionary.
Definition: phaseSystem.H:254
Foam::phaseSystem::isochoric
virtual bool isochoric() const
Return true if the equation of state is isochoric for all phasses.
Definition: phaseSystem.C:965
Foam::phaseSystem::generatePhaseModels
HashTable< autoPtr< phaseModel > > generatePhaseModels(const wordList &names) const
Generate the phases.
Definition: phaseSystem.C:65
Foam::List< word >
fvcGrad.H
Calculate the gradient of the given field.
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
gamma
const scalar gamma
Definition: EEqn.H:9
Foam::phaseSystem::rhoPhi
const surfaceScalarField & rhoPhi() const
Constant access to the mixture mass flux.
Definition: phaseSystem.C:888
HashPtrTable.H
Foam::constant::electromagnetic::e
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
Foam::tmp::New
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
Cp
const volScalarField & Cp
Definition: EEqn.H:7
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::phaseSystem::addInterfacePorosity
void addInterfacePorosity(fvVectorMatrix &UEqn)
Add interface porosity on phasePair.
Definition: phaseSystem.C:1077
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:76
UEqn
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Foam::phaseSystem::generatePhi
tmp< surfaceScalarField > generatePhi(const HashTable< autoPtr< phaseModel >> &phaseModels) const
Generate the mixture flux.
Definition: phaseSystem.C:87
Foam::phaseSystem::phases
const phaseModelTable & phases() const
Constant access the phases.
Definition: phaseSystem.C:920
cells
const cellShapeList & cells
Definition: gmvOutputHeader.H:3
Foam::cbrt
dimensionedScalar cbrt(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:155
Foam::dimVolume
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:61
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::phaseSystem::rho
virtual tmp< volScalarField > rho() const
Return the mixture density.
Definition: phaseSystem.C:377
T0
scalar T0
Definition: createFields.H:22
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
zeroGradientFvPatchFields.H
Foam::phaseSystem::incompressible
virtual bool incompressible() const
Return true if the equation of state is incompressible for all.
Definition: phaseSystem.C:945
Foam::phaseSystem::read
virtual bool read()
Read base phaseProperties dictionary.
Definition: phaseSystem.C:1215
Foam::phaseSystem::coeffs
virtual tmp< volScalarField > coeffs(const word &key) const
Return coefficients (1/rho)
Definition: phaseSystem.C:1069
Foam::phaseModel::New
static autoPtr< phaseModel > New(const phaseSystem &fluid, const word &phaseName)
Definition: phaseModel.C:69
Foam::average
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
Definition: DimensionedFieldFunctions.C:328
Foam::phaseSystem::generatePairs
void generatePairs(const dictTable &modelDicts)
Generate pairs.
Definition: phaseSystem.C:108
Foam::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177