phaseSystem.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) 2015-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 "phaseSystem.H"
28 #include "surfaceInterpolate.H"
29 #include "fvcDdt.H"
30 #include "localEulerDdtScheme.H"
31 #include "fvcDiv.H"
32 #include "fvcGrad.H"
33 #include "fvcSnGrad.H"
34 #include "fvCorrectPhi.H"
35 #include "fvcMeshPhi.H"
38 #include "correctContactAngle.H"
42 #include "pressureReference.H"
43 
44 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
49 }
50 
51 
52 const Foam::word Foam::phaseSystem::propertiesName("phaseProperties");
53 
54 
55 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
56 
58 {
60  (
62  (
63  "sumAlphaMoving",
66  )
67  );
68 
69  for
70  (
71  label movingPhasei=1;
72  movingPhasei<movingPhaseModels_.size();
73  movingPhasei++
74  )
75  {
76  sumAlphaMoving.ref() += movingPhaseModels_[movingPhasei];
77  }
78 
79  return sumAlphaMoving;
80 }
81 
82 
84 {
85  // Calculate the mean velocity difference with respect to Um0
86  // from the current velocity of the moving phases
87  volVectorField dUm(Um0);
88 
89  forAll(movingPhaseModels_, movingPhasei)
90  {
91  dUm -=
92  movingPhaseModels_[movingPhasei]
93  *movingPhaseModels_[movingPhasei].U();
94  }
95 
96  forAll(movingPhaseModels_, movingPhasei)
97  {
98  movingPhaseModels_[movingPhasei].URef() += dUm;
99  }
100 }
101 
102 
104 (
105  const PtrList<surfaceScalarField>& alphafs,
106  const surfaceScalarField& phim0
107 )
108 {
109  // Calculate the mean flux difference with respect to phim0
110  // from the current flux of the moving phases
111  surfaceScalarField dphim(phim0);
112 
113  forAll(movingPhaseModels_, movingPhasei)
114  {
115  dphim -=
116  alphafs[movingPhaseModels_[movingPhasei].index()]
117  *movingPhaseModels_[movingPhasei].phi();
118  }
119 
120  forAll(movingPhaseModels_, movingPhasei)
121  {
122  movingPhaseModels_[movingPhasei].phiRef() += dphim;
123  }
124 }
125 
126 
128 (
129  const volScalarField& alpha1,
130  const volScalarField& alpha2
131 ) const
132 {
133  /*
134  // Cell gradient of alpha
135  volVectorField gradAlpha =
136  alpha2*fvc::grad(alpha1) - alpha1*fvc::grad(alpha2);
137 
138  // Interpolated face-gradient of alpha
139  surfaceVectorField gradAlphaf = fvc::interpolate(gradAlpha);
140  */
141 
142  surfaceVectorField gradAlphaf
143  (
145  - fvc::interpolate(alpha1)*fvc::interpolate(fvc::grad(alpha2))
146  );
147 
148  // Face unit interface normal
149  return gradAlphaf/(mag(gradAlphaf) + deltaN_);
150 }
151 
152 
154 (
155  const volScalarField& alpha1,
156  const volScalarField& alpha2
157 ) const
158 {
159  // Face unit interface normal flux
160  return nHatfv(alpha1, alpha2) & mesh_.Sf();
161 }
162 
163 
165 (
166  const phaseModel& phase1,
167  const phaseModel& phase2
168 ) const
169 {
170  tmp<surfaceVectorField> tnHatfv = nHatfv(phase1, phase2);
171 
173  (
174  phase1,
175  phase2,
176  phase1.U()().boundaryField(),
177  deltaN_,
178  tnHatfv.ref().boundaryFieldRef()
179  );
180 
181  // Simple expression for curvature
182  return -fvc::div(tnHatfv & mesh_.Sf());
183 }
184 
185 
186 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
187 
189 (
190  const fvMesh& mesh
191 )
192 :
194  (
195  IOobject
196  (
197  propertiesName,
198  mesh.time().constant(),
199  mesh,
200  IOobject::MUST_READ_IF_MODIFIED,
201  IOobject::NO_WRITE
202  )
203  ),
204 
205  mesh_(mesh),
206 
207  pimple_(mesh_.lookupObject<pimpleNoLoopControl>("solutionControl")),
208 
209  MRF_(MRFZones::New(mesh_)),
210 
211  referencePhaseName_(lookupOrDefault("referencePhase", word::null)),
212 
213  phaseModels_
214  (
215  lookup("phases"),
216  phaseModel::iNew(*this, referencePhaseName_)
217  ),
218 
219  phi_
220  (
221  IOobject
222  (
223  "phi",
224  mesh.time().name(),
225  mesh
226  ),
227  mesh,
229  ),
230 
231  dpdt_
232  (
233  IOobject
234  (
235  "dpdt",
236  mesh.time().name(),
237  mesh
238  ),
239  mesh,
241  ),
242 
243  cAlphas_
244  (
245  found("interfaceCompression")
246  ? generateInterfacialValues<scalar>
247  (
248  *this,
249  subDict("interfaceCompression")
250  )
251  : cAlphaTable()
252  ),
253 
254  deltaN_
255  (
256  "deltaN",
257  1e-8/pow(average(mesh_.V()), 1.0/3.0)
258  ),
259 
260  surfaceTensionCoefficientModels_()
261 {
262  Info<< indentOrNl << "Constructing " << typeName << " from "
263  << relativeObjectPath().c_str() << endl;
264 
265  printDictionary print(*this);
266 
267  // Surface tension models
269  generateInterfacialModels<surfaceTensionCoefficientModel>
270  (
271  *this,
272  subDict(modelName<surfaceTensionCoefficientModel>())
273  );
274 
275  // Groupings
276  label movingPhasei = 0;
277  label stationaryPhasei = 0;
278  label thermalPhasei = 0;
279  label multicomponentPhasei = 0;
280  forAll(phaseModels_, phasei)
281  {
282  phaseModel& phase = phaseModels_[phasei];
283  movingPhasei += !phase.stationary();
284  stationaryPhasei += phase.stationary();
285  thermalPhasei += !phase.isothermal();
286  multicomponentPhasei += !phase.pure();
287  }
288  movingPhaseModels_.resize(movingPhasei);
289  stationaryPhaseModels_.resize(stationaryPhasei);
290  thermalPhaseModels_.resize(thermalPhasei);
291  multicomponentPhaseModels_.resize(multicomponentPhasei);
292 
293  movingPhasei = 0;
294  stationaryPhasei = 0;
295  thermalPhasei = 0;
296  multicomponentPhasei = 0;
297  forAll(phaseModels_, phasei)
298  {
299  phaseModel& phase = phaseModels_[phasei];
300  if (!phase.stationary())
301  {
302  movingPhaseModels_.set(movingPhasei++, &phase);
303  }
304  if (phase.stationary())
305  {
306  stationaryPhaseModels_.set(stationaryPhasei++, &phase);
307  }
308  if (!phase.isothermal())
309  {
310  thermalPhaseModels_.set(thermalPhasei++, &phase);
311  }
312  if (!phase.pure())
313  {
314  multicomponentPhaseModels_.set(multicomponentPhasei++, &phase);
315  }
316  }
317 
318  forAll(movingPhaseModels_, movingPhasei)
319  {
320  phi_ +=
321  fvc::interpolate(movingPhaseModels_[movingPhasei])
322  *movingPhaseModels_[movingPhasei].phi();
323  }
324 
325  // Write phi
327 
328  // Update motion fields
330 
331  // Set the optional reference phase fraction from the other phases
333  {
334  phaseModel* referencePhasePtr = &phases()[referencePhaseName_];
335  volScalarField& referenceAlpha = *referencePhasePtr;
336 
337  referenceAlpha = 1;
338 
339  forAll(phaseModels_, phasei)
340  {
341  if (&phaseModels_[phasei] != referencePhasePtr)
342  {
343  referenceAlpha -= phaseModels_[phasei];
344  }
345  }
346  }
347 
348  forAll(phaseModels_, phasei)
349  {
350  const volScalarField& alphai = phases()[phasei];
351  mesh_.schemes().setFluxRequired(alphai.name());
352  }
353 
354  // Check for and warn about the type entry being present
355  if (found("type"))
356  {
358  << "The phase system type entry - type - in "
359  << relativeObjectPath() << " is no longer used"
360  << endl;
361  }
362 
363  // Check for and warn/error about phase change models being in the old
364  // location in constant/phaseProperties
365  const wordList modelEntries
366  ({
367  "phaseTransfer",
368  "saturationTemperature",
369  "interfaceComposition",
370  "diffusiveMassTransfer"
371  });
372 
373  OStringStream modelEntriesString;
374  forAll(modelEntries, i)
375  {
376  modelEntriesString<< modelEntries[i];
377  if (i < modelEntries.size() - 2) modelEntriesString<< ", ";
378  if (i == modelEntries.size() - 2) modelEntriesString<< " and ";
379  }
380 
381  label warnOrError = 0; // 1 == warn, 2 = error
382  forAll(modelEntries, i)
383  {
384  if (!found(modelEntries[i])) continue;
385 
386  warnOrError =
387  isDict(modelEntries[i]) && !subDict(modelEntries[i]).empty()
388  ? 2
389  : 1;
390  }
391 
392  OStringStream msg;
393  if (warnOrError != 0)
394  {
395  msg << "Phase change model entries - "
396  << modelEntriesString.str().c_str() << " - in "
397  << relativeObjectPath() << " are no longer used. These models "
398  << "are now specified as fvModels.";
399  }
400  if (warnOrError == 1)
401  {
403  << msg.str().c_str() << endl;
404  }
405  if (warnOrError == 2)
406  {
408  << msg.str().c_str() << exit(FatalIOError);
409  }
410 }
411 
412 
413 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
414 
416 {}
417 
418 
419 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
420 
422 {
423  nAlphaSubCyclesPtr = Function1<scalar>::New
424  (
425  dict.found("nAlphaSubCycles")
426  ? "nAlphaSubCycles"
427  : "nSubCycles",
428  dimless,
429  dimless,
430  dict
431  );
432 
434  (
435  {"nCorrectors", "nAlphaCorr"},
436  1
437  );
438 
439  MULESCorr = dict.lookupOrDefault<Switch>("MULESCorr", false);
440 
441  MULESCorrRelax = dict.lookupOrDefault<scalar>("MULESCorrRelax", 0.5);
442 
443  vDotResidualAlpha =
444  dict.lookupOrDefault("vDotResidualAlpha", 1e-4);
445 
446  MULES.read(dict);
447 
448  clip = dict.lookupOrDefault<Switch>("clip", true);
449 }
450 
451 
453 {
454  nAlphaSubCycles = ceil(nAlphaSubCyclesPtr->value(CoNum));
455 }
456 
457 
459 {
460  tmp<volScalarField> rho(movingPhaseModels_[0]*movingPhaseModels_[0].rho());
461 
462  for
463  (
464  label movingPhasei=1;
465  movingPhasei<movingPhaseModels_.size();
466  movingPhasei++
467  )
468  {
469  rho.ref() +=
470  movingPhaseModels_[movingPhasei]
471  *movingPhaseModels_[movingPhasei].rho();
472  }
473 
474  if (stationaryPhaseModels_.empty())
475  {
476  return rho;
477  }
478  else
479  {
480  return rho/sumAlphaMoving();
481  }
482 }
483 
484 
486 {
487  tmp<volVectorField> U(movingPhaseModels_[0]*movingPhaseModels_[0].U());
488 
489  for
490  (
491  label movingPhasei=1;
492  movingPhasei<movingPhaseModels_.size();
493  movingPhasei++
494  )
495  {
496  U.ref() +=
497  movingPhaseModels_[movingPhasei]
498  *movingPhaseModels_[movingPhasei].U();
499  }
500 
501  if (stationaryPhaseModels_.empty())
502  {
503  return U;
504  }
505  else
506  {
507  return U/sumAlphaMoving();
508  }
509 }
510 
511 
514 {
515  if (surfaceTensionCoefficientModels_.found(key))
516  {
517  return surfaceTensionCoefficientModels_[key].sigma();
518  }
519  else
520  {
521  return volScalarField::New
522  (
524  mesh_,
526  );
527  }
528 }
529 
530 
533 {
534  if (surfaceTensionCoefficientModels_.found(key))
535  {
536  return surfaceTensionCoefficientModels_[key].sigma(patchi);
537  }
538  else
539  {
540  return tmp<scalarField>
541  (
542  new scalarField(mesh_.boundary()[patchi].size(), 0)
543  );
544  }
545 }
546 
547 
550 {
551  tmp<volScalarField> tnearInt
552  (
554  (
555  "nearInterface",
556  mesh_,
558  )
559  );
560 
561  forAll(phases(), phasei)
562  {
563  tnearInt.ref() = max
564  (
565  tnearInt(),
566  pos0(phases()[phasei] - 0.01)*pos0(0.99 - phases()[phasei])
567  );
568  }
569 
570  return tnearInt;
571 }
572 
573 
575 (
576  const phaseModel& phase1
577 ) const
578 {
579  tmp<surfaceScalarField> tSurfaceTension
580  (
582  (
583  "surfaceTension",
584  mesh_,
585  dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), 0)
586  )
587  );
588 
589  forAll(phases(), phasej)
590  {
591  const phaseModel& phase2 = phases()[phasej];
592 
593  if (&phase2 != &phase1)
594  {
595  const phaseInterface interface(phase1, phase2);
596 
597  if (cAlphas_.found(interface))
598  {
599  tSurfaceTension.ref() +=
600  fvc::interpolate(sigma(interface)*K(phase1, phase2))
601  *(
602  fvc::interpolate(phase2)*fvc::snGrad(phase1)
603  - fvc::interpolate(phase1)*fvc::snGrad(phase2)
604  );
605  }
606  }
607  }
608 
609  return tSurfaceTension;
610 }
611 
612 
614 {
615  forAll(phaseModels_, phasei)
616  {
617  if (!phaseModels_[phasei].incompressible())
618  {
619  return false;
620  }
621  }
622 
623  return true;
624 }
625 
626 
628 {
629  forAll(phaseModels_, phasei)
630  {
631  phaseModels_[phasei].correct();
632  }
633 }
634 
635 
637 (
639 )
640 {
641  forAll(movingPhaseModels_, movingPhasei)
642  {
643  phaseModel& phase = movingPhaseModels_[movingPhasei];
644  const volScalarField& alpha = phase;
645  volScalarField& rho = phase.rho();
646 
647  volScalarField source
648  (
650  (
651  IOobject::groupName("source", phase.name()),
652  mesh_,
654  )
655  );
656 
657  if (fvModels().addsSupToField(rho.name()))
658  {
659  source += fvModels().source(alpha, rho)&rho;
660  }
661 
662  if (dmdts.set(phase.index()))
663  {
664  source.internalFieldRef() += dmdts[phase.index()];
665  }
666 
667  phase.correctContinuityError(source);
668  }
669 }
670 
671 
673 {
674  bool updateDpdt = false;
675 
676  forAll(phaseModels_, phasei)
677  {
678  phaseModels_[phasei].correctKinematics();
679 
680  // Update the pressure time-derivative if required
681  if (!updateDpdt && phaseModels_[phasei].thermo().dpdt())
682  {
683  dpdt_ = fvc::ddt(phaseModels_[phasei].fluidThermo().p());
684  updateDpdt = true;
685  }
686  }
687 }
688 
689 
691 {
692  forAll(phaseModels_, phasei)
693  {
694  phaseModels_[phasei].correctThermo();
695  }
696 }
697 
698 
700 {
701  forAll(phaseModels_, phasei)
702  {
703  phaseModels_[phasei].correctReactions();
704  }
705 }
706 
707 
709 {
710  forAll(phaseModels_, phasei)
711  {
712  phaseModels_[phasei].correctSpecies();
713  }
714 }
715 
716 
718 {
719  forAll(phaseModels_, phasei)
720  {
721  phaseModels_[phasei].predictMomentumTransport();
722  }
723 }
724 
725 
727 {
728  forAll(phaseModels_, phasei)
729  {
730  phaseModels_[phasei].predictThermophysicalTransport();
731  }
732 }
733 
734 
736 {
737  forAll(phaseModels_, phasei)
738  {
739  phaseModels_[phasei].correctMomentumTransport();
740  }
741 }
742 
743 
745 {
746  forAll(phaseModels_, phasei)
747  {
748  phaseModels_[phasei].correctThermophysicalTransport();
749  }
750 }
751 
752 
754 {
755  if (mesh_.changing())
756  {
757  // forAll(phaseModels_, phasei)
758  // {
759  // phaseModels_[phasei].meshUpdate();
760  // }
761  }
762 }
763 
764 
766 {
767  forAll(movingPhaseModels_, movingPhasei)
768  {
769  phaseModel& phase = movingPhaseModels_[movingPhasei];
770 
771  tmp<volVectorField> tU(phase.U());
772  const volVectorField::Boundary& UBf = tU().boundaryField();
773 
775  (
776  MRF_.relative(mesh_.Sf().boundaryField() & UBf)
777  );
778 
780 
781  forAll(mesh_.boundary(), patchi)
782  {
783  if
784  (
785  isA<fixedValueFvsPatchScalarField>(phiBf[patchi])
786  && !isA<movingWallVelocityFvPatchVectorField>(UBf[patchi])
787  && !isA<movingWallSlipVelocityFvPatchVectorField>(UBf[patchi])
788  )
789  {
790  phiBf[patchi] == phiRelBf[patchi];
791  }
792  }
793  }
794 }
795 
796 
798 (
799  const volScalarField& p_rgh,
800  const autoPtr<volScalarField>& divU,
803 )
804 {
805  // Update the phase fluxes from the phase face-velocity and make relative
806  forAll(movingPhaseModels_, movingPhasei)
807  {
808  phaseModel& phase = movingPhaseModels_[movingPhasei];
809  phase.phiRef() = mesh_.Sf() & phase.UfRef();
810  MRF_.makeRelative(phase.phiRef());
811  fvc::makeRelative(phase.phiRef(), phase.U());
812  }
813 
814  forAll(movingPhaseModels_, movingPhasei)
815  {
816  phaseModel& phase = movingPhaseModels_[movingPhasei];
817 
820 
821  forAll(Ubf, patchi)
822  {
823  if (Ubf[patchi].fixesValue())
824  {
825  Ubf[patchi].initEvaluate();
826  }
827  }
828 
829  forAll(Ubf, patchi)
830  {
831  if (Ubf[patchi].fixesValue())
832  {
833  Ubf[patchi].evaluate();
834  UfBf[patchi] = Ubf[patchi];
835  }
836  }
837  }
838 
839  // Correct fixed-flux BCs to be consistent with the velocity BCs
840  correctBoundaryFlux();
841 
842  phi_ = Zero;
843  PtrList<surfaceScalarField> alphafs(phaseModels_.size());
844  forAll(movingPhaseModels_, movingPhasei)
845  {
846  phaseModel& phase = movingPhaseModels_[movingPhasei];
847  const label phasei = phase.index();
848  const volScalarField& alpha = phase;
849 
850  alphafs.set(phasei, fvc::interpolate(alpha).ptr());
851 
852  // Calculate absolute flux
853  // from the mapped surface velocity
854  phi_ += alphafs[phasei]*(mesh_.Sf() & phase.UfRef());
855  }
856 
857  if (incompressible())
858  {
860  (
861  phi_,
862  movingPhaseModels_[0].U(),
863  p_rgh,
865  divU,
867  pimple
868  );
869  }
870  else
871  {
873  (
875  (
876  "psi",
877  mesh_,
879  )
880  );
881 
882  forAll(phases(), phasei)
883  {
884  phaseModel& phase = phases()[phasei];
885  const volScalarField& alpha = phase;
886 
887  psi += alpha*phase.fluidThermo().psi()/phase.rho();
888  }
889 
891  (
892  phi_,
893  p_rgh,
894  psi,
896  divU(),
897  pimple
898  );
899  }
900 
901  // Make the flux relative to the mesh motion
902  MRF_.makeRelative(phi_);
903  fvc::makeRelative(phi_, movingPhaseModels_[0].U());
904 
905  setMixturePhi(alphafs, phi_);
906 }
907 
908 
910 {
911  if (regIOobject::read())
912  {
913  bool readOK = true;
914 
915  forAll(phaseModels_, phasei)
916  {
917  readOK &= phaseModels_[phasei].read();
918  }
919 
920  cAlphas_ =
921  found("interfaceCompression")
922  ? generateInterfacialValues<scalar>
923  (
924  *this,
925  subDict("interfaceCompression")
926  )
927  : cAlphaTable();
928 
929  surfaceTensionCoefficientModels_ =
930  generateInterfacialModels<surfaceTensionCoefficientModel>
931  (
932  *this,
933  subDict(modelName<surfaceTensionCoefficientModel>())
934  );
935 
936  return readOK;
937  }
938  else
939  {
940  return false;
941  }
942 }
943 
944 
946 {
948  {
949  return fv::localEulerDdt::localRDeltaT(vf.mesh())*vf;
950  }
951  else
952  {
953  return vf/vf.mesh().time().deltaT();
954  }
955 }
956 
957 
959 {
961  {
963  }
964  else
965  {
966  return sf/sf.mesh().time().deltaT();
967  }
968 }
969 
970 
971 // ************************************************************************* //
bool found
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:449
const GeoMesh & mesh() const
Return mesh.
Generic field type.
Definition: FieldField.H:77
static autoPtr< Function1< Type > > New(const word &name, const Function1s::unitSets &units, const dictionary &dict)
Select from dictionary.
Definition: Function1New.C:32
Generic GeometricBoundaryField class.
void evaluate()
Evaluate boundary conditions.
Generic GeometricField class.
Internal & internalFieldRef()
Return a reference to the dimensioned internal field.
Boundary & boundaryFieldRef()
Return a 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,.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
fileName relativeObjectPath() const
Return complete relativePath + object name.
Definition: IOobject.H:420
writeOption & writeOpt() const
Definition: IOobject.H:367
const word & name() const
Return name.
Definition: IOobject.H:307
static word groupName(Name name, const word &group)
MRF zones DemandDrivenMeshObject read from MRFProperties dictionary.
Definition: MRFZones.H:76
Output to memory buffer stream.
Definition: OStringStream.H:52
string str() const
Return the string.
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
bool set(const label) const
Is element set.
Definition: PtrListI.H:62
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
bool set(const label) const
Is element set.
Definition: UPtrListI.H:87
label size() const
Return the number of elements in the UPtrList.
Definition: UPtrListI.H:29
void resize(const label)
Reset size of UPtrList. This can only be used to set the size.
Definition: UPtrListI.H:71
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
T lookupOrDefaultBackwardsCompatible(const wordList &, const T &) const
Find and return a T, trying a list of keywords in sequence,.
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:732
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
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
virtual const volScalarField & psi() const =0
Compressibility [s^2/m^2].
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const fvSchemes & schemes() const
Return the fvSchemes.
Definition: fvMesh.C:1792
tmp< fvMatrix< Type > > source(const VolField< Type > &field) const
Return source for an equation.
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:434
static const surfaceScalarField & localRDeltaTf(const fvMesh &mesh)
Return the reciprocal of the local face time-step.
Definition: localEulerDdt.C:58
static const volScalarField & localRDeltaT(const fvMesh &mesh)
Return the reciprocal of the local time-step.
Definition: localEulerDdt.C:46
static bool enabled(const fvMesh &mesh)
Return true if LTS is enabled.
Definition: localEulerDdt.C:37
Non-orthogonal solution control class. Provides non-orthogonal-loop control methods.
Word-pair based class used for keying interface models in hash tables.
Class to represent an interface between phases. Derivations can further specify the configuration of ...
virtual bool pure() const =0
Return whether the phase is pure (i.e., not multi-component)
virtual surfaceScalarField & phiRef()=0
Access the volumetric flux.
virtual bool stationary() const =0
Return whether the phase is stationary.
virtual const rhoFluidThermo & fluidThermo() const =0
Return the thermophysical model.
label index() const
Return the index of the phase.
Definition: phaseModel.C:104
virtual tmp< volVectorField > U() const =0
Return the velocity.
virtual bool isothermal() const =0
Return whether the phase is isothermal.
virtual volVectorField & URef()=0
Access the velocity.
const word & name() const
Return the name of this phase.
Definition: phaseModel.C:92
virtual const volScalarField & rho() const =0
Return the density field.
virtual void correctContinuityError(const volScalarField &source)
Correct the continuity error.
Definition: phaseModel.C:152
virtual surfaceVectorField & UfRef()=0
Access the face velocity.
Class to represent a system of phases.
Definition: phaseSystem.H:74
phaseModelPartialList stationaryPhaseModels_
Stationary phase models.
Definition: phaseSystem.H:175
void correctKinematics()
Correct the kinematics.
Definition: phaseSystem.C:672
tmp< volScalarField > nearInterface() const
Indicator of the proximity of the interface.
Definition: phaseSystem.C:549
void correctPhi(const volScalarField &p_rgh, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pimple)
...
Definition: phaseSystem.C:798
static const word propertiesName
Default name of the phase properties dictionary.
Definition: phaseSystem.H:252
void correctReactions()
Correct the reactions.
Definition: phaseSystem.C:699
const fvMesh & mesh_
Reference to the mesh.
Definition: phaseSystem.H:156
phaseModelPartialList multicomponentPhaseModels_
Multi-component phase models.
Definition: phaseSystem.H:181
phaseModelList phaseModels_
Phase models.
Definition: phaseSystem.H:169
phaseModelPartialList movingPhaseModels_
Moving phase models.
Definition: phaseSystem.H:172
void setMixtureU(const volVectorField &Um)
Re-normalise the velocity of the phases.
Definition: phaseSystem.C:83
void correctSpecies()
Correct the species mass fractions.
Definition: phaseSystem.C:708
tmp< surfaceScalarField > surfaceTension(const phaseModel &) const
Return the surface tension force.
Definition: phaseSystem.C:575
void correctThermo()
Correct the thermodynamics.
Definition: phaseSystem.C:690
void correct()
Correct the fluid properties other than those listed below.
Definition: phaseSystem.C:627
tmp< volScalarField > sigma(const phaseInterfaceKey &key) const
Return the surface tension coefficient for an interface.
Definition: phaseSystem.C:513
void correctContinuityError(const PtrList< volScalarField::Internal > &dmdts)
Correct the continuity errors.
Definition: phaseSystem.C:637
void predictThermophysicalTransport()
Predict the energy transport e.g. alphat.
Definition: phaseSystem.C:726
tmp< volScalarField > K(const phaseModel &alpha1, const phaseModel &alpha2) const
Curvature of interface between two phases.
Definition: phaseSystem.C:165
tmp< volVectorField > U() const
Return the mixture velocity.
Definition: phaseSystem.C:485
void correctMomentumTransport()
Correct the momentumTransport.
Definition: phaseSystem.C:735
void correctBoundaryFlux()
Correct fixed-flux BCs to be consistent with the velocity BCs.
Definition: phaseSystem.C:765
const phaseModelList & phases() const
Return the phase models.
Definition: phaseSystemI.H:104
void correctThermophysicalTransport()
Correct the energy transport e.g. alphat.
Definition: phaseSystem.C:744
phaseModelPartialList thermalPhaseModels_
Thermal phase models.
Definition: phaseSystem.H:178
void meshUpdate()
Update the fluid properties for mesh changes.
Definition: phaseSystem.C:753
surfaceScalarField phi_
Total volumetric flux.
Definition: phaseSystem.H:184
tmp< volScalarField > sumAlphaMoving() const
Return the sum of the phase fractions of the moving phases.
Definition: phaseSystem.C:57
phaseSystem(const fvMesh &mesh)
Construct from fvMesh.
Definition: phaseSystem.C:189
void setMixturePhi(const PtrList< surfaceScalarField > &alphafs, const surfaceScalarField &phim)
Re-normalise the flux of the phases.
Definition: phaseSystem.C:104
surfaceTensionCoefficientModelTable surfaceTensionCoefficientModels_
Surface tension models.
Definition: phaseSystem.H:197
virtual ~phaseSystem()
Destructor.
Definition: phaseSystem.C:415
tmp< surfaceScalarField > nHatf(const volScalarField &alpha1, const volScalarField &alpha2) const
Normal to interface between two phases dotted with face areas.
Definition: phaseSystem.C:154
tmp< volScalarField > rho() const
Return the mixture density.
Definition: phaseSystem.C:458
word referencePhaseName_
Name of optional reference phase which is not solved for.
Definition: phaseSystem.H:166
tmp< surfaceVectorField > nHatfv(const volScalarField &alpha1, const volScalarField &alpha2) const
Normal to interface between two phases.
Definition: phaseSystem.C:128
void predictMomentumTransport()
Predict the momentumTransport.
Definition: phaseSystem.C:717
virtual bool read()
Read base phaseProperties dictionary.
Definition: phaseSystem.C:909
bool incompressible() const
Return incompressibility.
Definition: phaseSystem.C:613
Pimple no-loop control class. Implements various option flags, but leaves loop controls to the deriva...
Provides controls for the pressure reference in closed-volume simulations.
Enables the printing of a dictionary and subsequently looked-up defaulted entries.
virtual bool read()
Read object.
static const dimensionSet dimSigma
Coefficient dimensions.
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
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
scalar CoNum
Foam::fvModels & fvModels(Foam::fvModels::New(mesh))
pimpleControl pimple(mesh)
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
Flux correction functions to ensure continuity.
Calculate the first temporal derivative.
Calculate the divergence of the given field.
Calculate the gradient of the given field.
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Calculate the snGrad of the given volField.
label patchi
volScalarField sf(fieldObject, mesh)
const volScalarField & psi
K
Definition: pEqn.H:75
U
Definition: pEqn.H:72
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.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m^2/K^4].
const dimensionSet time
void correctPhi(surfaceScalarField &phi, const volVectorField &U, const volScalarField &p, const autoPtr< volScalarField > &rAU, const autoPtr< volScalarField > &divU, const pressureReference &pressureReference, nonOrthogonalSolutionControl &pcorrControl)
Definition: fvCorrectPhi.C:32
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 > > ddt(const dimensioned< Type > dt, const fvMesh &mesh)
Definition: fvcDdt.C:45
tmp< VolField< typename outerProduct< vector, Type >::type > > grad(const SurfaceField< Type > &ssf)
Definition: fvcGrad.C:46
tmp< VolField< Type > > div(const SurfaceField< Type > &ssf)
Definition: fvcDiv.C:47
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:89
tmp< SurfaceField< Type > > snGrad(const VolField< Type > &vf, const word &name)
Definition: fvcSnGrad.C:45
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
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 doubleScalar e
Definition: doubleScalar.H:106
const dimensionSet & dimless
Definition: dimensions.C:138
dimensionedScalar pos0(const dimensionedScalar &ds)
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
SurfaceField< scalar > surfaceScalarField
tmp< volScalarField > byDt(const volScalarField &vf)
Definition: phaseSystem.C:945
messageStream Info
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void correctContactAngle(const volScalarField &alpha1, const volScalarField &alpha2, const volVectorField::Boundary &Ubf, const dimensionedScalar &deltaN, surfaceVectorField::Boundary &nHatbf)
Correct the contact angle for the two volume fraction fields.
Foam::HashTable< ValueType, Foam::phaseInterfaceKey, Foam::phaseInterfaceKey::hash > generateInterfacialValues(const phaseSystem &fluid, const dictionary &dict, const wordHashSet &ignoreKeys=wordHashSet())
const dimensionSet & dimTime
Definition: dimensions.C:142
const dimensionSet & dimDensity
Definition: dimensions.C:158
const dimensionSet & dimPressure
Definition: dimensions.C:163
IOerror FatalIOError
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
tmp< DimensionedField< typename powProduct< Type, r >::type, GeoMesh, Field > > pow(const DimensionedField< Type, GeoMesh, PrimitiveField > &df, typename powProduct< Type, r >::type)
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
tmp< DimensionedField< scalar, GeoMesh, Field > > mag(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet & dimVolumetricFlux
Definition: dimensions.C:178
dictionary dict
volScalarField & p
fluidMulticomponentThermo & thermo
Definition: createFields.H:15
void correct(const scalar CoNum)
Correct nAlphaSubCycles for the current Courant number.
Definition: phaseSystem.C:452
void read(const dictionary &dict)
Read the alpha and MULES controls from dict.
Definition: phaseSystem.C:421