humidityTemperatureCoupledMixedFvPatchScalarField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2015-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
30 #include "fvPatchFieldMapper.H"
31 #include "volFields.H"
32 #include "surfaceFields.H"
33 #include "mappedPatchBase.H"
35 
36 // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
37 
38 const Foam::Enum
39 <
41 >
42 Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massModeTypeNames_
43 ({
44  { massTransferMode::mtConstantMass, "constantMass" },
45  { massTransferMode::mtCondensation, "condensation" },
46  { massTransferMode::mtEvaporation, "evaporation" },
47  {
48  massTransferMode::mtCondensationAndEvaporation,
49  "condensationAndEvaporation"
50  },
51 });
52 
53 
54 // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
55 
56 Foam::scalar Foam::humidityTemperatureCoupledMixedFvPatchScalarField::Sh
57 (
58  const scalar Re,
59  const scalar Sc
60 ) const
61 {
62  if (Re < 5.0E+05)
63  {
64  return 0.664*sqrt(Re)*cbrt(Sc);
65  }
66  else
67  {
68  return 0.037*pow(Re, 0.8)*cbrt(Sc);
69  }
70 }
71 
72 
73 Foam::scalar
74 Foam::humidityTemperatureCoupledMixedFvPatchScalarField::htcCondensation
75 (
76  const scalar Tsat,
77  const scalar Re
78 ) const
79 {
80  // (BLID:Eq. 10.52-10.53)
81  if (Tsat > 295.15 && Tsat < 373.15)
82  {
83  return 51104 + 2044*(Tsat - 273.15);
84  }
85  else
86  {
87  return 255510;
88  }
89 }
90 
91 
93 Foam::humidityTemperatureCoupledMixedFvPatchScalarField::thicknessField
94 (
95  const word& fieldName,
96  const fvMesh& mesh
97 )
98 {
100 
101  if (!ptr)
102  {
103  ptr = new volScalarField
104  (
105  IOobject
106  (
107  fieldName,
108  mesh.time().timeName(),
109  mesh,
112  ),
113  mesh,
115  );
116 
117  ptr->store();
118  }
119 
120  return *ptr;
121 }
123 
124 
125 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
126 
129 (
130  const fvPatch& p,
132 )
133 :
134  mixedFvPatchScalarField(p, iF),
136  mode_(mtConstantMass),
137  pName_("p"),
138  UName_("U"),
139  rhoName_("rho"),
140  muName_("thermo:mu"),
141  TnbrName_("T"),
142  qrNbrName_("none"),
143  qrName_("none"),
144  specieName_("none"),
145  liquid_(nullptr),
146  liquidDict_(nullptr),
147  mass_(patch().size(), Zero),
148  Tvap_(0.0),
149  myKDelta_(patch().size(), Zero),
150  dmHfg_(patch().size(), Zero),
151  mpCpTp_(patch().size(), Zero),
152  Mcomp_(0.0),
153  L_(0.0),
154  fluid_(false),
155  cp_(patch().size(), Zero),
156  thickness_(patch().size(), Zero),
157  rho_(patch().size(), Zero),
158  thicknessLayers_(0),
159  kappaLayers_(0)
160 {
161  this->refValue() = 0.0;
162  this->refGrad() = 0.0;
163  this->valueFraction() = 1.0;
164 }
165 
166 
169 (
171  const fvPatch& p,
173  const fvPatchFieldMapper& mapper
174 )
175 :
176  mixedFvPatchScalarField(psf, p, iF, mapper),
178  mode_(psf.mode_),
179  pName_(psf.pName_),
180  UName_(psf.UName_),
181  rhoName_(psf.rhoName_),
182  muName_(psf.muName_),
183  TnbrName_(psf.TnbrName_),
184  qrNbrName_(psf.qrNbrName_),
185  qrName_(psf.qrName_),
186  specieName_(psf.specieName_),
187  liquid_(psf.liquid_.clone()),
188  liquidDict_(psf.liquidDict_),
189  mass_(psf.mass_, mapper),
190  Tvap_(psf.Tvap_),
191  myKDelta_(psf.myKDelta_, mapper),
192  dmHfg_(psf.dmHfg_, mapper),
193  mpCpTp_(psf.mpCpTp_, mapper),
194  Mcomp_(psf.Mcomp_),
195  L_(psf.L_),
196  fluid_(psf.fluid_),
197  cp_(psf.cp_, mapper),
198  thickness_(psf.thickness_, mapper),
199  rho_(psf.rho_, mapper),
200  thicknessLayers_(psf.thicknessLayers_),
201  kappaLayers_(psf.kappaLayers_)
202 {}
203 
204 
207 (
208  const fvPatch& p,
210  const dictionary& dict
211 )
212 :
213  mixedFvPatchScalarField(p, iF),
215  mode_(mtCondensationAndEvaporation),
216  pName_(dict.getOrDefault<word>("p", "p")),
217  UName_(dict.getOrDefault<word>("U", "U")),
218  rhoName_(dict.getOrDefault<word>("rho", "rho")),
219  muName_(dict.getOrDefault<word>("mu", "thermo:mu")),
220  TnbrName_(dict.getOrDefault<word>("Tnbr", "T")),
221  qrNbrName_(dict.getOrDefault<word>("qrNbr", "none")),
222  qrName_(dict.getOrDefault<word>("qr", "none")),
223  specieName_(dict.getOrDefault<word>("specie", "none")),
224  liquid_(nullptr),
225  liquidDict_(),
226  mass_(patch().size(), Zero),
227  Tvap_(0.0),
228  myKDelta_(patch().size(), Zero),
229  dmHfg_(patch().size(), Zero),
230  mpCpTp_(patch().size(), Zero),
231  Mcomp_(0.0),
232  L_(0.0),
233  fluid_(false),
234  cp_(patch().size(), Zero),
235  thickness_(patch().size(), Zero),
236  rho_(patch().size(), Zero),
237  thicknessLayers_(0),
238  kappaLayers_(0)
239 {
240  if (!isA<mappedPatchBase>(this->patch().patch()))
241  {
243  << "\n patch type '" << p.type()
244  << "' not type '" << mappedPatchBase::typeName << "'"
245  << "\n for patch " << p.name()
246  << " of field " << internalField().name()
247  << " in file " << internalField().objectPath()
248  << exit(FatalIOError);
249  }
250 
251  fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
252 
253  if (massModeTypeNames_.readIfPresent("mode", dict, mode_))
254  {
255  fluid_ = true;
256  }
257 
258  if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
259  {
260  dict.readEntry("kappaLayers", kappaLayers_);
261  }
262 
263  if (fluid_)
264  {
265  switch(mode_)
266  {
267  case mtConstantMass:
268  {
269  thickness_ = scalarField("thickness", dict, p.size());
270  cp_ = scalarField("cp", dict, p.size());
271  rho_ = scalarField("rho", dict, p.size());
272 
273  break;
274  }
275  case mtCondensation:
276  case mtEvaporation:
278  {
279  dict.readEntry("carrierMolWeight", Mcomp_);
280  dict.readEntry("L", L_);
281  dict.readEntry("Tvap", Tvap_);
282  liquidDict_ = dict.subDict("liquid");
283  liquid_ =
284  liquidProperties::New(liquidDict_.subDict(specieName_));
285 
286  if (dict.found("thickness"))
287  {
288  scalarField& Tp = *this;
289  const scalarField& magSf = patch().magSf();
290 
291  // Assume initially standard pressure for rho calculation
292  scalar pf = 1e5;
293  thickness_ = scalarField("thickness", dict, p.size());
294  forAll(thickness_, i)
295  {
296  mass_[i] =
297  thickness_[i]*liquid_->rho(pf, Tp[i])*magSf[i];
298  }
299  }
300  fluid_ = true;
301 
302  break;
303  }
304  default:
305  {
307  << "Did not find mode " << mode_
308  << " on patch " << patch().name()
309  << nl
310  << "Please set 'mode' to one of "
311  << massModeTypeNames_.sortedToc()
312  << exit(FatalIOError);
313  }
314  }
315  }
316 
317 
318 
319  if (dict.found("refValue"))
320  {
321  // Full restart
322  refValue() = scalarField("refValue", dict, p.size());
323  refGrad() = scalarField("refGradient", dict, p.size());
324  valueFraction() = scalarField("valueFraction", dict, p.size());
325  }
326  else
327  {
328  // Start from user entered data. Assume fixedValue.
329  refValue() = *this;
330  refGrad() = 0.0;
331  valueFraction() = 1.0;
332  }
333 }
334 
335 
338 (
339  const humidityTemperatureCoupledMixedFvPatchScalarField& psf,
340  const DimensionedField<scalar, volMesh>& iF
341 )
342 :
343  mixedFvPatchScalarField(psf, iF),
344  temperatureCoupledBase(patch(), psf),
345  mode_(psf.mode_),
346  pName_(psf.pName_),
347  UName_(psf.UName_),
348  rhoName_(psf.rhoName_),
349  muName_(psf.muName_),
350  TnbrName_(psf.TnbrName_),
351  qrNbrName_(psf.qrNbrName_),
352  qrName_(psf.qrName_),
353  specieName_(psf.specieName_),
354  liquid_(psf.liquid_.clone()),
355  liquidDict_(psf.liquidDict_),
356  mass_(psf.mass_),
357  Tvap_(psf.Tvap_),
358  myKDelta_(psf.myKDelta_),
359  dmHfg_(psf.dmHfg_),
360  mpCpTp_(psf.mpCpTp_),
361  Mcomp_(psf.Mcomp_),
362  L_(psf.L_),
363  fluid_(psf.fluid_),
364  cp_(psf.cp_),
365  thickness_(psf.thickness_),
366  rho_(psf.rho_),
367  thicknessLayers_(psf.thicknessLayers_),
368  kappaLayers_(psf.kappaLayers_)
369 {}
370 
371 
372 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
373 
375 (
376  const fvPatchFieldMapper& m
377 )
378 {
379  mixedFvPatchScalarField::autoMap(m);
381 
382  if (fluid_)
383  {
384  mass_.autoMap(m);
385  myKDelta_.autoMap(m);
386  dmHfg_.autoMap(m);
387  mpCpTp_.autoMap(m);
388  cp_.autoMap(m);
389  thickness_.autoMap(m);
390  rho_.autoMap(m);
391  }
392 }
393 
394 
396 (
397  const fvPatchScalarField& ptf,
398  const labelList& addr
399 )
400 {
401  mixedFvPatchScalarField::rmap(ptf, addr);
402 
403  const humidityTemperatureCoupledMixedFvPatchScalarField& tiptf =
404  refCast<const humidityTemperatureCoupledMixedFvPatchScalarField>
405  (
406  ptf
407  );
408 
409  temperatureCoupledBase::rmap(tiptf, addr);
410  if (fluid_)
411  {
412  mass_.rmap(tiptf.mass_, addr);
413  myKDelta_.rmap(tiptf.myKDelta_, addr);
414  dmHfg_.rmap(tiptf.dmHfg_, addr);
415  mpCpTp_.rmap(tiptf.mpCpTp_, addr);
416  cp_.rmap(tiptf.cp_, addr);
417  thickness_.rmap(tiptf.thickness_, addr);
418  rho_.rmap(tiptf.rho_, addr);
419  }
420 }
421 
422 
424 {
425  if (updated())
426  {
427  return;
428  }
429 
430  // Get the coupling information from the mappedPatchBase
431  const mappedPatchBase& mpp =
432  refCast<const mappedPatchBase>(patch().patch());
433 
434  const scalarField& magSf = patch().magSf();
435 
436  const label nbrPatchI = mpp.samplePolyPatch().index();
437  const polyMesh& mesh = patch().boundaryMesh().mesh();
438  const polyMesh& nbrMesh = mpp.sampleMesh();
439  const fvPatch& nbrPatch =
440  refCast<const fvMesh>(nbrMesh).boundary()[nbrPatchI];
441 
442  const humidityTemperatureCoupledMixedFvPatchScalarField&
443  nbrField =
444  refCast
445  <
446  const humidityTemperatureCoupledMixedFvPatchScalarField
447  >
448  (
449  nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
450  );
451 
452  // Swap to obtain full local values of neighbour internal field
453  scalarField nbrIntFld(nbrField.patchInternalField());
454  mpp.distribute(nbrIntFld);
455 
456 
457  scalarField& Tp = *this;
458 
459  const volScalarField& T =
460  static_cast<const volScalarField&>(internalField());
461 
462  const scalarField TpOld(T.oldTime().boundaryField()[patch().index()]);
463 
464  scalarField Tin(patchInternalField());
465 
466  const scalarField K(this->kappa(*this));
467 
468  // Neighbour kappa done separately because we need kappa solid for the
469  // htc correlation
470  scalarField nbrK(nbrField.kappa(*this));
471  mpp.distribute(nbrK);
472 
473  scalarField nrbDeltaCoeffs(nbrPatch.deltaCoeffs());
474  mpp.distribute(nrbDeltaCoeffs);
475 
476  scalarField KDeltaNbr(nbrField.kappa(*this)*nbrPatch.deltaCoeffs());
477  mpp.distribute(KDeltaNbr);
478 
479  myKDelta_ = K*patch().deltaCoeffs();
480 
481  if (thicknessLayers_.size() > 0)
482  {
483  myKDelta_ = 1.0/myKDelta_;
484  forAll(thicknessLayers_, iLayer)
485  {
486  myKDelta_ += thicknessLayers_[iLayer]/kappaLayers_[iLayer];
487  }
488  myKDelta_ = 1.0/myKDelta_;
489  }
490 
491  scalarField dm(patch().size(), Zero);
492 
493  // Fluid Side
494  if (fluid_)
495  {
496  scalarField Yvp(patch().size(), Zero);
497  const scalar dt = mesh.time().deltaTValue();
498 
499  const scalarField myDelta(patch().deltaCoeffs());
500 
501  if (mode_ != mtConstantMass)
502  {
503  scalarField cp(patch().size(), Zero);
504  scalarField hfg(patch().size(), Zero);
505  scalarField htc(patch().size(), GREAT);
506  scalarField liquidRho(patch().size(), Zero);
507  scalarField Tdew(patch().size(), Zero);
508  scalarField RH(patch().size(), Zero);
509 
510  fixedGradientFvPatchField<scalar>& Yp =
511  const_cast<fixedGradientFvPatchField<scalar>&>
512  (
513  refCast
514  <
515  const fixedGradientFvPatchField<scalar>
516  >
517  (
518  patch().lookupPatchField<volScalarField, scalar>
519  (
520  specieName_
521  )
522  )
523  );
524 
525  const fvPatchScalarField& pp =
526  patch().lookupPatchField<volScalarField, scalar>(pName_);
527 
528  const fvPatchVectorField& Up =
529  patch().lookupPatchField<volVectorField, vector>(UName_);
530 
531  const fvPatchScalarField& rhop =
532  patch().lookupPatchField<volScalarField, scalar>(rhoName_);
533 
534  const fvPatchScalarField& mup =
535  patch().lookupPatchField<volScalarField, scalar>(muName_);
536 
537  const vectorField Ui(Up.patchInternalField());
538  const scalarField Yi(Yp.patchInternalField());
539 
540  forAll(Tp, faceI)
541  {
542  const scalar Tf = Tp[faceI];
543  const scalar Tint = Tin[faceI];
544  const vector Uf = Ui[faceI];
545  const scalar pf = pp[faceI];
546 
547  const scalar muf = mup[faceI];
548  const scalar rhof = rhop[faceI];
549  const scalar nuf = muf/rhof;
550  const scalar pSat = liquid_->pv(pf, Tint);
551  const scalar Mv = liquid_->W();
552  const scalar TSat = liquid_->pvInvert(pSat);
553  const scalar Re = mag(Uf)*L_/nuf;
554 
555  cp[faceI] = liquid_->Cp(pf, Tf);
556  hfg[faceI] = liquid_->hl(pf, Tf);
557 
558  // Calculate relative humidity
559  const scalar invMwmean =
560  Yi[faceI]/Mv + (1.0 - Yi[faceI])/Mcomp_;
561  const scalar Xv = Yi[faceI]/invMwmean/Mv;
562  RH[faceI] = min(Xv*pf/pSat, 1.0);
563 
564  scalar RHmin = 0.01;
565  Tdew[faceI] = 0.0;
566 
567  if (RH[faceI] > RHmin)
568  {
569  scalar b = 243.5;
570  scalar c = 17.65;
571  scalar TintDeg = Tint - 273;
572  Tdew[faceI] =
573  b*(log(RH[faceI]) + (c*TintDeg)/(b + TintDeg))
574  /(c - log(RH[faceI]) - ((c*TintDeg)/(b + TintDeg)))
575  + 273;
576  }
577 
578  if
579  (
580  Tf < Tdew[faceI]
581  && RH[faceI] > RHmin
582  && (
583  mode_ == mtCondensation
584  || mode_ == mtCondensationAndEvaporation
585  )
586  )
587  {
588  htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
589 
590  scalar htcTotal =
591  1.0/((1.0/myKDelta_[faceI]) + (1.0/htc[faceI]));
592 
593  // Heat flux [W] (>0 heat is converted into mass)
594  const scalar q = (Tint - Tf)*htcTotal*magSf[faceI];
595 
596  // Mass flux rate [Kg/s/m2]
597  dm[faceI] = q/hfg[faceI]/magSf[faceI];
598 
599  mass_[faceI] += q/hfg[faceI]*dt;
600 
601  // -dYp/dn = q/Dab (fixedGradient)
602  const scalar Dab = liquid_->D(pf, Tf);
603  Yvp[faceI] =
604  -min(dm[faceI]/Dab/rhof, Yi[faceI]*myDelta[faceI]);
605  }
606  else if
607  (
608  Tf > Tvap_
609  && mass_[faceI] > 0.0
610  && (
611  mode_ == mtEvaporation
612  || mode_ == mtCondensationAndEvaporation
613  )
614  )
615  {
616  const scalar Dab = liquid_->D(pf, Tf);
617 
618  const scalar Sc = nuf/Dab;
619  const scalar Sh = this->Sh(Re, Sc);
620 
621  const scalar Ys = Mv*pSat/(Mv*pSat + Mcomp_*(pf - pSat));
622 
623  // Mass transfer coefficient [m/s]
624  const scalar hm = Dab*Sh/L_;
625 
626  const scalar Yinf = max(Yi[faceI], 0.0);
627 
628  // Mass flux rate [Kg/s/m2]
629  dm[faceI] = -rhof*hm*max((Ys - Yinf), 0.0)/(1.0 - Ys);
630 
631  // Set fixedGradient for carrier species.
632  Yvp[faceI] = -dm[faceI]/Dab/rhof;
633 
634  // Total mass accumulated [Kg]
635  mass_[faceI] += dm[faceI]*magSf[faceI]*dt;
636 
637  htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
638  }
639  else if (Tf > Tdew[faceI] && Tf < Tvap_ && mass_[faceI] > 0.0)
640  {
641  htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
642  }
643  else if (mass_[faceI] == 0.0)
644  {
645  // Do nothing
646  }
647 
648  liquidRho[faceI] = liquid_->rho(pf, Tf);
649  }
650 
651  mass_ = max(mass_, scalar(0));
652 
653  Yp.gradient() = Yvp;
654 
655  // Output film delta (e.g. H2OThickness) [m]
656  const word fieldName(specieName_ + "Thickness");
657 
658  scalarField& pDelta =
659  thicknessField
660  (
661  fieldName,
662  refCast<const fvMesh>(mesh)
663  ).boundaryFieldRef()[patch().index()];
664 
665 
666  pDelta = mass_/liquidRho/magSf;
667 
668  // Weight myKDelta and htc
669  myKDelta_ = 1.0/((1.0/myKDelta_) + (1.0/htc));
670 
671  mpCpTp_ = mass_*cp/dt/magSf;
672 
673  // Heat flux due to change of phase [W/m2]
674  dmHfg_ = dm*hfg;
675 
676  if (debug)
677  {
678  // Output RH and Tdew
679  scalarField& bRH =
680  thicknessField
681  (
682  "RH",
683  refCast<const fvMesh>(mesh)
684  ).boundaryFieldRef()[patch().index()];
685  bRH = RH;
686 
687  scalarField& bTdew =
688  thicknessField
689  (
690  "Tdew",
691  refCast<const fvMesh>(mesh)
692  ).boundaryFieldRef()[patch().index()];
693  bTdew = Tdew;
694  }
695  }
696  else
697  {
698  // Inertia term [W/K/m2]
699  mpCpTp_ = thickness_*rho_*cp_/dt;
700  }
701  }
702 
703  scalarField mpCpTpNbr(patch().size(), Zero);
704  scalarField dmHfgNbr(patch().size(), Zero);
705 
706  if (!fluid_)
707  {
708  mpCpTpNbr = nbrField.mpCpTp();
709  mpp.distribute(mpCpTpNbr);
710 
711  dmHfgNbr = nbrField.dmHfg();
712  mpp.distribute(dmHfgNbr);
713  }
714 
715  // Obtain Rad heat (qr)
716  scalarField qr(Tp.size(), Zero);
717  if (qrName_ != "none")
718  {
719  qr = patch().lookupPatchField<volScalarField, scalar>(qrName_);
720  }
721 
722  scalarField qrNbr(Tp.size(), Zero);
723  if (qrNbrName_ != "none")
724  {
725  qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
726  mpp.distribute(qrNbr);
727  }
728 
729  const scalarField dmHfg(dmHfgNbr + dmHfg_);
730 
731  const scalarField mpCpdt(mpCpTpNbr + mpCpTp_);
732 
733  // qr > 0 (heat up the wall)
734  scalarField alpha(KDeltaNbr + mpCpdt - (qr + qrNbr)/Tp);
735 
736  valueFraction() = alpha/(alpha + myKDelta_);
737 
738  refValue() = (KDeltaNbr*nbrIntFld + mpCpdt*TpOld + dmHfg)/alpha;
739 
740  mixedFvPatchScalarField::updateCoeffs();
741 
742  if (debug && fluid_)
743  {
744  scalar Qdm = gSum(dm*magSf);
745  scalar QMass = gSum(mass_);
746  scalar Qt = gSum(myKDelta_*(Tp - Tin)*magSf);
747  scalar QtSolid = gSum(KDeltaNbr*(Tp - nbrIntFld)*magSf);
748 
749  Info<< mesh.name() << ':'
750  << patch().name() << ':'
751  << internalField().name() << " <- "
752  << nbrMesh.name() << ':'
753  << nbrPatch.name() << ':'
754  << internalField().name() << " :" << nl
755  << " Total mass flux [Kg/s] : " << Qdm << nl
756  << " Total mass on the wall [Kg] : " << QMass << nl
757  << " Total heat (>0 leaving the wall to the fluid) [W] : "
758  << Qt << nl
759  << " Total heat (>0 leaving the wall to the solid) [W] : "
760  << QtSolid << nl
761  << " wall temperature "
762  << " min:" << gMin(*this)
763  << " max:" << gMax(*this)
764  << " avg:" << gAverage(*this)
765  << endl;
766  }
767 }
768 
769 
771 (
772  Ostream& os
773 ) const
774 {
776  os.writeEntryIfDifferent<word>("p", "p", pName_);
777  os.writeEntryIfDifferent<word>("U", "U", UName_);
778  os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
779  os.writeEntryIfDifferent<word>("mu", "thermo:mu", muName_);
780  os.writeEntryIfDifferent<word>("Tnbr", "T", TnbrName_);
781  os.writeEntryIfDifferent<word>("qrNbr", "none", qrNbrName_);
782  os.writeEntryIfDifferent<word>("qr", "none", qrName_);
783 
784  if (fluid_)
785  {
786  os.writeEntry("mode", massModeTypeNames_[mode_]);
787 
788  os.writeEntryIfDifferent<word>("specie", "none", specieName_);
789 
790  os.writeEntry("carrierMolWeight", Mcomp_);
791 
792  os.writeEntry("L", L_);
793  os.writeEntry("Tvap", Tvap_);
794  os.writeEntry("fluid", fluid_);
795  mass_.writeEntry("mass", os);
796 
797  if (mode_ == mtConstantMass)
798  {
799  cp_.writeEntry("cp", os);
800  rho_.writeEntry("rho", os);
801  }
802 
803  thickness_.writeEntry("thickness", os);
804  word liq = "liquid";
805  os << token::TAB << token::TAB << liq;
806  liquidDict_.write(os);
807  }
808 
809  if (thicknessLayers_.size())
810  {
811  thicknessLayers_.writeEntry("thicknessLayers", os);
812  kappaLayers_.writeEntry("kappaLayers", os);
813  }
814 
816 }
817 
818 
819 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
820 
821 namespace Foam
822 {
824  (
826  humidityTemperatureCoupledMixedFvPatchScalarField
827  );
828 }
829 
830 
831 // ************************************************************************* //
Foam::surfaceFields.
faceListList boundary
dictionary dict
fvPatchField< vector > fvPatchVectorField
scalar deltaTValue() const noexcept
Return time step value.
Definition: TimeStateI.H:36
dimensionedScalar log(const dimensionedScalar &ds)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
Type gMin(const FieldField< Field, Type > &f)
Tab [isspace].
Definition: token.H:126
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:40
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:49
Type & refCast(U &obj)
A dynamic_cast (for references) that generates FatalError on failed casts, uses the virtual type() me...
Definition: typeInfo.H:151
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: POSIX.C:1016
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:68
bool store()
Register object with its registry and transfer ownership to the registry.
Definition: regIOobjectI.H:36
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:312
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
void write(Ostream &os) const
Write.
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:361
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:85
CGAL::Exact_predicates_exact_constructions_kernel K
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:453
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:413
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:84
humidityTemperatureCoupledMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
dynamicFvMesh & mesh
Type gSum(const FieldField< Field, Type > &f)
fvPatchField< scalar > fvPatchScalarField
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
A class for handling words, derived from Foam::string.
Definition: word.H:63
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
dimensionedScalar cbrt(const dimensionedScalar &ds)
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:152
Vector< scalar > vector
Definition: vector.H:57
autoPtr< surfaceVectorField > Uf
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:26
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:327
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
Definition: Time.C:760
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
static autoPtr< liquidProperties > New(const word &name)
Return a pointer to a new liquidProperties created from name.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
List< word > sortedToc() const
The sorted list of enum names.
Definition: EnumI.H:63
Common functions used in temperature coupled boundaries.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
const word & name() const
Return reference to name.
Definition: fvMesh.H:388
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:607
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Type gAverage(const FieldField< Field, Type > &f)
const dimensionedScalar c
Speed of light in a vacuum.
virtual void operator=(const UList< scalar > &)
Definition: fvPatchField.C:352
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
Nothing to be read.
Automatically write from objectRegistry::writeObject()
const std::string patch
OpenFOAM patch number as a std::string.
bool readIfPresent(const word &key, const dictionary &dict, EnumType &val) const
Find an entry if present, and assign to T val.
Definition: EnumI.H:125
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
List< label > labelList
A List of labels.
Definition: List.H:62
volScalarField & p
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
surfaceScalarField rhof(fvc::interpolate(rho, "div(phi,rho)"))
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:157