39namespace reconstruction
49void Foam::reconstruction::gradAlpha::gradSurf(
const volScalarField&
phi)
52 leastSquareGrad<scalar> lsGrad(
"polyDegree1",mesh_.
geometricD());
66 DynamicField<vector> cellCentre(100);
67 DynamicField<scalar> phiValues(100);
78 for (
const label gblIdx : stencil[celli])
82 exchangeFields.getValue(mesh_.
C(), mapCC, gblIdx)
86 exchangeFields.getValue(
phi, mapPhi, gblIdx)
90 cellCentre -= mesh_.
C()[celli];
91 interfaceNormal_[i] = lsGrad.grad(cellCentre, phiValues);
115 interfaceNormal_(fvc::grad(
alpha1)),
116 isoFaceTol_(modelDict().getOrDefault<scalar>(
"isoFaceTol", 1
e-8)),
117 surfCellTol_(modelDict().getOrDefault<scalar>(
"surfCellTol", 1
e-8)),
118 sIterPLIC_(mesh_,surfCellTol_)
129 const bool uptodate = alreadyReconstructed(forceUpdate);
131 if (uptodate && !forceUpdate)
136 if (mesh_.topoChanging())
139 interfaceCell_.resize_nocopy(mesh_.nCells());
141 interfaceCell_ =
false;
143 interfaceLabels_.clear();
147 if (sIterPLIC_.isASurfaceCell(alpha1_[celli]))
149 interfaceCell_[celli] =
true;
150 interfaceLabels_.append(celli);
153 interfaceNormal_.resize(interfaceLabels_.size());
159 forAll(interfaceLabels_, i)
161 const label celli = interfaceLabels_[i];
162 if (
mag(interfaceNormal_[i]) == 0)
167 sIterPLIC_.vofCutCell
176 if (sIterPLIC_.cellStatus() == 0)
178 normal_[celli] = sIterPLIC_.surfaceArea();
179 centre_[celli] = sIterPLIC_.surfaceCentre();
180 if (
mag(normal_[celli]) == 0)
182 normal_[celli] =
Zero;
183 centre_[celli] =
Zero;
188 normal_[celli] =
Zero;
189 centre_[celli] =
Zero;
204 if (
mag(normal_[celli]) != 0)
206 vector n = normal_[celli]/
mag(normal_[celli]);
207 scalar cutValue = (centre_[celli] - mesh_.C()[celli]) & (
n);
214 alpha1_[celli] =
cutCell.VolumeOfFluid();
218 alpha1_.correctBoundaryConditions();
219 alpha1_.oldTime () = alpha1_;
220 alpha1_.oldTime().correctBoundaryConditions();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
const volScalarField & alpha1
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Class for cutting a cell, cellI, of an fvMesh, mesh_, at its intersection with an surface defined by ...
Service routines for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with a surface.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const volVectorField & C() const
Return cell centres as volVectorField.
const Vector< label > & geometricD() const
Return the vector of geometric directions in mesh.
Original code supplied by Henning Scheufler, DLR (2019)
boolList interfaceCell_
Is interface cell?
DynamicField< label > interfaceLabels_
List of cell labels that have an interface.
Reconstructs an interface (centre and normal vector) consisting of planes to match the internal fluid...
virtual void reconstruct(bool forceUpdate=true)
Reconstruct interface.
virtual void mapAlphaField() const
map VoF Field in case of refinement
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
const dimensionSet dimArea(sqr(dimLength))
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
static constexpr const zero Zero
Global zero (0)
#define addProfilingInFunction(name)
#define forAll(list, i)
Loop across all elements in list.