28 #include "surfaceInterpolate.H" 34 namespace blendedInterfacialModel
37 template<
class GeoField>
38 inline tmp<GeoField>
interpolate(tmp<volScalarField> f);
41 inline tmp<Foam::volScalarField>
interpolate(tmp<volScalarField> f)
47 inline tmp<Foam::surfaceScalarField>
interpolate(tmp<volScalarField> f)
57 template<
class ModelType>
58 template<
template<
class>
class PatchField,
class GeoMesh>
61 tmp<GeometricField<scalar, PatchField, GeoMesh>>& f1,
62 tmp<GeometricField<scalar, PatchField, GeoMesh>>& f2,
66 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
71 <<
"Cannot treat an interfacial model with no distinction between " 72 <<
"continuous and dispersed phases as signed" 76 if (model_.valid() || model1In2_.valid())
79 blendedInterfacialModel::interpolate<scalarGeoField>
81 blending_.f1(phase1_, phase2_)
85 if (model_.valid() || model2In1_.valid())
89 *blendedInterfacialModel::interpolate<scalarGeoField>
91 blending_.f2(phase1_, phase2_)
97 template<
class ModelType>
98 template<
class Type,
template<
class>
class PatchField,
class GeoMesh>
101 GeometricField<Type, PatchField, GeoMesh>& field
104 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
106 typename typeGeoField::Boundary& fieldBf = field.boundaryFieldRef();
113 !phase1_.stationary()
114 && isA<fixedValueFvsPatchScalarField>
116 phase1_.phi()().boundaryField()[
patchi]
120 !phase2_.stationary()
121 && isA<fixedValueFvsPatchScalarField>
123 phase2_.phi()().boundaryField()[
patchi]
134 template<
class ModelType>
138 template<
class>
class PatchField,
145 tmp<GeometricField<Type, PatchField, GeoMesh>>
146 (ModelType::*method)(Args ...)
const,
148 const dimensionSet& dims,
153 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
154 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
156 tmp<scalarGeoField>
f1, f2;
157 calculateBlendingCoeffs(f1, f2, subtract);
159 tmp<typeGeoField> x =
162 ModelType::typeName +
":" 165 dimensioned<Type>(dims,
Zero)
170 x.ref() += (scalar(1) -
f1() - f2())*(model_().*method)(args ...);
173 if (model1In2_.valid())
175 x.ref() += f1*(model1In2_().*method)(args ...);
178 if (model2In1_.valid())
180 x.ref() += f2*(model2In1_().*method)(args ...);
186 && (model_.valid() || model1In2_.valid() || model2In1_.valid())
189 correctFixedFluxBCs(x.ref());
196 template<
class ModelType>
200 template<
class>
class PatchField,
207 HashPtrTable<GeometricField<Type, PatchField, GeoMesh>>
208 (ModelType::*method)(Args ...)
const,
210 const dimensionSet& dims,
215 typedef GeometricField<scalar, PatchField, GeoMesh> scalarGeoField;
216 typedef GeometricField<Type, PatchField, GeoMesh> typeGeoField;
218 tmp<scalarGeoField>
f1, f2;
219 calculateBlendingCoeffs(f1, f2, subtract);
221 HashPtrTable<typeGeoField> xs;
225 const scalarGeoField&
f,
226 const HashPtrTable<typeGeoField>& dxs
231 if (xs.found(dxIter.key()))
233 *xs[dxIter.key()] += f**dxIter();
242 ModelType::typeName +
':' 246 phasePair(phase1_, phase2_).name()
257 addToXs(scalar(1) -
f1() - f2(), (model_().*method)(args ...));
260 if (model1In2_.valid())
262 addToXs(f1, (model1In2_().*method)(args ...));
265 if (model2In1_.valid())
267 addToXs(f2, (model2In1_().*method)(args ...));
273 && (model_.valid() || model1In2_.valid() || model2In1_.valid())
276 forAllIter(
typename HashPtrTable<typeGeoField>, xs, xIter)
278 correctFixedFluxBCs(*xIter());
288 template<
class ModelType>
291 const phaseModel& phase1,
292 const phaseModel& phase2,
293 const blendingMethod& blending,
294 autoPtr<ModelType> model,
295 autoPtr<ModelType> model1In2,
296 autoPtr<ModelType> model2In1,
297 const bool correctFixedFluxBCs
304 IOobject::groupName(typeName, phasePair(phase1, phase2).name()),
313 model1In2_(model1In2),
314 model2In1_(model2In1),
315 correctFixedFluxBCs_(correctFixedFluxBCs)
319 template<
class ModelType>
323 const blendingMethod& blending,
324 const phasePair& pair,
325 const orderedPhasePair& pair1In2,
326 const orderedPhasePair& pair2In1,
327 const bool correctFixedFluxBCs
334 IOobject::groupName(typeName, pair.name()),
339 phase1_(pair.phase1()),
340 phase2_(pair.phase2()),
342 correctFixedFluxBCs_(correctFixedFluxBCs)
344 if (modelTable.found(pair))
356 if (modelTable.found(pair1In2))
362 modelTable[pair1In2],
368 if (modelTable.found(pair2In1))
374 modelTable[pair2In1],
384 template<
class ModelType>
391 template<
class ModelType>
397 return evaluate(
k,
"K", ModelType::dimK,
false);
401 template<
class ModelType>
405 tmp<volScalarField> (ModelType::*
k)(
const scalar)
const = &
ModelType::K;
407 return evaluate(
k,
"K", ModelType::dimK,
false, residualAlpha);
411 template<
class ModelType>
415 return evaluate(&ModelType::Kf,
"Kf", ModelType::dimK,
false);
419 template<
class ModelType>
428 template<
class ModelType>
436 template<
class ModelType>
440 return evaluate(&ModelType::D,
"D", ModelType::dimD,
false);
444 template<
class ModelType>
448 (model1In2_.valid() && model1In2_->mixture())
449 || (model2In1_.valid() && model2In1_->mixture())
450 || (model_.valid() && model_->mixture());
454 template<
class ModelType>
458 return evaluate(&ModelType::dmdtf,
"dmdtf", ModelType::dimDmdt,
true);
462 template<
class ModelType>
467 if (model1In2_.valid())
469 species.
append(model1In2_->species());
471 if (model2In1_.valid())
473 species.append(model2In1_->species());
477 species.append(model_->species());
480 return hashedWordList(move(species));
484 template<
class ModelType>
488 return evaluate(&ModelType::dmidtf,
"dmidtf", ModelType::dimDmdt,
true);
492 template<
class ModelType>
tmp< volScalarField > dmdtf() const
Return the blended mass transfer rate.
HashTable< dictionary, phasePairKey, phasePairKey::hash > dictTable
Dictionary hash table.
#define forAll(list, i)
Loop across all elements in list.
const dimensionSet dimArea
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
errorManipArg< error, int > exit(error &err, const int errNo=1)
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
bool writeData(Ostream &os) const
Dummy write for regIOobject.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
~BlendedInterfacialModel()
Destructor.
bool mixture() const
Return the list of individual species that are transferred.
tmp< volScalarField > K() const
Return the blended force coefficient.
tmp< surfaceScalarField > Ff() const
Return the face blended force.
tmp< surfaceScalarField > Kf() const
Return the face blended force coefficient.
label k
Boltzmann constant.
A HashTable specialisation for hashing pointers.
tmp< GeometricField< Type, fvPatchField, volMesh > > F() const
Return the blended force.
CGAL::Exact_predicates_exact_constructions_kernel K
void subtract(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
BlendedInterfacialModel(const phaseModel &phase1, const phaseModel &phase2, const blendingMethod &blending, autoPtr< ModelType > model, autoPtr< ModelType > model1In2, autoPtr< ModelType > model2In1, const bool correctFixedFluxBCs=true)
Construct from two phases, blending method and three models.
static word groupName(Name name, const word &group)
void append(const T &)
Append an element at the end of the list.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
hashedWordList species() const
Return the list of individual species that are transferred.
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.
A wordList with hashed indices for faster lookup by name.
tmp< volScalarField > D() const
Return the blended diffusivity.
HashPtrTable< volScalarField > dmidtf() const
Return the blended mass transfer rates for individual species.
A class for managing temporary objects.