38 void Foam::functionObjects::blendingFactor::calcBlendingFactor
40 const GeometricField<Type, fvPatchField, volMesh>&
field,
41 const typename fv::convectionScheme<Type>& cs
44 if (!
isA<fv::gaussConvectionScheme<Type>>(cs))
47 <<
"Scheme for field " <<
field.name() <<
" is not a " 48 << fv::gaussConvectionScheme<Type>::typeName
54 const fv::gaussConvectionScheme<Type>& gcs =
55 refCast<const fv::gaussConvectionScheme<Type>>(cs);
58 const surfaceInterpolationScheme<Type>& interpScheme = gcs.interpScheme();
60 if (!
isA<blendedSchemeBase<Type>>(interpScheme))
63 << interpScheme.type() <<
" is not a blended scheme" 70 const blendedSchemeBase<Type>& blendedScheme =
71 refCast<const blendedSchemeBase<Type>>(interpScheme);
77 auto& indicator = lookupObjectRef<volScalarField>(
resultName_);
79 if (
isA<DEShybrid<Type>>(blendedScheme))
88 indicator.correctBoundaryConditions();
93 bool Foam::functionObjects::blendingFactor::calcScheme()
95 typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
97 if (!foundObject<FieldType>(fieldName_,
false))
102 const FieldType&
field = lookupObject<FieldType>(fieldName_);
104 const word divScheme(
"div(" + phiName_ +
',' + fieldName_ +
')');
105 ITstream& its = mesh_.divScheme(divScheme);
109 tmp<fv::convectionScheme<Type>> tcs =
112 if (
isA<fv::boundedConvectionScheme<Type>>(tcs()))
114 const fv::boundedConvectionScheme<Type>& bcs =
115 refCast<const fv::boundedConvectionScheme<Type>>(tcs());
117 calcBlendingFactor(
field, bcs.scheme());
121 const fv::gaussConvectionScheme<Type>& gcs =
122 refCast<const fv::gaussConvectionScheme<Type>>(tcs());
124 calcBlendingFactor(
field, gcs);
word resultName_
Name of result field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Construct a volume field from a surface field using a combine operator.
#define WarningInFunction
Report a warning using Foam::Warning.
static tmp< convectionScheme< Type > > New(const fvMesh &mesh, const surfaceScalarField &faceFlux, Istream &schemeData)
Return a pointer to a new convectionScheme created on freestore.
tmp< GeometricField< Type, fvPatchField, volMesh > > cellReduce(const GeometricField< Type, fvsPatchField, surfaceMesh > &, const CombineOp &cop, const Type &nullValue=pTraits< Type >::zero)
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField