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);
102 cellData[celli] =
field[celli];
109 td.maxRatio = maxRatio;
119 mesh.globalData().nTotalCells(),
125 field[celli] = cellData[celli].value();
128 field.correctBoundaryConditions();
134 volScalarField&
field,
135 const volScalarField&
alpha,
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);
223 field[celli] = cellData[celli].value();
226 field.correctBoundaryConditions();
232 volScalarField&
field,
233 const volScalarField&
alpha,
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());
249 const labelUList& owner =
mesh.owner();
250 const labelUList& neighbour =
mesh.neighbour();
251 const vectorField& Cf =
mesh.faceCentres();
255 const label own = owner[facei];
256 const label nbr = neighbour[facei];
260 changedFaces.append(facei);
261 changedFacesInfo.append
263 sweepData(max(
field[own],
field[nbr]), Cf[facei])
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();
326 volScalarField& mDotOut,
327 const volScalarField& mDotIn,
328 const volScalarField&
alpha1,
329 const volScalarField&
alpha2,
330 const dimensionedScalar&
D,
341 mesh.time().timeName(),
348 fvPatchFieldBase::zeroGradientType()
354 fvm::Sp(scalar(1), mDotSmear)
355 - fvm::laplacian(
D, mDotSmear)
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];
const volScalarField & alpha1
const volScalarField & alpha2
const dimensionSet & dimensions() const noexcept
Return dimensions.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
void setFaceInfo(const label facei, const Type &faceInfo)
Set single initial changed face.
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label n)
Older name for setAddressableSize.
const Type & value() const noexcept
Return const reference to value.
SolverPerformance< Type > solve(const dictionary &)
Solve returning the solution statistics.
Mesh data needed to do the Finite Volume discretisation.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
A patch is a list of labels that address the faces in the global face list.
Class used to pass additional data in.
Helper class used by the fvc::smooth and fvc::spread functions.
Helper class used by fvc::sweep function.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
Volume integrate volField creating a volField.
Calculate the matrix for the laplacian of the field.
Calculate the finiteVolume matrix for implicit and explicit sources.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
const std::string patch
OpenFOAM patch number as a std::string.
void sweep(volScalarField &field, const volScalarField &alpha, const label nLayers, const scalar alphaDiff=0.2)
void spreadSource(volScalarField &mDotOut, const volScalarField &mDotIn, const volScalarField &alpha1, const volScalarField &alpha2, const dimensionedScalar &D, const scalar cutoff)
void smooth(volScalarField &field, const scalar coeff)
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)
dimensioned< Type > domainIntegrate(const GeometricField< Type, fvPatchField, volMesh > &vf)
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
zeroField Sp(const Foam::zero, const GeometricField< Type, fvPatchField, volMesh > &)
A no-op source.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const dimensionSet dimless
Dimensionless.
fvMatrix< scalar > fvScalarMatrix
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
UList< label > labelUList
A UList of labels.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
const dimensionedScalar & D
dimensionedScalar alphaMax("alphaMax", dimless/dimTime, laminarTransport)
#define forAll(list, i)
Loop across all elements in list.