50 scalar maxRatio = 1 + coeff;
60 const label own = owner[facei];
61 const label nbr = neighbour[facei];
66 changedFaces.append(facei);
71 changedFaces.append(facei);
85 label facei =
patch.start() + patchFacei;
86 label own =
mesh.faceOwner()[facei];
88 changedFaces.append(facei);
94 changedFaces.shrink();
95 changedFacesInfo.shrink();
102 cellData[celli] =
field[celli];
109 td.maxRatio = maxRatio;
119 mesh.globalData().nTotalCells(),
125 field[celli] = cellData[celli].value();
128 field.correctBoundaryConditions();
137 const scalar alphaDiff,
139 const scalar alphaMin
144 DynamicList<label> changedFaces(
mesh.nFaces()/100 + 100);
145 DynamicList<smoothData> changedFacesInfo(changedFaces.size());
148 List<smoothData> cellData(
mesh.nCells());
152 cellData[celli] =
field[celli];
156 List<smoothData> faceData(
mesh.nFaces());
163 const label own = owner[facei];
164 const label nbr = neighbour[facei];
168 changedFaces.append(facei);
169 changedFacesInfo.append
179 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
185 label facei =
patch.start() + patchFacei;
186 label own =
mesh.faceOwner()[facei];
190 alpha.boundaryField()[patchi].patchNeighbourField()
193 if (
mag(
alpha[own] - alphapn[patchFacei]) > alphaDiff)
195 changedFaces.
append(facei);
196 changedFacesInfo.append(smoothData(
field[own]));
202 changedFaces.shrink();
203 changedFacesInfo.shrink();
205 smoothData::trackData td;
209 FaceCellWave<smoothData, smoothData::trackData> smoothData
217 smoothData.setFaceInfo(changedFaces, changedFacesInfo);
219 smoothData.iterate(nLayers);
223 field[celli] = cellData[celli].value();
226 field.correctBoundaryConditions();
235 const scalar alphaDiff
240 DynamicList<label> changedFaces(
mesh.nFaces()/100 + 100);
241 DynamicList<sweepData> changedFacesInfo(changedFaces.size());
244 List<sweepData> cellData(
mesh.nCells());
247 List<sweepData> faceData(
mesh.nFaces());
255 const label own = owner[facei];
256 const label nbr = neighbour[facei];
260 changedFaces.append(facei);
261 changedFacesInfo.append
271 const polyPatch&
patch =
mesh.boundaryMesh()[patchi];
277 label facei =
patch.start() + patchFacei;
278 label own =
mesh.faceOwner()[facei];
282 alpha.boundaryField()[patchi].patchNeighbourField()
285 if (
mag(
alpha[own] - alphapn[patchFacei]) > alphaDiff)
287 changedFaces.
append(facei);
288 changedFacesInfo.append
290 sweepData(
field[own], Cf[facei])
297 changedFaces.shrink();
298 changedFacesInfo.shrink();
301 FaceCellWave<sweepData> sweepData
308 sweepData.setFaceInfo(changedFaces, changedFacesInfo);
310 sweepData.iterate(nLayers);
314 if (cellData[celli].valid(sweepData.data()))
320 field.correctBoundaryConditions();
341 mesh.time().timeName(),
372 if (
alpha1[celli] < cutoff)
374 intvDotVapor.value() +=
375 alpha2[celli]*mDotSmear[celli]*Vol[celli];
377 else if (
alpha1[celli] > 1.0 - cutoff)
379 intvDotLiquid.value() +=
380 alpha1[celli]*mDotSmear[celli]*Vol[celli];
384 reduce(intvDotVapor.value(), sumOp<scalar>());
385 reduce(intvDotLiquid.value(), sumOp<scalar>());
393 if (intvDotVapor.value() > VSMALL)
395 Nv = intmSource0/intvDotVapor;
397 if (intvDotLiquid.value() > VSMALL)
399 Nl = intmSource0/intvDotLiquid;
405 if (
alpha1[celli] < cutoff)
407 mDotOut[celli] = Nv.value()*(1 -
alpha1[celli])*mDotSmear[celli];
409 else if (
alpha1[celli] > 1.0 - cutoff)
412 mDotOut[celli] = -Nl.value()*
alpha1[celli]*mDotSmear[celli];
fvMatrix< scalar > fvScalarMatrix
const word zeroGradientType
A zeroGradient patch field type.
void spread(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2, const scalar alphaMax=0.99, const scalar alphaMin=0.01)
Class used to pass additional data in.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void append(const T &val)
Append an element at the end of the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
void spreadSource(volScalarField &mDotOut, const volScalarField &mDotIn, const volScalarField &alpha1, const volScalarField &alpha2, const dimensionedScalar &D, const scalar cutoff)
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Calculate the matrix for the laplacian of the field.
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
const volScalarField & alpha2
const dimensionSet dimless
Dimensionless.
UList< label > labelUList
A UList of labels.
void smooth(volScalarField &field, const scalar coeff)
#define forAll(list, i)
Loop across all elements in list.
Helper class used by the fvc::smooth and fvc::spread functions.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
dimensionedScalar alphaMax("alphaMax", dimless/dimTime, laminarTransport)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< GeometricField< Type, faPatchField, areaMesh > > laplacian(const GeometricField< Type, faPatchField, areaMesh > &vf, const word &name)
Volume integrate volField creating a volField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Mesh data needed to do the Finite Volume discretisation.
const std::string patch
OpenFOAM patch number as a std::string.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
A special matrix type and solver, designed for finite volume solutions of scalar equations.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
Field< vector > vectorField
Specialisation of Field<T> for vector.
const dimensionedScalar & D
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A patch is a list of labels that address the faces in the global face list.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
Calculate the finiteVolume matrix for implicit and explicit sources.
static constexpr const zero Zero
Global zero (0)
const volScalarField & alpha1