MaxwellStefan.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "MaxwellStefan.H"
27 #include "fvcDiv.H"
28 #include "fvcLaplacian.H"
29 #include "fvcSnGrad.H"
30 #include "fvmSup.H"
31 #include "fvmLaplacian.H"
32 #include "surfaceInterpolate.H"
33 #include "speciesTable.H"
34 #include "Function2Evaluate.H"
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
38 namespace Foam
39 {
40 
41 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
42 
43 template<class BasicThermophysicalTransportModel>
44 void MaxwellStefan<BasicThermophysicalTransportModel>::
45 transformDiffusionCoefficient() const
46 {
47  const label d = this->thermo().defaultSpecie();
48 
49  // Calculate the molecular weight of the mixture and the mole fractions
50  scalar Wm = 0;
51 
52  forAll(W, i)
53  {
54  X[i] = Y[i]/W[i];
55  Wm += X[i];
56  }
57 
58  Wm = 1/Wm;
59  X *= Wm;
60 
61  // i counter for the specie sub-system without the default specie
62  label is = 0;
63 
64  // Calculate the A and B matrices from the binary mass diffusion
65  // coefficients and specie mole fractions
66  forAll(X, i)
67  {
68  if (i != d)
69  {
70  A(is, is) = -X[i]*Wm/(DD(i, d)*W[d]);
71  B(is, is) = -(X[i]*Wm/W[d] + (1 - X[i])*Wm/W[i]);
72 
73  // j counter for the specie sub-system without the default specie
74  label js = 0;
75 
76  forAll(X, j)
77  {
78  if (j != i)
79  {
80  A(is, is) -= X[j]*Wm/(DD(i, j)*W[i]);
81 
82  if (j != d)
83  {
84  A(is, js) =
85  X[i]*(Wm/(DD(i, j)*W[j]) - Wm/(DD(i, d)*W[d]));
86 
87  B(is, js) = X[i]*(Wm/W[j] - Wm/W[d]);
88  }
89  }
90 
91  if (j != d)
92  {
93  js++;
94  }
95  }
96 
97  is++;
98  }
99  }
100 
101  // LU decompose A and invert
102  A.decompose();
103  A.inv(invA);
104 
105  // Calculate the generalised Fick's law diffusion coefficients
106  multiply(D_, invA, B);
107 }
108 
109 
110 template<class BasicThermophysicalTransportModel>
111 void MaxwellStefan<BasicThermophysicalTransportModel>::
112 transformDiffusionCoefficientFields() const
113 {
114  const label d = this->thermo().defaultSpecie();
115 
116  // For each cell or patch face
117  forAll(*(YPtrs[0]), pi)
118  {
119  forAll(W, i)
120  {
121  // Map YPtrs -> Y
122  Y[i] = (*YPtrs[i])[pi];
123 
124  // Map DijPtrs -> DD
125  forAll(W, j)
126  {
127  DD(i, j) = (*DijPtrs[i][j])[pi];
128  }
129  }
130 
131  // Transform DD -> D
132  transformDiffusionCoefficient();
133 
134  // i counter for the specie sub-system without the default specie
135  label is = 0;
136 
137  forAll(W, i)
138  {
139  if (i != d)
140  {
141  // j counter for the specie sub-system
142  // without the default specie
143  label js = 0;
144 
145  // Map D -> DijPtrs
146  forAll(W, j)
147  {
148  if (j != d)
149  {
150  (*DijPtrs[i][j])[pi] = D_(is, js);
151 
152  js++;
153  }
154  }
155 
156  is++;
157  }
158  }
159  }
160 }
161 
162 
163 template<class BasicThermophysicalTransportModel>
164 void MaxwellStefan<BasicThermophysicalTransportModel>::transform
165 (
166  List<PtrList<volScalarField>>& Dij
167 ) const
168 {
169  const PtrList<volScalarField>& Y = this->thermo().Y();
170  const volScalarField& Y0 = Y[0];
171 
172  forAll(W, i)
173  {
174  // Map this->thermo().Y() internal fields -> YPtrs
175  YPtrs[i] = &Y[i].primitiveField();
176 
177  // Map Dii_ internal fields -> DijPtrs
178  DijPtrs[i][i] = &Dii_[i].primitiveFieldRef();
179 
180  // Map Dij internal fields -> DijPtrs
181  forAll(W, j)
182  {
183  if (j != i)
184  {
185  DijPtrs[i][j] = &Dij[i][j].primitiveFieldRef();
186  }
187  }
188  }
189 
190  // Transform binary mass diffusion coefficients internal field DijPtrs ->
191  // generalised Fick's law diffusion coefficients DijPtrs
192  transformDiffusionCoefficientFields();
193 
194  forAll(Y0.boundaryField(), patchi)
195  {
196  forAll(W, i)
197  {
198  // Map this->thermo().Y() patch fields -> YPtrs
199  YPtrs[i] = &Y[i].boundaryField()[patchi];
200 
201  // Map Dii_ patch fields -> DijPtrs
202  DijPtrs[i][i] = &Dii_[i].boundaryFieldRef()[patchi];
203 
204  // Map Dij patch fields -> DijPtrs
205  forAll(W, j)
206  {
207  if (j != i)
208  {
209  DijPtrs[i][j] = &Dij[i][j].boundaryFieldRef()[patchi];
210  }
211  }
212  }
213 
214  // Transform binary mass diffusion coefficients patch field DijPtrs ->
215  // generalised Fick's law diffusion coefficients DijPtrs
216  transformDiffusionCoefficientFields();
217  }
218 }
219 
220 
221 template<class BasicThermophysicalTransportModel>
223 {
224  const label d = this->thermo().defaultSpecie();
225 
226  const PtrList<volScalarField>& Y = this->thermo().Y();
227  const volScalarField& p = this->thermo().p();
228  const volScalarField& T = this->thermo().T();
229  const volScalarField& rho = this->momentumTransport().rho();
230 
231  Dii_.setSize(Y.size());
232  jexp_.setSize(Y.size());
233 
234  List<PtrList<volScalarField>> Dij(Y.size());
235 
236  // Evaluate the specie binary mass diffusion coefficient functions
237  // and initialise the explicit part of the specie mass flux fields
238  forAll(Y, i)
239  {
240  if (i != d)
241  {
242  if (jexp_.set(i))
243  {
244  jexp_[i] = Zero;
245  }
246  else
247  {
248  jexp_.set
249  (
250  i,
252  (
253  "jexp" + Y[i].name(),
254  Y[i].mesh(),
255  dimensionedScalar(dimensionSet(1, -2, -1, 0, 0), 0)
256  )
257  );
258  }
259  }
260 
261  Dii_.set(i, evaluate(DFuncs_[i][i], dimKinematicViscosity, p, T));
262 
263  Dij[i].setSize(Y.size());
264 
265  forAll(Y, j)
266  {
267  if (j > i)
268  {
269  Dij[i].set
270  (
271  j,
272  evaluate(DFuncs_[i][j], dimKinematicViscosity, p, T)
273  );
274  }
275  else if (j < i)
276  {
277  Dij[i].set(j, Dij[j][i].clone());
278  }
279  }
280  }
281 
282  //- Transform the binary mass diffusion coefficients into the
283  // the generalised Fick's law diffusion coefficients
284  transform(Dij);
285 
286  // Accumulate the explicit part of the specie mass flux fields
287  forAll(Y, j)
288  {
289  if (j != d)
290  {
291  const surfaceScalarField snGradYj(fvc::snGrad(Y[j]));
292 
293  forAll(Y, i)
294  {
295  if (i != d && i != j)
296  {
297  jexp_[i] -= fvc::interpolate(rho*Dij[i][j])*snGradYj;
298  }
299  }
300  }
301  }
302 
303  // Optionally add the Soret thermal diffusion contribution to the
304  // explicit part of the specie mass flux fields
305  if (DTFuncs_.size())
306  {
308 
309  forAll(Y, i)
310  {
311  if (i != d)
312  {
313  jexp_[i] -= fvc::interpolate
314  (
315  evaluate(DTFuncs_[i], dimDynamicViscosity, p, T)
316  )*gradTbyT;
317  }
318  }
319  }
320 
321  // Compute the effective diffusivity of the species, if necessary
322  if (!Di_.empty())
323  {
324  Di_.setSize(Y.size());
325 
326  forAll(Y, i)
327  {
328  // Copy the diagonal coefficient to begin with
329  Di_.set(i, Dii_[i].clone().ptr());
330 
331  // The mass fraction of the sub-system excluding this specie
332  const volScalarField sumYnoti(max(1 - Y[i], small));
333 
334  // Subtract the off-diagonal coefficients, weighted by their
335  // specie's fraction in the sub-system
336  forAll(Y, j)
337  {
338  if (j != i)
339  {
340  Di_[i] -= Y[j]/sumYnoti*Dij[i][j];
341  }
342  }
343  }
344  }
345 }
346 
347 
348 template<class BasicThermophysicalTransportModel>
349 const PtrList<volScalarField>&
350 MaxwellStefan<BasicThermophysicalTransportModel>::Dii() const
351 {
352  if (!Dii_.size())
353  {
354  updateDii();
355  }
356 
357  return Dii_;
358 }
359 
360 
361 template<class BasicThermophysicalTransportModel>
362 const PtrList<surfaceScalarField>&
363 MaxwellStefan<BasicThermophysicalTransportModel>::jexp() const
364 {
365  if (!jexp_.size())
366  {
367  updateDii();
368  }
369 
370  return jexp_;
371 }
372 
373 
374 template<class BasicThermophysicalTransportModel>
375 const PtrList<volScalarField>&
376 MaxwellStefan<BasicThermophysicalTransportModel>::Di() const
377 {
378  if (!Di_.size())
379  {
380  const PtrList<volScalarField>& Y = this->thermo().Y();
381  Di_.setSize(Y.size()); // <-- Mark as to be computed from now on
382  updateDii();
383  }
384 
385  return Dii_;
386 }
387 
388 
389 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
390 
391 template<class BasicThermophysicalTransportModel>
393 (
394  const word& type,
395  const momentumTransportModel& momentumTransport,
396  const thermoModel& thermo
397 )
398 :
399  BasicThermophysicalTransportModel
400  (
401  type,
402  momentumTransport,
403  thermo
404  ),
405 
407 
408  DFuncs_(this->thermo().species().size()),
409 
410  DTFuncs_
411  (
412  this->typeDict(type).found("DT")
413  ? this->thermo().species().size()
414  : 0
415  ),
416 
417  W(this->thermo().species().size()),
418 
419  YPtrs(W.size()),
420  DijPtrs(W.size()),
421 
422  Y(W.size()),
423  X(W.size()),
424  DD(W.size()),
425  A(W.size() - 1),
426  B(A.m()),
427  invA(A.m()),
428  D_(W.size())
429 {
430  // Set the molecular weights of the species
431  forAll(W, i)
432  {
433  W[i] = this->thermo().Wi(i).value();
434  }
435 }
436 
437 
438 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
439 
440 template<class BasicThermophysicalTransportModel>
442 {
443  if
444  (
446  )
447  {
448  const speciesTable& species = this->thermo().species();
449 
450  const dictionary& coeffDict = this->typeDict();
451  const dictionary& Ddict = coeffDict.subDict("D");
452 
453  // Read the array of specie binary mass diffusion coefficient functions
454  forAll(species, i)
455  {
456  DFuncs_[i].setSize(species.size());
457 
458  forAll(species, j)
459  {
460  if (j >= i)
461  {
462  const word nameij(species[i] + '-' + species[j]);
463  const word nameji(species[j] + '-' + species[i]);
464 
465  word Dname;
466 
467  if (Ddict.found(nameij) && Ddict.found(nameji))
468  {
469  if (i != j)
470  {
472  << "Binary mass diffusion coefficients "
473  "for both " << nameij << " and " << nameji
474  << " provided, using " << nameij << endl;
475  }
476 
477  Dname = nameij;
478  }
479  else if (Ddict.found(nameij))
480  {
481  Dname = nameij;
482  }
483  else if (Ddict.found(nameji))
484  {
485  Dname = nameji;
486  }
487  else
488  {
490  << "Binary mass diffusion coefficients for pair "
491  << nameij << " or " << nameji << " not provided"
492  << exit(FatalIOError);
493  }
494 
495  DFuncs_[i].set
496  (
497  j,
499  (
500  Dname,
501  dimPressure,
504  Ddict
505  ).ptr()
506  );
507  }
508  }
509  }
510 
511  // Optionally read the List of specie Soret thermal diffusion
512  // coefficient functions
513  if (coeffDict.found("DT"))
514  {
515  const dictionary& DTdict = coeffDict.subDict("DT");
516 
517  forAll(species, i)
518  {
519  DTFuncs_.set
520  (
521  i,
523  (
524  species[i],
525  dimPressure,
528  DTdict
529  ).ptr()
530  );
531  }
532  }
533 
534  return true;
535  }
536  else
537  {
538  return false;
539  }
540 }
541 
542 
543 template<class BasicThermophysicalTransportModel>
545 (
546  const volScalarField& Yi
547 ) const
548 {
549  return volScalarField::New
550  (
551  "D",
552  this->momentumTransport().rho()
553  *Di()[this->thermo().specieIndex(Yi)]
554  );
555 }
556 
557 
558 template<class BasicThermophysicalTransportModel>
560 (
561  const volScalarField& Yi,
562  const label patchi
563 ) const
564 {
565  return
566  this->momentumTransport().rho().boundaryField()[patchi]
567  *Di()[this->thermo().specieIndex(Yi)].boundaryField()[patchi];
568 }
569 
570 
571 template<class BasicThermophysicalTransportModel>
573 (
574  const volScalarField& Yi
575 ) const
576 {
577  return volScalarField::New
578  (
579  "DEff",
580  this->momentumTransport().rho()*Dii()[this->thermo().specieIndex(Yi)]
581  );
582 }
583 
584 
585 template<class BasicThermophysicalTransportModel>
587 (
588  const volScalarField& Yi,
589  const label patchi
590 ) const
591 {
592  return
593  this->momentumTransport().rho().boundaryField()[patchi]
594  *Dii()[this->thermo().specieIndex(Yi)].boundaryField()[patchi];
595 }
596 
597 
598 template<class BasicThermophysicalTransportModel>
601 {
603  (
605  (
607  (
608  "q",
609  this->thermo().phaseName()
610  ),
611  -fvc::interpolate(this->alpha()*this->kappaEff())
612  *fvc::snGrad(this->thermo().T())
613  )
614  );
615 
616  const label d = this->thermo().defaultSpecie();
617 
618  const PtrList<volScalarField>& Y = this->thermo().Y();
619  const volScalarField& p = this->thermo().p();
620  const volScalarField& T = this->thermo().T();
621 
622  if (Y.size())
623  {
624  surfaceScalarField sumJ
625  (
627  (
628  "sumJ",
629  Y[0].mesh(),
631  )
632  );
633 
634  surfaceScalarField sumJh
635  (
637  (
638  "sumJh",
639  Y[0].mesh(),
641  )
642  );
643 
644  forAll(Y, i)
645  {
646  if (i != d)
647  {
648  const volScalarField hi(this->thermo().hsi(i, p, T));
649 
650  const surfaceScalarField ji(this->j(Y[i]));
651 
652  sumJ += ji;
653 
654  sumJh += ji*fvc::interpolate(hi);
655  }
656  }
657 
658  {
659  const label i = d;
660 
661  const volScalarField hi(this->thermo().hsi(i, p, T));
662 
663  sumJh -= sumJ*fvc::interpolate(hi);
664  }
665 
666  tmpq.ref() += sumJh;
667  }
668 
669  return tmpq;
670 }
671 
672 
673 template<class BasicThermophysicalTransportModel>
675 (
676  const label patchi
677 ) const
678 {
679  tmp<scalarField> tmpq
680  (
681  - (
682  this->alpha().boundaryField()[patchi]
683  *this->kappaEff(patchi)
684  *this->thermo().T().boundaryField()[patchi]
685  )
686  );
687 
688  const label d = this->thermo().defaultSpecie();
689 
690  const PtrList<volScalarField>& Y = this->thermo().Y();
691  const volScalarField& p = this->thermo().p();
692  const volScalarField& T = this->thermo().T();
693 
694  if (Y.size())
695  {
696  scalarField sumJ(tmpq->size(), scalar(0));
697  scalarField sumJh(tmpq->size(), scalar(0));
698 
699  forAll(Y, i)
700  {
701  if (i != d)
702  {
703  const scalarField hi(this->thermo().hsi(i, p, T));
704 
705  const scalarField ji(this->j(Y[i], patchi));
706 
707  sumJ += ji;
708 
709  sumJh += ji*hi;
710  }
711  }
712 
713  {
714  const label i = d;
715 
716  const scalarField hi(this->thermo().hsi(i, p, T));
717 
718  sumJh -= sumJ*hi;
719  }
720 
721  tmpq.ref() += sumJh;
722  }
723 
724  return tmpq;
725 }
726 
727 
728 template<class BasicThermophysicalTransportModel>
730 (
731  volScalarField& he
732 ) const
733 {
734  tmp<fvScalarMatrix> tmpDivq
735  (
736  fvm::Su
737  (
738  -fvc::laplacian(this->alpha()*this->kappaEff(), this->thermo().T()),
739  he
740  )
741  );
742 
743  const label d = this->thermo().defaultSpecie();
744 
745  const PtrList<volScalarField>& Y = this->thermo().Y();
746  const volScalarField& p = this->thermo().p();
747  const volScalarField& T = this->thermo().T();
748 
749  tmpDivq.ref() -=
750  fvm::laplacianCorrection(this->alpha()*this->alphaEff(), he);
751 
752  surfaceScalarField sumJ
753  (
755  (
756  "sumJ",
757  he.mesh(),
759  )
760  );
761 
762  surfaceScalarField sumJh
763  (
765  (
766  "sumJh",
767  he.mesh(),
768  dimensionedScalar(sumJ.dimensions()*he.dimensions(), 0)
769  )
770  );
771 
772  forAll(Y, i)
773  {
774  if (i != d)
775  {
776  const volScalarField hi(this->thermo().hsi(i, p, T));
777 
778  const surfaceScalarField ji(this->j(Y[i]));
779 
780  sumJ += ji;
781 
782  sumJh += ji*fvc::interpolate(hi);
783  }
784  }
785 
786  {
787  const label i = d;
788 
789  const volScalarField hi(this->thermo().hsi(i, p, T));
790 
791  sumJh -= sumJ*fvc::interpolate(hi);
792  }
793 
794  tmpDivq.ref() += fvc::div(sumJh*he.mesh().magSf());
795 
796  return tmpDivq;
797 }
798 
799 
800 template<class BasicThermophysicalTransportModel>
802 (
803  const volScalarField& Yi
804 ) const
805 {
806  const label d = this->thermo().defaultSpecie();
807 
808  if (this->thermo().specieIndex(Yi) == d)
809  {
810  const PtrList<volScalarField>& Y = this->thermo().Y();
811 
813  (
815  (
817  (
818  "j" + name(d),
819  this->thermo().phaseName()
820  ),
821  Yi.mesh(),
823  )
824  );
825 
826  surfaceScalarField& jd = tjd.ref();
827 
828  forAll(Y, i)
829  {
830  if (i != d)
831  {
832  jd -= this->j(Y[i]);
833  }
834  }
835 
836  return tjd;
837  }
838  else
839  {
840  return
841  BasicThermophysicalTransportModel::j(Yi)
842  + jexp()[this->thermo().specieIndex(Yi)];
843  }
844 }
845 
846 
847 template<class BasicThermophysicalTransportModel>
849 (
850  const volScalarField& Yi,
851  const label patchi
852 ) const
853 {
854  const label d = this->thermo().defaultSpecie();
855 
856  if (this->thermo().specieIndex(Yi) == d)
857  {
858  const PtrList<volScalarField>& Y = this->thermo().Y();
859 
860  tmp<scalarField> tjd
861  (
862  new scalarField(Yi.boundaryField()[patchi].size(), scalar(0))
863  );
864  scalarField& jd = tjd.ref();
865 
866  forAll(Y, i)
867  {
868  if (i != d)
869  {
870  jd -= this->j(Y[i], patchi);
871  }
872  }
873 
874  return tjd;
875  }
876  else
877  {
878  return
879  BasicThermophysicalTransportModel::j(Yi, patchi)
880  + jexp()[this->thermo().specieIndex(Yi)].boundaryField()[patchi];
881  }
882 }
883 
884 
885 template<class BasicThermophysicalTransportModel>
887 (
888  volScalarField& Yi
889 ) const
890 {
891  return
892  BasicThermophysicalTransportModel::divj(Yi)
893  + fvc::div(jexp()[this->thermo().specieIndex(Yi)]*Yi.mesh().magSf());
894 }
895 
896 
897 template<class BasicThermophysicalTransportModel>
899 {
900  BasicThermophysicalTransportModel::predict();
901  updateDii();
902 }
903 
904 
905 template<class BasicThermophysicalTransportModel>
907 {
908  return true;
909 }
910 
911 
912 template<class BasicThermophysicalTransportModel>
914 (
915  const polyTopoChangeMap& map
916 )
917 {
918  // Delete the cached Dii and jexp, will be re-created in predict
919  Dii_.clear();
920  jexp_.clear();
921 
922  // Clear Di elements (if any) individually so the entire list is still
923  // marked as to be computed from now on
924  forAll(Di_, i)
925  {
926  Di_.set(i, nullptr);
927  }
928 }
929 
930 
931 template<class BasicThermophysicalTransportModel>
933 (
934  const polyMeshMap& map
935 )
936 {
937  // Delete the cached Dii and jexp, will be re-created in predict
938  Dii_.clear();
939  jexp_.clear();
940 
941  // Clear Di elements (if any) individually so the entire list is still
942  // marked as to be computed from now on
943  forAll(Di_, i)
944  {
945  Di_.set(i, nullptr);
946  }
947 }
948 
949 
950 template<class BasicThermophysicalTransportModel>
952 (
953  const polyDistributionMap& map
954 )
955 {
956  // Delete the cached Dii and jexp, will be re-created in predict
957  Dii_.clear();
958  jexp_.clear();
959 
960  // Clear Di elements (if any) individually so the entire list is still
961  // marked as to be computed from now on
962  forAll(Di_, i)
963  {
964  Di_.set(i, nullptr);
965  }
966 }
967 
968 
969 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
970 
971 } // End namespace Foam
972 
973 // ************************************************************************* //
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
const dimensionSet & dimensions() const
Return dimensions.
const GeoMesh & mesh() const
Return mesh.
Run-time selectable function of two variables.
Definition: Function2.H:62
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static tmp< GeometricField< Type, GeoMesh, PrimitiveField > > New(const word &name, const Internal &, const PtrList< Patch > &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
static word groupName(Name name, const word &group)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Base class for multi-component Maxwell Stefan generalised Fick's law diffusion coefficients based tem...
Definition: MaxwellStefan.H:83
virtual bool movePoints()
Update for mesh motion.
virtual tmp< volScalarField > DEff(const volScalarField &Yi) const
Effective mass diffusion coefficient.
virtual tmp< fvScalarMatrix > divq(volScalarField &he) const
Return the source term for the energy equation.
virtual tmp< fvScalarMatrix > divj(volScalarField &Yi) const
Return the source term for the given specie mass-fraction equation.
virtual void predict()
Update the diffusion coefficients and flux corrections.
virtual void mapMesh(const polyMeshMap &map)
Update from another mesh using the given map.
virtual tmp< surfaceScalarField > j(const volScalarField &Yi) const
Return the specie flux for the given specie mass-fraction [kg/m^2/s].
virtual tmp< surfaceScalarField > q() const
Return the heat flux [W/m^2].
virtual void distribute(const polyDistributionMap &map)
Redistribute or update using the given distribution map.
MaxwellStefan(const word &type, const momentumTransportModel &momentumTransport, const thermoModel &thermo)
Construct from a momentum transport model and a thermo model.
BasicThermophysicalTransportModel::thermoModel thermoModel
virtual tmp< volScalarField > D(const volScalarField &Yi) const
Mass diffusivity.
BasicThermophysicalTransportModel::momentumTransportModel momentumTransportModel
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
virtual bool read()
Read thermophysicalTransport dictionary.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
virtual const volScalarField & T() const =0
Temperature [K].
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
Definition: dictionary.C:468
Dimension set for the base types.
Definition: dimensionSet.H:125
virtual const volScalarField & p() const =0
Pressure [Pa].
A wordList with hashed indices for faster lookup by name.
virtual const speciesTable & species() const =0
Return the table of species.
virtual PtrList< volScalarField > & Y()=0
Access the mass-fraction fields.
virtual label defaultSpecie() const =0
The index of the default specie.
label specieIndex(const volScalarField &Yi) const
Access the specie index of the given mass-fraction field.
Motion of the mesh specified as a list of pointMeshMovers.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition: tmp.H:55
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:197
A class for handling words, derived from string.
Definition: word.H:63
volSymmTensorField invA(inv(I *UEqn.A()+drag->Dcu()))
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
Calculate the divergence of the given field.
Calculate the laplacian of the given field.
Calculate the snGrad of the given volField.
Calculate the matrix for the laplacian of the field.
Calculate the matrix for implicit and explicit sources.
label patchi
rho
Definition: pEqn.H:1
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
#define WarningInFunction
Report a warning using Foam::Warning.
void read(Istream &, label &, const dictionary &)
In-place read with dictionary lookup.
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
tmp< VolField< Type > > laplacian(const VolField< Type > &vf, const word &name)
Definition: fvcLaplacian.C:45
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
Definition: fvcDiv.C:47
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
Definition: fvcSnGrad.C:45
tmp< fvMatrix< Type > > laplacianCorrection(const VolField< scalar > &gamma, const VolField< Type > &vf)
Definition: fvmLaplacian.C:340
tmp< fvMatrix< Type > > Su(const DimensionedField< Type, fvMesh > &, const VolField< Type > &)
static const coefficient B("B", dimless, 18.678)
static const coefficient A("A", dimPressure, 611.21)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
static const zero Zero
Definition: zero.H:97
const dimensionSet & dimKinematicViscosity
Definition: dimensions.C:171
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dimensionSet & dimDynamicViscosity
Definition: dimensions.C:173
const dimensionSet & dimMass
Definition: dimensions.C:140
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
void transform(GeometricField< Type, GeoMesh > &rtf, const GeometricField< tensor, GeoMesh > &trf, const GeometricField< Type, GeoMesh > &tf)
SurfaceField< scalar > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
scalarList W(const fluidMulticomponentThermo &thermo)
void evaluate(GeometricField< Type, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, GeoMesh > &x)
const dimensionSet & dimTime
Definition: dimensions.C:142
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
T clone(const T &t)
Definition: List.H:55
const dimensionSet & dimPressure
Definition: dimensions.C:163
IOerror FatalIOError
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const dimensionSet & dimEnergy
Definition: dimensions.C:160
void multiply(pointPatchField< Type > &f, const pointPatchField< scalar > &f1, const pointPatchField< Type > &f2)
const dimensionSet & dimArea
Definition: dimensions.C:149
void T(GeometricField< Type, GeoMesh, PrimitiveField1 > &gf, const GeometricField< Type, GeoMesh, PrimitiveField2 > &gf1)
const dimensionSet & dimTemperature
Definition: dimensions.C:143
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
volScalarField & p
PtrList< volScalarField > & Y
scalarList Y0(nSpecie, 0.0)
fluidMulticomponentThermo & thermo
Definition: createFields.H:15