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-2021 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  {
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  surfaceTensionModels_
269  );
270  }
271  if (found("interfacePorous"))
272  {
273  generatePairsAndSubModels
274  (
275  "interfacePorous",
276  mesh_,
277  interfacePorousModelTable_
278  );
279  }
280 
281  // Total phase pair
282  generatePairsTable();
283 
284  // Update mu_
285  calcMu();
286 }
287 
288 
289 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
290 
292 {}
293 
294 
295 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
296 
298 (
299  const volScalarField& p,
300  const volScalarField& T
301 ) const
302 {
304  return nullptr;
305 }
306 
307 
309 (
310  const scalarField& p,
311  const scalarField& T,
312  const labelList& cells
313 ) const
314 {
316  return nullptr;
317 }
318 
319 
321 (
322  const scalarField& p,
323  const scalarField& T,
324  const label patchI
325 ) const
326 {
328  return nullptr;
329 }
330 
331 
333 {
334  auto iter = phaseModels_.cbegin();
335 
336  tmp<volScalarField> tAlphaHc
337  (
338  iter()() * iter()->hc()
339  );
340 
341  for (++iter; iter != phaseModels_.cend(); ++iter)
342  {
343  tAlphaHc.ref() += iter()() * iter()->hc();
344  }
345 
346  return tAlphaHc;
347 }
348 
349 
351 (
352  const scalarField& e,
353  const scalarField& p,
354  const scalarField& T0,
355  const labelList& cells
356 ) const
357 {
359  return nullptr;
360 }
361 
362 
364 (
365  const scalarField& e,
366  const scalarField& p,
367  const scalarField& T0,
368  const label patchI
369 ) const
370 {
372  return nullptr;
373 }
374 
375 
377 {
378  auto iter = phaseModels_.cbegin();
379 
380  tmp<volScalarField> tmpRho
381  (
382  iter()() * iter()->rho()
383  );
384 
385  for (++iter; iter != phaseModels_.cend(); ++iter)
386  {
387  tmpRho.ref() += iter()() * iter()->rho();
388  }
389 
390  return tmpRho;
391 }
392 
393 
395 {
396  auto iter = phaseModels_.cbegin();
397 
398  tmp<scalarField> tmpRho
399  (
400  iter()().boundaryField()[patchI]
401  * iter()->rho()().boundaryField()[patchI]
402  );
403 
404  for (++iter; iter != phaseModels_.cend(); ++iter)
405  {
406  tmpRho.ref() +=
407  (
408  iter()().boundaryField()[patchI]
409  * iter()->rho()().boundaryField()[patchI]
410  );
411  }
412 
413  return tmpRho;
414 }
415 
416 
418 {
419  auto iter = phaseModels_.cbegin();
420 
421  tmp<volScalarField> tmpCp
422  (
423  iter()() * iter()->Cp()
424  );
425 
426  for (++iter; iter != phaseModels_.cend(); ++iter)
427  {
428  tmpCp.ref() += iter()() * iter()->Cp();
429  }
430 
431  return tmpCp;
432 }
433 
434 
436 (
437  const scalarField& p,
438  const scalarField& T,
439  const label patchI
440 ) const
441 {
442  auto iter = phaseModels_.cbegin();
443 
444  tmp<scalarField> tmpCp
445  (
446  iter()() * iter()->Cp(p, T, patchI)
447  );
448 
449  for (++iter; iter != phaseModels_.cend(); ++iter)
450  {
451  tmpCp.ref() += iter()() * iter()->Cp(p, T, patchI);
452  }
453 
454  return tmpCp;
455 }
456 
457 
459 {
460  auto iter = phaseModels_.cbegin();
461 
462  tmp<volScalarField> tmpCv
463  (
464  iter()() * iter()->Cv()
465  );
466 
467  for (++iter; iter != phaseModels_.cend(); ++iter)
468  {
469  tmpCv.ref() += iter()() * iter()->Cv();
470  }
471 
472  return tmpCv;
473 }
474 
475 
477 (
478  const scalarField& p,
479  const scalarField& T,
480  const label patchI
481 ) const
482 {
483  auto iter = phaseModels_.cbegin();
484 
485  tmp<scalarField> tmpCv
486  (
487  iter()() * iter()->Cv(p, T, patchI)
488  );
489 
490  for (++iter; iter != phaseModels_.cend(); ++iter)
491  {
492  tmpCv.ref() += iter()() * iter()->Cv(p, T, patchI);
493  }
494 
495  return tmpCv;
496 }
497 
498 
500 (
501  const scalarField& p,
502  const scalarField& T,
503  const labelList& cells
504 ) const
505 {
507  return nullptr;
508 }
509 
510 
512 {
513  auto iter = phaseModels_.cbegin();
514 
515  tmp<volScalarField> tmpCp
516  (
517  iter()() * iter()->Cp()
518  );
519 
520  tmp<volScalarField> tmpCv
521  (
522  iter()() * iter()->Cv()
523  );
524 
525  for (++iter; iter != phaseModels_.cend(); ++iter)
526  {
527  tmpCp.ref() += iter()() * iter()->Cp();
528  tmpCv.ref() += iter()() * iter()->Cv();
529  }
530 
531  return (tmpCp/tmpCv);
532 }
533 
534 
536 (
537  const scalarField& p,
538  const scalarField& T,
539  const label patchI
540 ) const
541 {
542  return
543  (
544  gamma()().boundaryField()[patchI]
545  );
546 }
547 
548 
550 {
551  auto iter = phaseModels_.cbegin();
552 
553  tmp<volScalarField> tmpCpv
554  (
555  iter()() * iter()->Cpv()
556  );
557 
558  for (++iter; iter != phaseModels_.cend(); ++iter)
559  {
560  tmpCpv.ref() += iter()() * iter()->Cpv();
561  }
562 
563  return tmpCpv;
564 }
565 
566 
568 (
569  const scalarField& p,
570  const scalarField& T,
571  const label patchI
572 ) const
573 {
574  auto iter = phaseModels_.cbegin();
575 
576  tmp<scalarField> tmpCpv
577  (
578  iter()() * iter()->Cpv(p, T, patchI)
579  );
580 
581  for (++iter; iter != phaseModels_.cend(); ++iter)
582  {
583  tmpCpv.ref() += iter()() * iter()->Cpv(p, T, patchI);
584  }
585 
586  return tmpCpv;
587 }
588 
589 
591 {
592  auto iter = phaseModels_.cbegin();
593 
594  tmp<volScalarField> tmpCpByCpv
595  (
596  iter()() * iter()->CpByCpv()
597  );
598 
599  for (++iter; iter != phaseModels_.cend(); ++iter)
600  {
601  tmpCpByCpv.ref() += iter()() * iter()->CpByCpv();
602  }
603 
604  return tmpCpByCpv;
605 }
606 
607 
609 (
610  const scalarField& p,
611  const scalarField& T,
612  const label patchI
613 ) const
614 {
615  auto iter = phaseModels_.cbegin();
616 
617  tmp<scalarField> tmpCpv
618  (
619  iter()().boundaryField()[patchI]
620  * iter()->CpByCpv(p, T, patchI)
621  );
622 
623  for (++iter; iter != phaseModels_.cend(); ++iter)
624  {
625  tmpCpv.ref() +=
626  (
627  iter()().boundaryField()[patchI]
628  * iter()->CpByCpv(p, T, patchI)
629  );
630  }
631 
632  return tmpCpv;
633 }
634 
635 
637 {
639  return nullptr;
640 }
641 
642 
644 {
645  auto iter = phaseModels_.cbegin();
646 
647  tmp<volScalarField> tmpkappa
648  (
649  iter()() * iter()->kappa()
650  );
651 
652  for (++iter; iter != phaseModels_.cend(); ++iter)
653  {
654  tmpkappa.ref() += iter()() * iter()->kappa();
655  }
656 
657  return tmpkappa;
658 }
659 
660 
662 {
663  auto iter = phaseModels_.cbegin();
664 
665  tmp<scalarField> tmpKappa
666  (
667  iter()().boundaryField()[patchI]
668  * iter()->kappa(patchI)
669  );
670 
671  for (++iter; iter != phaseModels_.cend(); ++iter)
672  {
673  tmpKappa.ref() +=
674  (
675  iter()().boundaryField()[patchI]
676  * iter()->kappa(patchI)
677  );
678  }
679 
680  return tmpKappa;
681 }
682 
683 
685 {
686  phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
687 
688  tmp<volScalarField> talphaEff
689  (
690  phaseModelIter()()*phaseModelIter()->alphahe()
691  );
692 
693  for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
694  {
695  talphaEff.ref() += phaseModelIter()()*phaseModelIter()->alphahe();
696  }
697 
698  return talphaEff;
699 }
700 
701 
703 (
704  const label patchi
705 ) const
706 {
707  phaseModelTable::const_iterator phaseModelIter = phaseModels_.begin();
708 
709  tmp<scalarField> talphaEff
710  (
711  phaseModelIter()().boundaryField()[patchi]
712  *phaseModelIter()->alphahe(patchi)
713  );
714 
715  for (; phaseModelIter != phaseModels_.end(); ++phaseModelIter)
716  {
717  talphaEff.ref() +=
718  phaseModelIter()().boundaryField()[patchi]
719  *phaseModelIter()->alphahe(patchi);
720  }
721 
722  return talphaEff;
723 }
724 
725 
727 (
728  const volScalarField& kappat
729 ) const
730 {
731  tmp<volScalarField> kappaEff(kappa() + kappat);
732  kappaEff.ref().rename("kappaEff");
733  return kappaEff;
734 }
735 
736 
738 (
739  const scalarField& kappat,
740  const label patchI
741 ) const
742 {
743  return kappa(patchI) + kappat;
744 }
745 
746 
748 (
749  const volScalarField& alphat
750 ) const
751 {
752  auto iter = phaseModels_.cbegin();
753 
754  tmp<volScalarField> tmpAlpha
755  (
756  iter()() * iter()->alpha()
757  );
758 
759  for (++iter; iter != phaseModels_.cend(); ++iter)
760  {
761  tmpAlpha.ref() += iter()() * iter()->alpha();
762  }
763 
764  tmpAlpha.ref() += alphat;
765 
766  return tmpAlpha;
767 }
768 
769 
771 (
772  const scalarField& alphat,
773  const label patchI
774 ) const
775 {
776  auto iter = phaseModels_.cbegin();
777 
778  tmp<scalarField> tmpAlpha
779  (
780  iter()().boundaryField()[patchI]
781  * iter()->alpha(patchI)
782  );
783 
784  for (++iter; iter != phaseModels_.cend(); ++iter)
785  {
786  tmpAlpha.ref() +=
787  (
788  iter()().boundaryField()[patchI]
789  * iter()->alpha(patchI)
790  );
791  }
792 
793  tmpAlpha.ref() += alphat;
794 
795  return tmpAlpha;
796 }
797 
798 
800 {
801  return Prt_;
802 }
803 
804 
806 {
807  auto iter = phaseModels_.cbegin();
808 
809  tmp<volScalarField> tmpMu
810  (
811  iter()() * iter()->mu()
812  );
813 
814  for (++iter; iter != phaseModels_.cend(); ++iter)
815  {
816  tmpMu.ref() += iter()() * iter()->mu();
817  }
818 
819  return tmpMu;
820 }
821 
822 
824 {
825  auto iter = phaseModels_.cbegin();
826 
827  tmp<scalarField> tmpMu
828  (
829  iter()().boundaryField()[patchI]
830  * iter()->mu(patchI)
831  );
832 
833  for (++iter; iter != phaseModels_.cend(); ++iter)
834  {
835  tmpMu.ref() +=
836  (
837  iter()().boundaryField()[patchI]
838  * iter()->mu(patchI)
839  );
840  }
841 
842  return tmpMu;
843 }
844 
845 
847 {
848  auto iter = phaseModels_.cbegin();
849 
850  tmp<volScalarField> tmpNu
851  (
852  iter()() * iter()->nu()
853  );
854 
855  for (++iter; iter != phaseModels_.cend(); ++iter)
856  {
857  tmpNu.ref() += iter()() * iter()->nu();
858  }
859 
860  return tmpNu;
861 }
862 
863 
865 {
866  auto iter = phaseModels_.cbegin();
867 
868  tmp<scalarField> tmpNu
869  (
870  iter()().boundaryField()[patchI]
871  * iter()->nu(patchI)
872  );
873 
874  for (++iter; iter != phaseModels_.cend(); ++iter)
875  {
876  tmpNu.ref() +=
877  (
878  iter()().boundaryField()[patchI]
879  * iter()->nu(patchI)
880  );
881  }
882 
883  return tmpNu;
884 }
885 
886 
888 {
889  return phi_;
890 }
891 
892 
894 {
895  return phi_;
896 }
897 
898 
900 {
901  return rhoPhi_;
902 }
903 
904 
906 {
907  return rhoPhi_;
908 }
909 
910 
912 {
913  forAllIters(phaseModels_, iter)
914  {
915  iter()->correct();
916  }
917 
918  calcMu();
919 }
920 
921 
923 {
924  forAllIters(phaseModels_, iter)
925  {
926  iter()->correctTurbulence();
927  }
928 }
929 
930 
932 {
933  return phaseModels_;
934 }
935 
936 
938 {
939  return phaseModels_;
940 }
941 
942 
945 {
946  return totalPhasePairs_;
947 }
948 
949 
951 {
952  return totalPhasePairs_;
953 }
954 
955 
957 {
958  forAllConstIters(phaseModels_, iter)
959  {
960  if (!iter()->thermo().incompressible())
961  {
962  return false;
963  }
964  }
965 
966  return true;
967 }
968 
969 
970 bool Foam::phaseSystem::incompressible(const word phaseName) const
971 {
972  return phaseModels_[phaseName]->thermo().incompressible();
973 }
974 
975 
977 {
978  forAllConstIters(phaseModels_, iter)
979  {
980  if (!iter()->thermo().isochoric())
981  {
982  return false;
983  }
984  }
985 
986  return true;
987 }
988 
989 
991 {
992  return mesh_;
993 }
994 
995 
998 {
999  auto tstf = tmp<surfaceScalarField>::New
1000  (
1001  IOobject
1002  (
1003  "surfaceTensionForce",
1004  mesh_.time().timeName(),
1005  mesh_
1006  ),
1007  mesh_,
1008  dimensionedScalar({1, -2, -2, 0, 0, 0}, Zero)
1009  );
1010 
1011  auto& stf = tstf.ref();
1012  stf.setOriented();
1013 
1014  if (surfaceTensionModels_.size())
1015  {
1016  forAllConstIters(phaseModels_, iter1)
1017  {
1018  const volScalarField& alpha1 = iter1()();
1019 
1020  auto iter2 = iter1;
1021 
1022  for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1023  {
1024  const volScalarField& alpha2 = iter2()();
1025 
1026  stf +=
1028  (
1029  surfaceTensionCoeff
1030  (
1031  phasePairKey(iter1()->name(), iter2()->name())
1032  )
1033  )
1035  (
1038  );
1039  }
1040  }
1041  }
1042 
1043  return tstf;
1044 }
1045 
1046 
1048 {
1049  auto tstf = tmp<volVectorField>::New
1050  (
1051  IOobject
1052  (
1053  "U",
1054  mesh_.time().timeName(),
1055  mesh_
1056  ),
1057  mesh_,
1059  );
1060 
1061  auto& stf = tstf.ref();
1062 
1063  forAllConstIters(phaseModels_, iter)
1064  {
1065  stf += iter()() * iter()->U();
1066  }
1067 
1068  return tstf;
1069 }
1070 
1071 
1074 {
1075  return surfaceTensionModels_[key]->sigma();
1076 }
1077 
1078 
1081  const word& key
1082 ) const
1083 {
1084  return 1.0/(phaseModels_[key]->thermo().rho());
1085 }
1086 
1087 
1089 {
1090  const scalarField& Vc = mesh_.V();
1091  scalarField& Udiag = UEqn.diag();
1092 
1093  forAllConstIters(phaseModels_, iteri)
1094  {
1095  const phaseModel& phasei = iteri()();
1096 
1097  auto iterk = iteri;
1098 
1099  for (++iterk; iterk != phaseModels_.cend(); ++iterk)
1100  {
1101  if (iteri()().name() != iterk()().name())
1102  {
1103  const phaseModel& phasek = iterk()();
1104 
1105  // Phase i and k
1106  const phasePairKey keyik
1107  (
1108  phasei.name(),
1109  phasek.name(),
1110  false
1111  );
1112 
1113  if (interfacePorousModelTable_.found(keyik))
1114  {
1115  autoPtr<porousModel>& interfacePtr =
1116  interfacePorousModelTable_[keyik];
1117 
1118  Udiag += Vc*interfacePtr->S();
1119  }
1120  }
1121  }
1122  }
1123 }
1124 
1125 
1128  const volScalarField& alpha1,
1129  const volScalarField& alpha2
1130 ) const
1131 {
1132  tmp<surfaceVectorField> tnHatfv = nHatfv(alpha1, alpha2);
1133 
1134  // Simple expression for curvature
1135  return -fvc::div(tnHatfv.ref() & mesh_.Sf());
1136 }
1137 
1138 
1141  const volScalarField& alpha1,
1142  const volScalarField& alpha2
1143 ) const
1144 {
1145  return
1146  (
1147  pos(alpha1 - 0.1)*pos(0.9 - alpha1)
1148  *pos(alpha2 - 0.1)*pos(0.9 - alpha2)
1149  );
1150 }
1151 
1152 
1154 {
1155  auto tnearInt = tmp<volScalarField>::New
1156  (
1157  IOobject
1158  (
1159  "nearInterface",
1160  mesh_.time().timeName(),
1161  mesh_
1162  ),
1163  mesh_,
1165  );
1166 
1167  auto& nearInt = tnearInt.ref();
1168 
1169  forAllConstIters(phaseModels_, iter1)
1170  {
1171  const volScalarField& alpha1 = iter1()();
1172 
1173  auto iter2 = iter1;
1174 
1175  for (++iter2; iter2 != phaseModels_.cend(); ++iter2)
1176  {
1177  const volScalarField& alpha2 = iter2()();
1178 
1179  nearInt +=
1180  (
1181  pos(alpha1 - 0.1)*pos(0.9 - alpha1)
1182  *pos(alpha2 - 0.1)*pos(0.9 - alpha2)
1183  );
1184  }
1185  }
1186 
1187  return tnearInt;
1188 }
1189 
1190 
1193  const volScalarField& alpha1,
1194  const volScalarField& alpha2
1195 ) const
1196 {
1197 
1198  surfaceVectorField gradAlphaf
1199  (
1202  );
1203 
1204  const dimensionedScalar deltaN
1205  (
1206  "deltaN",
1207  1e-8/cbrt(average(mesh_.V()))
1208  );
1209 
1210  // Face unit interface normal
1211  return gradAlphaf/(mag(gradAlphaf) + deltaN);
1212 }
1213 
1214 
1217  const volScalarField& alpha1,
1218  const volScalarField& alpha2
1219 ) const
1220 {
1221  // Face unit interface normal flux
1222  return nHatfv(alpha1, alpha2) & mesh_.Sf();
1223 }
1224 
1225 
1227 {
1228  if (regIOobject::read())
1229  {
1230  return true;
1231  }
1232 
1233  return false;
1234 }
1235 
1236 
1237 // ************************************************************************* //
Foam::phaseSystem::totalPhasePairs
const phasePairTable & totalPhasePairs() const
Constant access the total phase pairs.
Definition: phaseSystem.C:944
Foam::phaseSystem::surfaceTensionForce
tmp< surfaceScalarField > surfaceTensionForce() const
Calculate surface tension of the mixture.
Definition: phaseSystem.C:997
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:549
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:458
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
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:684
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::IOobject::AUTO_WRITE
Definition: IOobject.H:194
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:846
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
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:1153
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:1216
Foam::phaseSystem::Prt
const dimensionedScalar & Prt() const
Return Prandt number.
Definition: phaseSystem.C:799
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:191
Foam::glTF::key
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:108
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:351
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:887
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:1047
Foam::phaseSystem::mu
virtual tmp< volScalarField > mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: phaseSystem.C:805
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:291
Foam::phaseSystem::mu_
volScalarField mu_
Dynamic viscocity.
Definition: phaseSystem.H:124
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:511
Foam::phaseSystem::he
virtual volScalarField & he()
Return access to the internal energy field [J/Kg].
Definition: phaseSystem.H:274
Foam::phaseSystem::nHatfv
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Interface normal surface vector.
Definition: phaseSystem.C:1192
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:1127
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:53
Foam::tmp::ref
T & ref() const
Definition: tmpI.H:227
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:748
Foam::phaseSystem::CpByCpv
virtual tmp< volScalarField > CpByCpv() const
Heat capacity ratio [].
Definition: phaseSystem.C:590
porousModel.H
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:727
Foam::IOobject::READ_IF_PRESENT
Definition: IOobject.H:187
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:911
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
Foam::phasePairKey
An ordered or unorder pair of phase names. Typically specified as follows.
Definition: phasePairKey.H:65
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:417
Foam::phaseSystem::W
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol] of the mixture.
Definition: phaseSystem.C:636
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:332
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dimMass
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::phaseSystem::kappa
virtual tmp< volScalarField > kappa() const
Thermal diffusivity for temperature of mixture [J/m/s/K].
Definition: phaseSystem.C:643
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::getOrAddToDict
static dimensioned< Type > getOrAddToDict(const word &name, dictionary &dict, const dimensionSet &dims=dimless, const Type &deflt=Type(Zero))
Construct dimensioned from dictionary, with default value.
Definition: dimensionedType.C:374
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:990
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:922
Foam::phaseSystem::surfaceTensionCoeff
virtual tmp< volScalarField > surfaceTensionCoeff(const phasePairKey &key) const
Return the surface tension coefficient.
Definition: phaseSystem.C:1073
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:257
Foam::phaseSystem::isochoric
virtual bool isochoric() const
Return true if the equation of state is isochoric for all phasses.
Definition: phaseSystem.C:976
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:899
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:80
Foam::phaseSystem::addInterfacePorosity
void addInterfacePorosity(fvVectorMatrix &UEqn)
Add interface porosity on phasePair.
Definition: phaseSystem.C:1088
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::phaseSystem::rhoEoS
virtual tmp< scalarField > rhoEoS(const scalarField &p, const scalarField &T, const labelList &cells) const
Density from pressure and temperature.
Definition: phaseSystem.C:500
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
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:931
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:60
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::phaseSystem::rho
virtual tmp< volScalarField > rho() const
Return the mixture density.
Definition: phaseSystem.C:376
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:956
Foam::phaseSystem::read
virtual bool read()
Read base phaseProperties dictionary.
Definition: phaseSystem.C:1226
Foam::phaseSystem::coeffs
virtual tmp< volScalarField > coeffs(const word &key) const
Return coefficients (1/rho)
Definition: phaseSystem.C:1080
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::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189
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