kinematicSingleLayer.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 | Copyright (C) 2011-2016 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 "kinematicSingleLayer.H"
27 #include "fvm.H"
28 #include "fvcDiv.H"
29 #include "fvcLaplacian.H"
30 #include "fvcSnGrad.H"
31 #include "fvcReconstruct.H"
32 #include "fvcVolumeIntegrate.H"
33 #include "fvcFlux.H"
35 #include "mappedWallPolyPatch.H"
36 #include "mapDistribute.H"
37 #include "filmThermoModel.H"
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 namespace regionModels
44 {
45 namespace surfaceFilmModels
46 {
47 
48 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
49 
50 defineTypeNameAndDebug(kinematicSingleLayer, 0);
51 
52 addToRunTimeSelectionTable(surfaceFilmModel, kinematicSingleLayer, mesh);
53 
54 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
55 
57 {
59  {
60  const dictionary& solution = this->solution().subDict("PISO");
61  solution.lookup("momentumPredictor") >> momentumPredictor_;
62  solution.readIfPresent("nOuterCorr", nOuterCorr_);
63  solution.lookup("nCorr") >> nCorr_;
64  solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
65 
66  return true;
67  }
68  else
69  {
70  return false;
71  }
72 }
73 
74 
76 {
77  rho_ == filmThermo_->rho();
78  mu_ == filmThermo_->mu();
79  sigma_ == filmThermo_->sigma();
80 }
81 
82 
84 {
85  if (debug)
86  {
88  }
89 
92  pSpPrimary_ == dimensionedScalar("zero", pSp_.dimensions(), 0.0);
93 }
94 
95 
97 {
98  if (debug)
99  {
100  InfoInFunction << endl;
101  }
102 
103  // Update fields from primary region via direct mapped
104  // (coupled) boundary conditions
109 }
110 
111 
113 {
114  if (debug)
115  {
116  InfoInFunction << endl;
117  }
118 
119  volScalarField::Boundary& rhoSpPrimaryBf =
121 
122  volVectorField::Boundary& USpPrimaryBf =
124 
125  volScalarField::Boundary& pSpPrimaryBf =
127 
128  // Convert accummulated source terms into per unit area per unit time
129  const scalar deltaT = time_.deltaTValue();
131  {
132  scalarField rpriMagSfdeltaT
133  (
134  (1.0/deltaT)
135  /primaryMesh().magSf().boundaryField()[patchi]
136  );
137 
138  rhoSpPrimaryBf[patchi] *= rpriMagSfdeltaT;
139  USpPrimaryBf[patchi] *= rpriMagSfdeltaT;
140  pSpPrimaryBf[patchi] *= rpriMagSfdeltaT;
141  }
142 
143  // Retrieve the source fields from the primary region via direct mapped
144  // (coupled) boundary conditions
145  // - fields require transfer of values for both patch AND to push the
146  // values into the first layer of internal cells
150 
151  // update addedMassTotal counter
152  if (time().writeTime())
153  {
154  scalar addedMassTotal = 0.0;
155  outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
156  addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
157  outputProperties().add("addedMassTotal", addedMassTotal, true);
158  addedMassTotal_ = 0.0;
159  }
160 }
161 
162 
164 {
165  return tmp<volScalarField>
166  (
167  new volScalarField
168  (
169  IOobject
170  (
171  typeName + ":pu",
172  time_.timeName(),
173  regionMesh(),
176  ),
177  pPrimary_ // pressure (mapped from primary region)
178  - pSp_ // accumulated particle impingement
179  - fvc::laplacian(sigma_, delta_) // surface tension
180  )
181  );
182 }
183 
184 
186 {
187  return tmp<volScalarField>
188  (
189  new volScalarField
190  (
191  IOobject
192  (
193  typeName + ":pp",
194  time_.timeName(),
195  regionMesh(),
198  ),
199  -rho_*gNormClipped() // hydrostatic effect only
200  )
201  );
202 }
203 
204 
206 {
208 }
209 
210 
212 {
213  if (debug)
214  {
215  InfoInFunction << endl;
216  }
217 
218  // Update injection model - mass returned is mass available for injection
220 
221  // Update source fields
222  const dimensionedScalar deltaT = time().deltaT();
223  rhoSp_ += cloudMassTrans_/magSf()/deltaT;
224 
225  turbulence_->correct();
226 }
227 
228 
230 {
231  const volScalarField deltaRho0(deltaRho_);
232 
233  solveContinuity();
234 
235  if (debug)
236  {
240  + dimensionedScalar("SMALL", dimMass*dimVolume, ROOTVSMALL);
241 
242  const scalar sumLocalContErr =
243  (
244  fvc::domainIntegrate(mag(mass - magSf()*deltaRho0))/totalMass
245  ).value();
246 
247  const scalar globalContErr =
248  (
249  fvc::domainIntegrate(mass - magSf()*deltaRho0)/totalMass
250  ).value();
251 
253 
255  << "Surface film: " << type() << nl
256  << " time step continuity errors: sum local = "
257  << sumLocalContErr << ", global = " << globalContErr
258  << ", cumulative = " << cumulativeContErr_ << endl;
259  }
260 }
261 
262 
264 {
265  if (debug)
266  {
267  InfoInFunction << endl;
268  }
269 
270  solve
271  (
273  + fvc::div(phi_)
274  ==
275  - rhoSp_
276  );
277 }
278 
279 
281 {
282  // Push boundary film velocity values into internal field
283  for (label i=0; i<intCoupledPatchIDs_.size(); i++)
284  {
286  const polyPatch& pp = regionMesh().boundaryMesh()[patchi];
289  }
290  Uw_ -= nHat()*(Uw_ & nHat());
292 
293  Us_ = turbulence_->Us();
294 }
295 
296 
298 (
299  const volScalarField& pu,
300  const volScalarField& pp
301 )
302 {
303  if (debug)
304  {
305  InfoInFunction << endl;
306  }
307 
308  // Momentum
310  (
312  + fvm::div(phi_, U_)
313  ==
314  - USp_
315  // - fvm::SuSp(rhoSp_, U_)
316  - rhoSp_*U_
317  + forces_.correct(U_)
318  + turbulence_->Su(U_)
319  );
320 
321  fvVectorMatrix& UEqn = tUEqn.ref();
322 
323  UEqn.relax();
324 
325  if (momentumPredictor_)
326  {
327  solve
328  (
329  UEqn
330  ==
332  (
334  * (
335  regionMesh().magSf()
336  * (
337  fvc::snGrad(pu, "snGrad(p)")
338  + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_)
340  )
341  - fvc::flux(rho_*gTan())
342  )
343  )
344  );
345 
346  // Remove any patch-normal components of velocity
347  U_ -= nHat()*(nHat() & U_);
349  }
350 
351  return tUEqn;
352 }
353 
354 
356 (
357  const volScalarField& pu,
358  const volScalarField& pp,
359  const fvVectorMatrix& UEqn
360 )
361 {
362  if (debug)
363  {
364  InfoInFunction << endl;
365  }
366 
367  volScalarField rUA(1.0/UEqn.A());
368  U_ = rUA*UEqn.H();
369 
372 
373  surfaceScalarField phiAdd
374  (
375  "phiAdd",
376  regionMesh().magSf()
377  * (
378  fvc::snGrad(pu, "snGrad(p)")
379  + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_)
380  )
381  - fvc::flux(rho_*gTan())
382  );
383  constrainFilmField(phiAdd, 0.0);
384 
386  (
387  "phid",
388  fvc::flux(U_*rho_) - deltarUAf*phiAdd*rhof
389  );
390  constrainFilmField(phid, 0.0);
391 
392  surfaceScalarField ddrhorUAppf
393  (
394  "deltaCoeff",
395  fvc::interpolate(delta_)*deltarUAf*rhof*fvc::interpolate(pp)
396  );
397 
399 
400  for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
401  {
402  // Film thickness equation
403  fvScalarMatrix deltaEqn
404  (
405  fvm::ddt(rho_, delta_)
406  + fvm::div(phid, delta_)
407  - fvm::laplacian(ddrhorUAppf, delta_)
408  ==
409  - rhoSp_
410  );
411 
412  deltaEqn.solve();
413 
414  if (nonOrth == nNonOrthCorr_)
415  {
416  phiAdd +=
417  fvc::interpolate(pp)
419  * regionMesh().magSf();
420 
421  phi_ == deltaEqn.flux();
422  }
423  }
424 
425  // Bound film thickness by a minimum of zero
426  delta_.max(0.0);
427 
428  // Update U field
429  U_ -= fvc::reconstruct(deltarUAf*phiAdd);
430 
431  // Remove any patch-normal components of velocity
432  U_ -= nHat()*(nHat() & U_);
433 
435 
436  // Continuity check
437  continuityCheck();
438 }
439 
440 
441 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
442 
443 kinematicSingleLayer::kinematicSingleLayer
444 (
445  const word& modelType,
446  const fvMesh& mesh,
447  const dimensionedVector& g,
448  const word& regionType,
449  const bool readFields
450 )
451 :
452  surfaceFilmModel(modelType, mesh, g, regionType),
453 
454  momentumPredictor_(solution().subDict("PISO").lookup("momentumPredictor")),
455  nOuterCorr_(solution().subDict("PISO").lookupOrDefault("nOuterCorr", 1)),
456  nCorr_(readLabel(solution().subDict("PISO").lookup("nCorr"))),
458  (
459  readLabel(solution().subDict("PISO").lookup("nNonOrthCorr"))
460  ),
461 
462  cumulativeContErr_(0.0),
463 
464  deltaSmall_("deltaSmall", dimLength, SMALL),
465  deltaCoLimit_(solution().lookupOrDefault("deltaCoLimit", 1e-4)),
466 
467  rho_
468  (
469  IOobject
470  (
471  "rhof",
472  time().timeName(),
473  regionMesh(),
476  ),
477  regionMesh(),
478  dimensionedScalar("zero", dimDensity, 0.0),
479  zeroGradientFvPatchScalarField::typeName
480  ),
481  mu_
482  (
483  IOobject
484  (
485  "muf",
486  time().timeName(),
487  regionMesh(),
490  ),
491  regionMesh(),
492  dimensionedScalar("zero", dimPressure*dimTime, 0.0),
493  zeroGradientFvPatchScalarField::typeName
494  ),
495  sigma_
496  (
497  IOobject
498  (
499  "sigmaf",
500  time().timeName(),
501  regionMesh(),
504  ),
505  regionMesh(),
506  dimensionedScalar("zero", dimMass/sqr(dimTime), 0.0),
507  zeroGradientFvPatchScalarField::typeName
508  ),
509 
510  delta_
511  (
512  IOobject
513  (
514  "deltaf",
515  time().timeName(),
516  regionMesh(),
519  ),
520  regionMesh()
521  ),
522  alpha_
523  (
524  IOobject
525  (
526  "alpha",
527  time().timeName(),
528  regionMesh(),
531  ),
532  regionMesh(),
533  dimensionedScalar("zero", dimless, 0.0),
534  zeroGradientFvPatchScalarField::typeName
535  ),
536  U_
537  (
538  IOobject
539  (
540  "Uf",
541  time().timeName(),
542  regionMesh(),
545  ),
546  regionMesh()
547  ),
548  Us_
549  (
550  IOobject
551  (
552  "Usf",
553  time().timeName(),
554  regionMesh(),
557  ),
558  U_,
559  zeroGradientFvPatchScalarField::typeName
560  ),
561  Uw_
562  (
563  IOobject
564  (
565  "Uwf",
566  time().timeName(),
567  regionMesh(),
570  ),
571  U_,
572  zeroGradientFvPatchScalarField::typeName
573  ),
574  deltaRho_
575  (
576  IOobject
577  (
578  delta_.name() + "*" + rho_.name(),
579  time().timeName(),
580  regionMesh(),
583  ),
584  regionMesh(),
586  zeroGradientFvPatchScalarField::typeName
587  ),
588 
589  phi_
590  (
591  IOobject
592  (
593  "phi",
594  time().timeName(),
595  regionMesh(),
598  ),
599  regionMesh(),
600  dimensionedScalar("0", dimLength*dimMass/dimTime, 0.0)
601  ),
602 
604  (
605  IOobject
606  (
607  "primaryMassTrans",
608  time().timeName(),
609  regionMesh(),
612  ),
613  regionMesh(),
614  dimensionedScalar("zero", dimMass, 0.0),
615  zeroGradientFvPatchScalarField::typeName
616  ),
618  (
619  IOobject
620  (
621  "cloudMassTrans",
622  time().timeName(),
623  regionMesh(),
626  ),
627  regionMesh(),
628  dimensionedScalar("zero", dimMass, 0.0),
629  zeroGradientFvPatchScalarField::typeName
630  ),
632  (
633  IOobject
634  (
635  "cloudDiameterTrans",
636  time().timeName(),
637  regionMesh(),
640  ),
641  regionMesh(),
642  dimensionedScalar("zero", dimLength, -1.0),
643  zeroGradientFvPatchScalarField::typeName
644  ),
645 
646  USp_
647  (
648  IOobject
649  (
650  "USpf",
651  time().timeName(),
652  regionMesh(),
655  ),
656  regionMesh(),
658  (
659  "zero", dimMass*dimVelocity/dimArea/dimTime, Zero
660  ),
661  this->mappedPushedFieldPatchTypes<vector>()
662  ),
663  pSp_
664  (
665  IOobject
666  (
667  "pSpf",
668  time_.timeName(),
669  regionMesh(),
672  ),
673  regionMesh(),
674  dimensionedScalar("zero", dimPressure, 0.0),
675  this->mappedPushedFieldPatchTypes<scalar>()
676  ),
677  rhoSp_
678  (
679  IOobject
680  (
681  "rhoSpf",
682  time_.timeName(),
683  regionMesh(),
686  ),
687  regionMesh(),
688  dimensionedScalar("zero", dimMass/dimTime/dimArea, 0.0),
689  this->mappedPushedFieldPatchTypes<scalar>()
690  ),
691 
693  (
694  IOobject
695  (
696  USp_.name(), // must have same name as USp_ to enable mapping
697  time().timeName(),
698  primaryMesh(),
701  ),
702  primaryMesh(),
704  ),
706  (
707  IOobject
708  (
709  pSp_.name(), // must have same name as pSp_ to enable mapping
710  time().timeName(),
711  primaryMesh(),
714  ),
715  primaryMesh(),
716  dimensionedScalar("zero", pSp_.dimensions(), 0.0)
717  ),
719  (
720  IOobject
721  (
722  rhoSp_.name(), // must have same name as rhoSp_ to enable mapping
723  time().timeName(),
724  primaryMesh(),
727  ),
728  primaryMesh(),
729  dimensionedScalar("zero", rhoSp_.dimensions(), 0.0)
730  ),
731 
732  UPrimary_
733  (
734  IOobject
735  (
736  "U", // must have same name as U to enable mapping
737  time().timeName(),
738  regionMesh(),
741  ),
742  regionMesh(),
744  this->mappedFieldAndInternalPatchTypes<vector>()
745  ),
746  pPrimary_
747  (
748  IOobject
749  (
750  "p", // must have same name as p to enable mapping
751  time().timeName(),
752  regionMesh(),
755  ),
756  regionMesh(),
757  dimensionedScalar("zero", dimPressure, 0.0),
758  this->mappedFieldAndInternalPatchTypes<scalar>()
759  ),
761  (
762  IOobject
763  (
764  "rho", // must have same name as rho to enable mapping
765  time().timeName(),
766  regionMesh(),
769  ),
770  regionMesh(),
771  dimensionedScalar("zero", dimDensity, 0.0),
772  this->mappedFieldAndInternalPatchTypes<scalar>()
773  ),
774  muPrimary_
775  (
776  IOobject
777  (
778  "thermo:mu", // must have same name as mu to enable mapping
779  time().timeName(),
780  regionMesh(),
783  ),
784  regionMesh(),
785  dimensionedScalar("zero", dimPressure*dimTime, 0.0),
786  this->mappedFieldAndInternalPatchTypes<scalar>()
787  ),
788 
790 
791  availableMass_(regionMesh().nCells(), 0.0),
792 
793  injection_(*this, coeffs_),
794 
796 
797  forces_(*this, coeffs_),
798 
799  addedMassTotal_(0.0)
800 {
801  if (readFields)
802  {
804 
805  correctAlpha();
806 
808 
809  deltaRho_ == delta_*rho_;
810 
812  (
813  IOobject
814  (
815  "phi",
816  time().timeName(),
817  regionMesh(),
820  false
821  ),
823  );
824 
825  phi_ == phi0;
826  }
827 }
828 
829 
830 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
831 
833 {}
834 
835 
836 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
837 
839 (
840  const label patchi,
841  const label facei,
842  const scalar massSource,
843  const vector& momentumSource,
844  const scalar pressureSource,
845  const scalar energySource
846 )
847 {
848  if (debug)
849  {
851  << "\nSurface film: " << type() << ": adding to film source:" << nl
852  << " mass = " << massSource << nl
853  << " momentum = " << momentumSource << nl
854  << " pressure = " << pressureSource << endl;
855  }
856 
857  rhoSpPrimary_.boundaryFieldRef()[patchi][facei] -= massSource;
858  USpPrimary_.boundaryFieldRef()[patchi][facei] -= momentumSource;
859  pSpPrimary_.boundaryFieldRef()[patchi][facei] -= pressureSource;
860 
861  addedMassTotal_ += massSource;
862 }
863 
864 
866 {
867  if (debug)
868  {
869  InfoInFunction << endl;
870  }
871 
873 
875 
877 
879 
880  // Reset transfer fields
881  //availableMass_ = mass();
883  cloudMassTrans_ == dimensionedScalar("zero", dimMass, 0.0);
885 }
886 
887 
889 {
890  if (debug)
891  {
892  InfoInFunction << endl;
893  }
894 
895  // Update film coverage indicator
896  correctAlpha();
897 
898  // Update film wall and surface velocities
900 
901  // Update sub-models to provide updated source contributions
902  updateSubmodels();
903 
904  // Solve continuity for deltaRho_
905  solveContinuity();
906 
907  // Implicit pressure source coefficient - constant
908  tmp<volScalarField> tpp(this->pp());
909 
910  for (int oCorr=1; oCorr<=nOuterCorr_; oCorr++)
911  {
912  // Explicit pressure source contribution - varies with delta_
913  tmp<volScalarField> tpu(this->pu());
914 
915  // Solve for momentum for U_
916  tmp<fvVectorMatrix> UEqn = solveMomentum(tpu(), tpp());
917 
918  // Film thickness correction loop
919  for (int corr=1; corr<=nCorr_; corr++)
920  {
921  // Solve thickness for delta_
922  solveThickness(tpu(), tpp(), UEqn());
923  }
924  }
925 
926  // Update deltaRho_ with new delta_
927  deltaRho_ == delta_*rho_;
928 
929  // Reset source terms for next time integration
931 }
932 
933 
935 {
936  scalar CoNum = 0.0;
937 
938  if (regionMesh().nInternalFaces() > 0)
939  {
940  const scalarField sumPhi
941  (
942  fvc::surfaceSum(mag(phi_))().primitiveField()
943  / (deltaRho_.primitiveField() + ROOTVSMALL)
944  );
945 
946  forAll(delta_, i)
947  {
948  if (delta_[i] > deltaCoLimit_)
949  {
950  CoNum = max(CoNum, sumPhi[i]/(delta_[i]*magSf()[i]));
951  }
952  }
953 
954  CoNum *= 0.5*time_.deltaTValue();
955  }
956 
957  reduce(CoNum, maxOp<scalar>());
958 
959  Info<< "Film max Courant number: " << CoNum << endl;
960 
961  return CoNum;
962 }
963 
964 
966 {
967  return U_;
968 }
969 
970 
972 {
973  return Us_;
974 }
975 
976 
978 {
979  return Uw_;
980 }
981 
982 
984 {
985  return deltaRho_;
986 }
987 
988 
990 {
991  return phi_;
992 }
993 
994 
996 {
997  return rho_;
998 }
999 
1000 
1002 {
1004  << "T field not available for " << type() << abort(FatalError);
1005 
1006  return volScalarField::null();
1007 }
1008 
1009 
1011 {
1013  << "Ts field not available for " << type() << abort(FatalError);
1014 
1015  return volScalarField::null();
1016 }
1017 
1018 
1020 {
1022  << "Tw field not available for " << type() << abort(FatalError);
1023 
1024  return volScalarField::null();
1025 }
1026 
1027 
1029 {
1031  << "Cp field not available for " << type() << abort(FatalError);
1032 
1033  return volScalarField::null();
1034 }
1035 
1036 
1038 {
1040  << "kappa field not available for " << type() << abort(FatalError);
1041 
1042  return volScalarField::null();
1043 }
1044 
1045 
1047 {
1048  return tmp<volScalarField>
1049  (
1050  new volScalarField
1051  (
1052  IOobject
1053  (
1054  typeName + ":primaryMassTrans",
1055  time().timeName(),
1056  primaryMesh(),
1059  false
1060  ),
1061  primaryMesh(),
1062  dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
1063  )
1064  );
1065 }
1066 
1067 
1069 {
1070  return cloudMassTrans_;
1071 }
1072 
1073 
1075 {
1076  return cloudDiameterTrans_;
1077 }
1078 
1079 
1081 {
1082  Info<< "\nSurface film: " << type() << endl;
1083 
1084  const scalarField& deltaInternal = delta_;
1085  const vectorField& Uinternal = U_;
1086  scalar addedMassTotal = 0.0;
1087  outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
1088  addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
1089 
1090  Info<< indent << "added mass = " << addedMassTotal << nl
1091  << indent << "current mass = "
1092  << gSum((deltaRho_*magSf())()) << nl
1093  << indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", "
1094  << gMax(mag(Uinternal)) << nl
1095  << indent << "min/max(delta) = " << gMin(deltaInternal) << ", "
1096  << gMax(deltaInternal) << nl
1097  << indent << "coverage = "
1098  << gSum(alpha_.primitiveField()*magSf())/gSum(magSf()) << nl;
1099 
1100  injection_.info(Info);
1101 }
1102 
1103 
1105 {
1107  (
1109  (
1110  IOobject
1111  (
1112  typeName + ":Srho",
1113  time().timeName(),
1114  primaryMesh(),
1117  false
1118  ),
1119  primaryMesh(),
1120  dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
1121  )
1122  );
1123 }
1124 
1125 
1128  const label i
1129 ) const
1130 {
1132  (
1134  (
1135  IOobject
1136  (
1137  typeName + ":Srho(" + Foam::name(i) + ")",
1138  time().timeName(),
1139  primaryMesh(),
1142  false
1143  ),
1144  primaryMesh(),
1145  dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
1146  )
1147  );
1148 }
1149 
1150 
1152 {
1154  (
1156  (
1157  IOobject
1158  (
1159  typeName + ":Sh",
1160  time().timeName(),
1161  primaryMesh(),
1164  false
1165  ),
1166  primaryMesh(),
1167  dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
1168  )
1169  );
1170 }
1171 
1172 
1173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
1174 
1175 } // End namespace surfaceFilmModels
1176 } // End namespace regionModels
1177 } // End namespace Foam
1178 
1179 // ************************************************************************* //
virtual bool read()
Read control parameters from dictionary.
virtual tmp< DimensionedField< scalar, volMesh > > Srho() const
Return total mass source - Eulerian phase only.
autoPtr< filmThermoModel > filmThermo_
Film thermo model.
virtual const volScalarField & magSf() const
Return the face area magnitudes / [m2].
const dictionary & solution() const
Return the solution dictionary.
Definition: regionModelI.H:103
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
autoPtr< filmTurbulenceModel > turbulence_
Turbulence model.
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
virtual tmp< DimensionedField< scalar, volMesh > > Sh() const
Return enthalpy source - Eulerian phase only.
virtual void correct(scalarField &availableMass, volScalarField &massToInject, volScalarField &diameterToInject)
Correct.
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:223
const Time & time() const
Return the reference to the time database.
Definition: regionModelI.H:37
static autoPtr< filmTurbulenceModel > New(surfaceFilmModel &owner, const dictionary &dict)
Return a reference to the selected injection model.
volScalarField primaryMassTrans_
Film mass available for transfer to the primary region.
const double e
Elementary charge.
Definition: doubleFloat.H:78
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
Type gMin(const FieldField< Field, Type > &f)
void setFluxRequired(const word &name) const
Definition: fvSchemes.C:497
surfaceScalarField rhof(fvc::interpolate(rho,"div(phi,rho)"))
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
Reconstruct volField from a face flux field.
IOobject(const word &name, const fileName &instance, const objectRegistry &registry, readOption r=NO_READ, writeOption w=NO_WRITE, bool registerObject=true)
Construct from name, instance, registry, io options.
Definition: IOobject.C:114
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:633
virtual void transferPrimaryRegionThermoFields()
Transfer thermo fields from the primary region to the film region.
virtual const volScalarField & cloudDiameterTrans() const
Return the parcel diameters originating from film to cloud.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
Definition: fvMatrix.C:864
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
tmp< volVectorField > gTan() const
Return the gravity tangential component contributions.
scalar globalContErr
virtual const volVectorField & U() const
Return the film velocity [m/s].
const dimensionedScalar phi0
Magnetic flux quantum: default SI units: [Wb].
tmp< fvVectorMatrix > tUEqn(fvm::ddt(rho, U)+fvm::div(phi, U)+MRF.DDt(rho, U)+turbulence->divDevRhoReff(U)==fvOptions(rho, U))
const Internal::FieldType & primitiveField() const
Return a const-reference to the internal field.
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
virtual const volVectorField & Uw() const
Return the film wall velocity [m/s].
Calculate the snGrad of the given volField.
scalarField availableMass_
Available mass for transfer via sub-models.
virtual const volScalarField & rho() const
Return the film density [kg/m3].
volScalarField cloudDiameterTrans_
Parcel diameters originating from film to cloud.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
Definition: Time.C:715
scalar addedMassTotal_
Cumulative mass added via sources [kg].
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
virtual void info(Ostream &os)
Provide some info.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:421
virtual void solveThickness(const volScalarField &pu, const volScalarField &pp, const fvVectorMatrix &UEqn)
Solve coupled velocity-thickness equations.
virtual void evolveRegion()
Evolve the film equations.
Macros for easy insertion into run-time selection tables.
virtual void solveContinuity()
Solve continuity equation.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:737
virtual tmp< volScalarField > pp()
Implicit pressure source coefficient.
tmp< fvVectorMatrix > correct(volVectorField &U)
Return (net) force system.
Definition: forceList.C:78
const fvMesh & regionMesh() const
Return the region mesh database.
Definition: regionModelI.H:61
volScalarField deltaRho_
Film thickness*density (helper field) / [kg/m2].
tmp< volScalarField > gNormClipped() const
Return the gravity normal-to-patch component contribution.
virtual const volScalarField & Cp() const
Return the film specific heat capacity [J/kg/K].
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
virtual void transferPrimaryRegionSourceFields()
Transfer source fields from the primary region to the film region.
virtual const volScalarField & Ts() const
Return the film surface temperature [K].
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionSet dimVolume(pow3(dimLength))
Definition: dimensionSets.H:58
addToRunTimeSelectionTable(surfaceFilmModel, kinematicSingleLayer, mesh)
Type gSum(const FieldField< Field, Type > &f)
virtual tmp< fvVectorMatrix > solveMomentum(const volScalarField &pu, const volScalarField &pp)
Solve for film velocity.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
virtual void preEvolveRegion()
Pre-evolve region.
Definition: regionModel.C:543
A class for handling words, derived from string.
Definition: word.H:59
SolverPerformance< Type > solve(fvMatrix< Type > &, const dictionary &)
Solve returning the solution statistics given convergence tolerance.
bool readIfPresent(const word &, T &, bool recursive=false, bool patternMatch=true) const
Find an entry if present, and assign to T.
Calculate the face-flux of the given field.
Calculate the laplacian of the given field.
scalar CoNum
virtual const volScalarField & T() const
Return the film mean temperature [K].
tmp< fvMatrix< Type > > ddt(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvmDdt.C:46
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
virtual const volScalarField & Tw() const
Return the film wall temperature [K].
Volume integrate volField creating a volField.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
Definition: fvPatchField.H:71
tmp< volScalarField > A() const
Return the central coefficient.
Definition: fvMatrix.C:725
word timeName
Definition: getTimeIndex.H:3
static const zero Zero
Definition: zero.H:91
const IOdictionary & outputProperties() const
Return const access to the output properties dictionary.
Definition: regionModelI.H:110
const dimensionSet dimPressure
label nNonOrthCorr_
Number of non-orthogonal correctors.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
surfaceScalarField phid("phid", fvc::interpolate(psi)*(fvc::flux(HbyA)+rhorAUf *fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)))
label readLabel(Istream &is)
Definition: label.H:64
virtual scalar CourantNumber() const
Courant number evaluation.
const dimensionSet & dimensions() const
Return dimensions.
virtual tmp< volScalarField > pu()
Explicit pressure source contribution.
virtual bool read()
Read control parameters from dictionary.
virtual const volVectorField & Us() const
Return the film surface velocity [m/s].
Calculate the divergence of the given field.
dimensionedScalar totalMass
Definition: continuityErrs.H:4
virtual tmp< volScalarField > primaryMassTrans() const
Return mass transfer source - Eulerian phase only.
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Definition: fvMatrixSolve.C:57
static const char nl
Definition: Ostream.H:262
tmp< fvMatrix< Type > > div(const surfaceScalarField &flux, const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmDiv.C:46
Type gMax(const FieldField< Field, Type > &f)
virtual const volScalarField & deltaRho() const
Return the film thickness*density (helper field) [kg/m3].
virtual const volVectorField & nHat() const
Return the patch normal vectors.
virtual void correctAlpha()
Correct film coverage field.
virtual void resetPrimaryRegionSourceTerms()
Reset source term fields.
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:41
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
const dimensionSet dimEnergy
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.
const dimensionSet dimDensity
dictionary coeffs_
Model coefficients dictionary.
Definition: regionModel.H:105
static const GeometricField< scalar, fvPatchField, volMesh > & null()
Return a null geometric field.
virtual void updateSubmodels()
Update the film sub-models.
virtual const volScalarField & cloudMassTrans() const
Return the film mass available for transfer to cloud.
tmp< volScalarField > netMass() const
Return the net film mass available over the next integration.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
label patchi
tmp< volScalarField > mass() const
Return the current film mass.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:53
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:50
const labelUList & faceCells() const
Return face-cell addressing.
Definition: polyPatch.C:315
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvmLaplacian.C:46
const Time & time_
Reference to the time database.
Definition: regionModel.H:90
void max(const dimensioned< Type > &)
surfaceScalarField phi_
Mass flux (includes film thickness) / [kg.m/s].
fvVectorMatrix & UEqn
Definition: UEqn.H:13
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
volScalarField alpha_
Film coverage indicator, 1 = covered, 0 = uncovered / [].
A List with indirect addressing.
Definition: fvMatrix.H:106
virtual void updateSurfaceVelocities()
Update film surface velocities.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
void correctBoundaryConditions()
Correct boundary field.
messageStream Info
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual const surfaceScalarField & phi() const
Return the film flux [kg.m/s].
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
tmp< GeometricField< Type, fvPatchField, volMesh > > H() const
Return the H operation source.
Definition: fvMatrix.C:754
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
virtual void addSources(const label patchi, const label facei, const scalar massSource, const vector &momentumSource, const scalar pressureSource, const scalar energySource=0)
External hook to add sources to the film.
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:48
volScalarField cloudMassTrans_
Film mass available for transfer to cloud.
void constrainFilmField(Type &field, const typename Type::cmptType &value)
Constrain a film region master/slave boundaries of a field to a.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
labelList intCoupledPatchIDs_
List of patch IDs internally coupled with the primary region.
Definition: regionModel.H:117
A class for managing temporary objects.
Definition: PtrList.H:54
tmp< surfaceScalarField > flux(const volVectorField &vvf)
Return the face-flux field obtained from the given volVectorField.
Definition: fvcFlux.C:32
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
const fvMesh & primaryMesh() const
Return the reference to the primary mesh database.
Definition: regionModelI.H:31
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
defineTypeNameAndDebug(kinematicSingleLayer, 0)
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
static autoPtr< filmThermoModel > New(surfaceFilmModel &owner, const dictionary &dict)
Return a reference to the selected phase change model.
scalar deltaCoLimit_
Film thickness above which Courant number calculation in valid.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcSnGrad.C:45
const word & name() const
Return name.
Definition: IOobject.H:260
virtual const volScalarField & kappa() const
Return the film thermal conductivity [W/m/K].
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
scalar sumLocalContErr
Namespace for OpenFOAM.
virtual void correctThermoFields()
Correct the thermo fields.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:451
#define InfoInFunction
Report an information message using Foam::Info.
const dimensionSet dimVelocity