31 #include "surfaceInterpolate.H" 43 namespace blendedInterfacialModel
46 template<
class GeoField>
47 inline tmp<GeoField>
interpolate(tmp<volScalarField> f);
50 inline tmp<Foam::volScalarField>
interpolate(tmp<volScalarField> f)
56 inline tmp<Foam::surfaceScalarField>
interpolate(tmp<volScalarField> f)
61 template<
class ModelType>
62 inline bool valid(
const PtrList<ModelType>& l)
80 template<
class ModelType>
84 const label timeIndex = interface_.mesh().time().timeIndex();
85 if (checkTimeIndex_ == timeIndex)
return;
88 const phaseModel& phase1 = interface_.phase1();
89 const phaseModel& phase2 = interface_.phase2();
91 const bool can1In2 = blending_->canBeContinuous(1);
92 const bool can2In1 = blending_->canBeContinuous(0);
93 const bool canS = blending_->canSegregate();
101 model1DispersedIn2_.valid()
102 || blendedInterfacialModel::valid(models1DispersedIn2Displaced_)
107 <<
"A " << ModelType::typeName <<
" was provided for " 108 << dispersedPhaseInterface(phase1, phase2).name()
109 <<
" but the associated blending does not permit " << phase2.name()
110 <<
" to be continuous so this model will not be used" <<
endl;
117 model2DispersedIn1_.valid()
118 || blendedInterfacialModel::valid(models2DispersedIn1Displaced_)
123 <<
"A " << ModelType::typeName <<
" was provided for " 124 << dispersedPhaseInterface(phase2, phase1).name()
125 <<
" but the associated blending does not permit " << phase1.name()
126 <<
" to be continuous so this model will not be used" <<
endl;
133 model1SegregatedWith2_.valid()
134 || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_)
139 <<
"A " << ModelType::typeName <<
" was provided for " 140 << segregatedPhaseInterface(phase1, phase2).name()
141 <<
" but the associated blending does not permit segregation" 142 <<
" so this model will not be used" <<
endl;
147 modelGeneral_.valid()
148 && (can1In2 || can2In1 || canS)
149 && (!can1In2 || model1DispersedIn2_.valid())
150 && (!can2In1 || model2DispersedIn1_.valid())
151 && (!canS || model1SegregatedWith2_.valid())
155 <<
"A " << ModelType::typeName <<
" was provided for " 156 << phaseInterface(phase1, phase2).name()
157 <<
" but other displaced and/or segregated models apply" 158 <<
" across the entire phase fraction space so this model" 159 <<
" will not be used" <<
endl;
164 const phaseModel& phaseD = interface_.fluid().phases()[
phasei];
168 modelsGeneralDisplaced_.set(phasei)
169 && (can1In2 || can2In1 || canS)
170 && (!can1In2 || models1DispersedIn2Displaced_.set(phasei))
171 && (!can2In1 || models2DispersedIn1Displaced_.set(phasei))
172 && (!canS || models1SegregatedWith2Displaced_.set(phasei))
176 <<
"A " << ModelType::typeName <<
" was provided for " 177 << displacedPhaseInterface(phase1, phase2, phaseD).name()
178 <<
" but other displaced and/or segregated models apply" 179 <<
" across the entire phase fraction space so this model" 180 <<
" will not be used" <<
endl;
186 if (can1In2 && !modelGeneral_.valid() && !model1DispersedIn2_.valid())
189 <<
"Blending for " << ModelType::typeName <<
"s permits " 190 << phase2.name() <<
" to become continuous, but no model was " 191 <<
"provided for " << dispersedPhaseInterface(phase1, phase2).name()
192 <<
". Consider adding a model for this configuration (or for " 193 << phaseInterface(phase1, phase2).name() <<
"), or if no model is " 194 <<
"needed then add a \"none\" model to suppress this warning." 198 if (can2In1 && !modelGeneral_.valid() && !model2DispersedIn1_.valid())
201 <<
"Blending for " << ModelType::typeName <<
"s permits " 202 << phase1.name() <<
" to become continuous, but no model was " 203 <<
"provided for " << dispersedPhaseInterface(phase2, phase1).name()
204 <<
". Consider adding a model for this configuration (or for " 205 << phaseInterface(phase1, phase2).name() <<
"), or if no model is " 206 <<
"needed then add a \"none\" model to suppress this warning." 210 if (canS && !modelGeneral_.valid() && !model1SegregatedWith2_.valid())
213 <<
"Blending for " << ModelType::typeName <<
"s permits " 214 <<
"segregation but no model was provided for " 215 << segregatedPhaseInterface(phase2, phase1).name()
216 <<
". Consider adding a model for this configuration (or for " 217 << phaseInterface(phase1, phase2).name() <<
"), or if no model is " 218 <<
"needed then add a \"none\" model to suppress this warning." 224 template<
class ModelType>
225 template<
template<
class>
class PatchField,
class GeoMesh>
228 const UPtrList<const volScalarField>& alphas,
229 tmp<GeometricField<scalar, PatchField, GeoMesh>>& fG,
230 tmp<GeometricField<scalar, PatchField, GeoMesh>>& f1D2,
231 tmp<GeometricField<scalar, PatchField, GeoMesh>>& f2D1,
232 tmp<GeometricField<scalar, PatchField, GeoMesh>>& fS,
233 PtrList<GeometricField<scalar, PatchField, GeoMesh>>& fGD,
234 PtrList<GeometricField<scalar, PatchField, GeoMesh>>& f1D2D,
235 PtrList<GeometricField<scalar, PatchField, GeoMesh>>& f2D1D,
236 PtrList<GeometricField<scalar, PatchField, GeoMesh>>& fSD,
240 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
243 auto constant = [&](
const scalar
k)
249 alphas.first().mesh(),
255 tmp<scalarGeoField> F1D2, F2D1;
258 model1DispersedIn2_.valid()
259 || model1SegregatedWith2_.valid()
260 || blendedInterfacialModel::valid(models1DispersedIn2Displaced_)
261 || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_)
265 blendedInterfacialModel::interpolate<scalarGeoField>
267 blending_->f1DispersedIn2(alphas)
272 model2DispersedIn1_.valid()
273 || model1SegregatedWith2_.valid()
274 || blendedInterfacialModel::valid(models2DispersedIn1Displaced_)
275 || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_)
279 blendedInterfacialModel::interpolate<scalarGeoField>
281 blending_->f2DispersedIn1(alphas)
287 if (model1DispersedIn2_.valid())
289 f1D2 = F1D2().clone();
292 if (model2DispersedIn1_.valid())
294 f2D1 = F2D1().clone();
297 if (model1SegregatedWith2_.valid())
300 if (f1D2.valid()) { fS.ref() -= f1D2(); }
301 if (f2D1.valid()) { fS.ref() -= f2D1(); }
304 if (modelGeneral_.valid())
307 if (f1D2.valid()) { fG.ref() -= f1D2(); }
308 if (f2D1.valid()) { fG.ref() -= f2D1(); }
309 if (fS.valid()) { fG.ref() -= fS(); }
314 tmp<scalarGeoField> FD;
317 blendedInterfacialModel::valid(modelsGeneralDisplaced_)
318 || blendedInterfacialModel::valid(models1DispersedIn2Displaced_)
319 || blendedInterfacialModel::valid(models2DispersedIn1Displaced_)
320 || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_)
324 blendedInterfacialModel::interpolate<scalarGeoField>
326 blending_->fDisplaced(alphas)
331 tmp<scalarGeoField> fDSum;
334 blendedInterfacialModel::valid(modelsGeneralDisplaced_)
335 || blendedInterfacialModel::valid(models1DispersedIn2Displaced_)
336 || blendedInterfacialModel::valid(models2DispersedIn1Displaced_)
337 || blendedInterfacialModel::valid(models1SegregatedWith2Displaced_)
344 const phaseModel& phaseD = interface_.fluid().phases()[
phasei];
346 if (interface_.contains(phaseD))
continue;
354 tmp<scalarGeoField>
alpha;
357 models1DispersedIn2Displaced_.set(phasei)
358 || models2DispersedIn1Displaced_.set(phasei)
359 || models1SegregatedWith2Displaced_.set(phasei)
360 || modelsGeneralDisplaced_.set(phasei)
364 blendedInterfacialModel::interpolate<scalarGeoField>
370 - alphas[interface_.phase1().index()]
371 - alphas[interface_.phase2().index()],
372 phaseD.residualAlpha()
377 if (models1DispersedIn2Displaced_.set(phasei))
379 f1D2D.set(phasei,
alpha()*FD()*F1D2());
380 fDSum.ref() += f1D2D[
phasei];
383 if (models2DispersedIn1Displaced_.set(phasei))
385 f2D1D.set(phasei,
alpha()*FD()*F2D1());
386 fDSum.ref() += f2D1D[
phasei];
389 if (models1SegregatedWith2Displaced_.set(phasei))
391 fSD.set(phasei,
alpha()*FD());
392 if (f1D2D.set(phasei)) fSD[phasei] -= f1D2D[phasei];
393 if (f2D1D.set(phasei)) fSD[phasei] -= f2D1D[phasei];
394 fDSum.ref() += fSD[
phasei];
397 if (modelsGeneralDisplaced_.set(phasei))
399 fGD.set(phasei,
alpha()*FD());
400 if (f1D2D.set(phasei)) fGD[phasei] -= f1D2D[phasei];
401 if (f2D1D.set(phasei)) fGD[phasei] -= f2D1D[phasei];
402 if (fSD.set(phasei)) fGD[phasei] -= fSD[phasei];
403 fDSum.ref() += fGD[
phasei];
411 if (f1D2.valid()) f1D2.ref() *= 1 - fDSum();
412 if (f2D1.valid()) f2D1.ref() *= 1 - fDSum();
413 if (fS.valid()) fS.ref() *= 1 - fDSum();
414 if (fG.valid()) fG.ref() *= 1 - fDSum();
420 auto signedError = [
this](
const phaseInterface& interface)
423 <<
"A signed quantity was evaluated from the blended " 424 << ModelType::typeName <<
" for " << interface_.name()
425 <<
" but a model was provided for " << interface.name()
426 <<
". Signed quantities are only possible to evaluate for" 430 const phaseModel& phase1 = interface_.phase1();
431 const phaseModel& phase2 = interface_.phase2();
435 signedError(phaseInterface(phase1, phase2));
447 signedError(segregatedPhaseInterface(phase1, phase2));
452 const phaseModel& phaseD = interface_.fluid().phases()[
phasei];
458 displacedPhaseInterface(phase1, phase2, phaseD)
461 if (f1D2D.set(phasei))
465 if (f2D1D.set(phasei))
473 segregatedDisplacedPhaseInterface(phase1, phase2, phaseD)
481 template<
class ModelType>
482 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
485 GeometricField<Type, PatchField, GeoMesh>& field
488 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
490 typename typeGeoField::Boundary& fieldBf = field.boundaryFieldRef();
497 !interface_.phase1().stationary()
498 && isA<fixedValueFvsPatchScalarField>
500 interface_.phase1().phi()().boundaryField()[
patchi]
504 !interface_.phase2().stationary()
505 && isA<fixedValueFvsPatchScalarField>
507 interface_.phase2().phi()().boundaryField()[
patchi]
518 template<
class ModelType>
524 using namespace constant::mathematical;
526 const phaseSystem& fluid = interface_.fluid();
527 const label nPhases = fluid.phases().size();
533 PtrList<scalarField>
fields(nPhases);
537 fieldNames[0] = fluid.phases()[0].volScalarField::name();
540 else if (nPhases == 2)
543 static const label nDivisions = 128;
545 fieldNames[0] = fluid.phases()[0].volScalarField::name();
546 fieldNames[1] = fluid.phases()[1].volScalarField::name();
562 List<point> phaseNodes(nPhases);
563 forAll(phaseNodes, phasei)
565 const scalar theta = 2*
pi*phasei/nPhases;
570 static const label nDivisions = 32;
572 for (
label divi = 0; divi < nDivisions; ++ divi)
574 const scalar s = scalar(divi + 1)/nDivisions;
576 forAll(phaseNodes, phasei)
578 for (
label i = 0; i < divi + 1; ++ i)
580 const scalar t = scalar(i)/(divi + 1);
584 s*(1 - t)*phaseNodes[phasei]
585 + s*t*phaseNodes[(phasei + 1) % nPhases]
592 forAll(phaseNodes, phasei)
594 faces.append(
triFace(0, phasei + 1, (phasei + 1) % nPhases + 1));
596 for (
label divi = 1; divi < nDivisions; ++ divi)
598 const label pointi0 = nPhases*(divi - 1)*divi/2 + 1;
599 const label pointi1 = nPhases*divi*(divi + 1)/2 + 1;
601 forAll(phaseNodes, phasei)
603 for (
label i = 0; i < divi + 1; ++ i)
607 + ((phasei*divi + i) % (nPhases*divi));
610 + ((phasei*divi + i + 1) % (nPhases*divi));
613 + ((phasei*(divi + 1) + i) % (nPhases*(divi + 1)));
616 + ((phasei*(divi + 1) + i + 1) % (nPhases*(divi + 1)));
618 faces.append(
triFace({pi00, pi10, pi11}));
619 if (i < divi) faces.append(
triFace({pi00, pi11, pi01}));
630 const label phasei0 = (phasei + nPhases - 1) % nPhases;
631 const label phasei1 = (phasei + 1) % nPhases;
633 const point& node0 = phaseNodes[phasei0];
635 const point& node1 = phaseNodes[phasei1];
639 const scalar A =
mag((node - node0) ^ (node1 - node0));
640 const scalar A0 =
mag((node - node0) ^ (points[i] - node0));
641 const scalar A1 =
mag((node1 - node) ^ (points[i] - node));
646 great*
mag(points[i] - node0)/
mag(node - node0);
648 else if (A1 < rootSmall)
651 great*
mag(points[i] - node1)/
mag(node - node1);
677 PtrList<volScalarField> alphas(nPhases);
687 fluid.phases()[
phasei].volScalarField::name(),
688 mesh.time().timeName(),
699 tmp<volScalarField> fG, f1D2, f2D1, fS;
700 PtrList<volScalarField> fGD(nPhases);
701 PtrList<volScalarField> f1D2D(nPhases);
702 PtrList<volScalarField> f2D1D(nPhases);
703 PtrList<volScalarField> fSD(nPhases);
704 calculateBlendingCoeffs
708 fGD, f1D2D, f2D1D, fSD,
712 const phaseModel& phase1 = interface_.phase1();
713 const phaseModel& phase2 = interface_.phase2();
715 auto addField = [&](
const phaseInterface& interface)
723 addField(phaseInterface(phase1, phase2));
727 addField(dispersedPhaseInterface(phase1, phase2));
731 addField(dispersedPhaseInterface(phase2, phase1));
735 addField(segregatedPhaseInterface(phase2, phase1));
740 const phaseModel& phaseD = fluid.phases()[
phasei];
744 addField(displacedPhaseInterface(phase1, phase2, phaseD));
746 if (f1D2D.set(phasei))
750 dispersedDisplacedPhaseInterface
758 if (f2D1D.set(phasei))
762 dispersedDisplacedPhaseInterface
774 segregatedDisplacedPhaseInterface
793 tmp<volScalarField> fG, f1D2, f2D1, fS;
794 PtrList<volScalarField> fGD(nPhases);
795 PtrList<volScalarField> f1D2D(nPhases);
796 PtrList<volScalarField> f2D1D(nPhases);
797 PtrList<volScalarField> fSD(nPhases);
798 calculateBlendingCoeffs
802 fGD, f1D2D, f2D1D, fSD,
806 label fieldi = nPhases;
810 fields[fieldi ++][i] = fG()[0];
814 fields[fieldi ++][i] = f1D2()[0];
818 fields[fieldi ++][i] = f2D1()[0];
822 fields[fieldi ++][i] = fS()[0];
831 if (f1D2D.set(phasei))
835 if (f2D1D.set(phasei))
848 const fileName path =
849 fluid.mesh().time().globalPath()
851 /ModelType::typeName;
852 Info<<
"Writing blending coefficients to " << path/interface_.name()
857 const autoPtr<scalarField> field0 =
fields.set(0,
nullptr);
859 for (
label fieldi = 1; fieldi <
fields.size(); ++ fieldi)
861 fields.set(fieldi - 1,
fields.set(fieldi,
nullptr).ptr());
876 coordSet(
true, field0Name, field0),
904 template<
class ModelType>
908 template<
class>
class PatchField,
915 tmp<GeometricField<Type, PatchField, GeoMesh>>
916 (ModelType::*method)(Args ...)
const,
918 const dimensionSet& dims,
925 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
926 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
929 const label nPhases = interface_.fluid().phases().size();
930 tmp<scalarGeoField> fG, f1D2, f2D1, fS;
931 PtrList<scalarGeoField> fGD(nPhases);
932 PtrList<scalarGeoField> f1D2D(nPhases);
933 PtrList<scalarGeoField> f2D1D(nPhases);
934 PtrList<scalarGeoField> fSD(nPhases);
935 calculateBlendingCoeffs
937 interface_.fluid().phases().template convert<const volScalarField>(),
939 fGD, f1D2D, f2D1D, fSD,
944 tmp<typeGeoField> x =
947 ModelType::typeName +
":" 950 dimensioned<Type>(dims,
Zero)
954 if (modelGeneral_.valid())
956 x.ref() += fG*(modelGeneral_().*method)(args ...);
958 if (model1DispersedIn2_.valid())
960 x.ref() += f1D2*(model1DispersedIn2_().*method)(args ...);
962 if (model2DispersedIn1_.valid())
964 x.ref() += f2D1*(model2DispersedIn1_().*method)(args ...);
966 if (model1SegregatedWith2_.valid())
968 x.ref() += fS*(model1SegregatedWith2_().*method)(args ...);
972 if (modelsGeneralDisplaced_.set(phasei))
976 *(modelsGeneralDisplaced_[
phasei].*method)(args ...);
978 if (models1DispersedIn2Displaced_.set(phasei))
982 *(models1DispersedIn2Displaced_[
phasei].*method)(args ...);
984 if (models2DispersedIn1Displaced_.set(phasei))
988 *(models2DispersedIn1Displaced_[
phasei].*method)(args ...);
990 if (models1SegregatedWith2Displaced_.set(phasei))
994 *(models1SegregatedWith2Displaced_[
phasei].*method)(args ...);
999 if (ModelType::correctFixedFluxBCs)
1001 correctFixedFluxBCs(x.ref());
1008 template<
class ModelType>
1012 template<
class>
class PatchField,
1019 HashPtrTable<GeometricField<Type, PatchField, GeoMesh>>
1020 (ModelType::*method)(Args ...)
const,
1022 const dimensionSet& dims,
1023 const bool subtract,
1029 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
1030 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
1033 const label nPhases = interface_.fluid().phases().size();
1034 tmp<scalarGeoField> fG, f1D2, f2D1, fS;
1035 PtrList<scalarGeoField> fGD(nPhases);
1036 PtrList<scalarGeoField> f1D2D(nPhases);
1037 PtrList<scalarGeoField> f2D1D(nPhases);
1038 PtrList<scalarGeoField> fSD(nPhases);
1039 calculateBlendingCoeffs
1041 interface_.fluid().phases().template convert<const volScalarField>(),
1043 fGD, f1D2D, f2D1D, fSD,
1048 HashPtrTable<typeGeoField> xs;
1053 const scalarGeoField&
f,
1054 const HashPtrTable<typeGeoField>& dxs
1059 if (xs.found(dxIter.key()))
1061 *xs[dxIter.key()] += f**dxIter();
1070 ModelType::typeName +
':' 1082 if (modelGeneral_.valid())
1084 addToXs(fG, (modelGeneral_().*method)(args ...));
1086 if (model1DispersedIn2_.valid())
1088 addToXs(f1D2, (model1DispersedIn2_().*method)(args ...));
1090 if (model2DispersedIn1_.valid())
1092 addToXs(f2D1, (model2DispersedIn1_().*method)(args ...));
1094 if (model1SegregatedWith2_.valid())
1096 addToXs(fS, (model1SegregatedWith2_().*method)(args ...));
1100 if (modelsGeneralDisplaced_.set(phasei))
1105 (modelsGeneralDisplaced_[phasei].*method)(args ...)
1108 if (models1DispersedIn2Displaced_.set(phasei))
1113 (models1DispersedIn2Displaced_[phasei].*method)(args ...)
1116 if (models2DispersedIn1Displaced_.set(phasei))
1121 (models2DispersedIn1Displaced_[phasei].*method)(args ...)
1124 if (models1SegregatedWith2Displaced_.set(phasei))
1129 (models1SegregatedWith2Displaced_[phasei].*method)(args ...)
1135 if (ModelType::correctFixedFluxBCs)
1137 forAllIter(
typename HashPtrTable<typeGeoField>, xs, xIter)
1139 correctFixedFluxBCs(*xIter());
1147 template<
class ModelType>
1148 template<
class ... Args>
1151 bool (ModelType::*method)(Args ...)
const,
1157 bool result =
false;
1159 if (modelGeneral_.valid())
1161 result = result || (modelGeneral_().*method)(args ...);
1163 if (model1DispersedIn2_.valid())
1165 result = result || (model1DispersedIn2_().*method)(args ...);
1167 if (model2DispersedIn1_.valid())
1169 result = result || (model2DispersedIn1_().*method)(args ...);
1171 if (model1SegregatedWith2_.valid())
1173 result = result || (model1SegregatedWith2_().*method)(args ...);
1178 if (modelsGeneralDisplaced_.set(phasei))
1182 || (modelsGeneralDisplaced_[
phasei].*method)(args ...);
1184 if (models1DispersedIn2Displaced_.set(phasei))
1188 || (models1DispersedIn2Displaced_[
phasei].*method)(args ...);
1190 if (models2DispersedIn1Displaced_.set(phasei))
1194 || (models2DispersedIn1Displaced_[
phasei].*method)(args ...);
1196 if (models1SegregatedWith2Displaced_.set(phasei))
1200 || (models1SegregatedWith2Displaced_[
phasei].*method)(args ...);
1208 template<
class ModelType>
1209 template<
class ... Args>
1212 const hashedWordList& (ModelType::*method)(Args ...)
const,
1220 if (modelGeneral_.valid())
1222 result.
append((modelGeneral_().*method)(args ...));
1224 if (model1DispersedIn2_.valid())
1226 result.append((model1DispersedIn2_().*method)(args ...));
1228 if (model2DispersedIn1_.valid())
1230 result.append((model2DispersedIn1_().*method)(args ...));
1232 if (model1SegregatedWith2_.valid())
1234 result.append((model1SegregatedWith2_().*method)(args ...));
1239 if (modelsGeneralDisplaced_.set(phasei))
1243 (modelsGeneralDisplaced_[phasei].*method)(args ...)
1246 if (models1DispersedIn2Displaced_.set(phasei))
1250 (models1DispersedIn2Displaced_[phasei].*method)(args ...)
1253 if (models2DispersedIn1Displaced_.set(phasei))
1257 (models2DispersedIn1Displaced_[phasei].*method)(args ...)
1260 if (models1SegregatedWith2Displaced_.set(phasei))
1264 (models1SegregatedWith2Displaced_[phasei].*method)(args ...)
1269 return hashedWordList(move(result));
1275 template<
class ModelType>
1278 const dictionary& dict,
1279 const phaseInterface& interface
1286 IOobject::groupName(typeName, interface.name()),
1288 interface.fluid().
mesh()
1291 interface_(interface),
1294 model1DispersedIn2_(),
1295 model2DispersedIn1_(),
1296 model1SegregatedWith2_(),
1297 modelsGeneralDisplaced_(interface.fluid().
phases().size()),
1298 models1DispersedIn2Displaced_(interface.fluid().
phases().size()),
1299 models2DispersedIn1Displaced_(interface.fluid().
phases().size()),
1300 models1SegregatedWith2Displaced_(interface.fluid().
phases().size()),
1304 const dictionary& blendingDict = interface.fluid().subDict(
"blending");
1308 ModelType::typeName,
1309 blendingDict.found(interface.fluid().modelName<ModelType>())
1310 ? blendingDict.subDict(interface.fluid().modelName<ModelType>())
1311 : blendingDict.subDict(
"default"),
1316 PtrList<phaseInterface> interfaces;
1317 PtrList<ModelType> models;
1318 interface.fluid().generateInterfacialModels
1321 dispersedDisplacedPhaseInterface,
1322 segregatedDisplacedPhaseInterface,
1323 displacedPhaseInterface,
1324 dispersedPhaseInterface,
1325 segregatedPhaseInterface,
1339 const phaseInterface&
interface = interfaces[i];
1341 autoPtr<ModelType>* modelPtrPtr;
1342 PtrList<ModelType>* modelPtrsPtr;
1344 if (isA<dispersedPhaseInterface>(interface))
1346 const phaseModel& dispersed =
1347 refCast<const dispersedPhaseInterface>(interface).dispersed();
1350 interface_.index(dispersed) == 0
1351 ? &model1DispersedIn2_
1352 : &model2DispersedIn1_;
1354 interface_.index(dispersed) == 0
1355 ? &models1DispersedIn2Displaced_
1356 : &models2DispersedIn1Displaced_;
1358 else if (isA<segregatedPhaseInterface>(interface))
1360 modelPtrPtr = &model1SegregatedWith2_;
1361 modelPtrsPtr = &models1SegregatedWith2Displaced_;
1365 modelPtrPtr = &modelGeneral_;
1366 modelPtrsPtr = &modelsGeneralDisplaced_;
1369 if (!isA<displacedPhaseInterface>(interface))
1371 *modelPtrPtr = models.set(i,
nullptr);
1375 const phaseModel& displacing =
1376 refCast<const displacedPhaseInterface>(interface).displacing();
1378 modelPtrsPtr->set(displacing.index(), models.set(i,
nullptr));
1383 if (blendingDict.found(
"format"))
1385 const word format = blendingDict.lookup<word>(
"format");
1387 const label nPhases = interface_.fluid().phases().size();
1391 (nPhases <= 2 && format != noSetWriter::typeName)
1392 || (nPhases > 2 && format != noSurfaceWriter::typeName)
1395 postProcessBlendingCoefficients(format);
1403 template<
class ModelType>
1410 template<
class ModelType>
1418 template<
class ModelType>
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
fvMesh zeroDimensionalFvMesh(const objectRegistry &db)
Construct a zero-dimensional unit-cube FV mesh.
#define forAll(list, i)
Loop across all elements in list.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool writeData(Ostream &os) const
Dummy write for regIOobject.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
bool interpolate(const vector &p1, const vector &p2, const vector &o, vector &n, scalar l)
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
volScalarField alpha(IOobject("alpha", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
~BlendedInterfacialModel()
Destructor.
static autoPtr< blendingMethod > New(const word &modelTypeName, const dictionary &dict, const phaseInterface &interface)
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const dimensionSet dimless
label k
Boltzmann constant.
A HashTable specialisation for hashing pointers.
void resize(const label)
Alias for setSize(const label)
Class to represent an interface between phases. Derivations can further specify the configuration of ...
static List< word > fieldNames
GeometricField< scalar, fvPatchField, volMesh > volScalarField
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
dimensionedScalar cos(const dimensionedScalar &ds)
static const word outputPrefix
Directory prefix.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static word groupName(Name name, const word &group)
void append(const T &)
Append an element at the end of the list.
List< scalar > scalarList
A List of scalars.
static autoPtr< surfaceWriter > New(const word &writeType, const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression)
Select given write options.
BlendedInterfacialModel(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
tmp< GeometricField< Type, PatchField, GeoMesh > > evaluate(tmp< GeometricField< Type, PatchField, GeoMesh >>(ModelType::*method)(Args ...) const, const word &name, const dimensionSet &dims, const bool subtract, Args ... args) const
Return a blended field.
dimensionedScalar sin(const dimensionedScalar &ds)
const phaseInterface & interface() const
Access the interface.
word name(const complex &)
Return a string representation of a complex.
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.
List< word > wordList
A List of words.
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
A wordList with hashed indices for faster lookup by name.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
phaseSystem::phaseModelList & phases
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
static const Vector< scalar > zero