35 #include "surfaceInterpolate.H" 53 surfaceAlignedSBRStressFvMotionSolver,
61 Foam::surfaceAlignedSBRStressFvMotionSolver::
62 surfaceAlignedSBRStressFvMotionSolver
69 surfaceNames_(coeffDict().
lookup(
"surfaces")),
70 surfaceMesh_(surfaceNames_.size()),
84 maxAng_(coeffDict().getOrDefault<scalar>(
"maxAng", 80)),
85 minAng_(coeffDict().getOrDefault<scalar>(
"minAng", 20)),
86 accFactor_(coeffDict().getOrDefault<scalar>(
"accFactor", 1)),
87 smoothFactor_(coeffDict().getOrDefault<scalar>(
"smoothFactor", 0.9)),
88 nNonOrthogonalCorr_(coeffDict().
get<label>(
"nNonOrthogonalCorr")),
89 pointDisplacement_(pointDisplacement()),
103 minSigmaDiff_(coeffDict().getOrDefault<scalar>(
"minSigmaDiff", 1
e-4))
137 void Foam::surfaceAlignedSBRStressFvMotionSolver::calculateCellRot()
139 cellRot_.primitiveFieldRef() =
Zero;
140 pointDisplacement_.primitiveFieldRef() =
Zero;
147 const polyBoundaryMesh&
pbm = fvMesh_.boundaryMesh();
149 for (label faceI = 0; faceI < fvMesh_.nInternalFaces(); faceI++)
151 start[faceI] = Cc[fvMesh_.faceOwner()[faceI]];
152 end[faceI] = Cc[fvMesh_.faceNeighbour()[faceI]];
155 DynamicList<label> hitCells;
157 forAll(surfaceMesh_, surfi)
159 List<pointIndexHit> hit(start.size());
160 surfaceMesh_[surfi].findLineAny(start,
end, hit);
164 const vectorField& nf = surfaceMesh_[surfi].faceNormals();
170 DynamicList<label> cellsHit;
174 if (hit[facei].hit())
177 const vector& hitPoint = hit[facei].point();
179 if (fvMesh_.isInternalFace(facei))
181 const point& ownCc = Cc[fvMesh_.faceOwner()[facei]];
182 const point& nbrCc = Cc[fvMesh_.faceNeighbour()[facei]];
184 if (hitPoint.distSqr(ownCc) < hitPoint.distSqr(nbrCc))
186 rotCellId = fvMesh_.faceOwner()[facei];
190 rotCellId = fvMesh_.faceNeighbour()[facei];
196 if (isA<processorPolyPatch>(
pbm[patchi]))
198 const point& ownCc = Cc[fvMesh_.faceOwner()[facei]];
200 const vector cCentreOne = ownCc - hitPoint;
203 refCast<const processorPolyPatch>(
pbm[patchi])
204 .neighbFaceCellCentres()[facei];
206 const vector cCentreTwo = nbrCc - hitPoint;
208 if (cCentreOne < cCentreTwo)
210 rotCellId = fvMesh_.faceOwner()[facei];
223 const labelList& cFaces = fvMesh_.cells()[rotCellId];
225 scalar cosMax(-GREAT);
230 mag(nf[hit[facei].index()] & nSfMesh[cFaces[
k]]);
249 cellRot_[rotCellId] =
250 nSfMesh[
faceId]^nf[hit[facei].index()];
252 const scalar magRot =
mag(cellRot_[rotCellId]);
256 const scalar theta =
::asin(magRot);
257 quaternion q(cellRot_[rotCellId]/magRot, theta);
260 fvMesh_.cellPoints(rotCellId);
264 const label pointId = cPoints[j];
266 pointsCount[pointId]++;
269 fvMesh_.points()[pointId];
271 pointDisplacement_[pointId] +=
272 (
R & (pointPos - hitPoint))
273 - (pointPos - hitPoint);
281 vectorField& pd = pointDisplacement_.primitiveFieldRef();
285 point /= pointsCount[pointi];
295 this->movePoints(fvMesh_.points());
299 diffusivity().correct();
310 cellMotionBoundaryTypes<vector>
312 pointDisplacement().boundaryField()
315 auto& Ud = tUd.ref();
320 pointMVCWeight pointInter(fvMesh_,
C[i], i);
321 Ud[i] = pointInter.interpolate(pointDisplacement_);
333 Ud.replace(vector::X, Udx);
335 Ud.replace(vector::Z, Udz);
346 auto&
mu = tmu.ref();
349 mu.primitiveFieldRef() = (1.0/V);
360 const scalar diffSigmaD =
361 gSum(
mag(sigmaD_.oldTime().primitiveField()))
362 -
gSum(
mag(magNewSigmaD.primitiveField()));
364 if (
mag(diffSigmaD) > minSigmaDiff_)
366 sigmaD_ = magNewSigmaD;
373 pointDisplacement_.boundaryFieldRef().updateCoeffs();
379 for (
int nonOrth=0; nonOrth<=nNonOrthogonalCorr_; nonOrth++)
387 "laplacian(diffusivity,cellDisplacement)" 407 DEqn.solveSegregatedOrCoupled();
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
List< scalar > scalarList
List of scalar.
void correct(GeometricField< Type, PatchField, GeoMesh > &field)
Apply correction to field.
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
const polyBoundaryMesh & pbm
Field< label > labelField
Specialisation of Field<T> for label.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> grad(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
virtual void solve()
Solve for motion.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
GeometricField< tensor, fvPatchField, volMesh > volTensorField
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Unit conversion functions.
const dimensionSet dimViscosity
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Calculate the matrix for the laplacian of the field.
label k
Boltzmann constant.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
List< vector > vectorList
List of vector.
const Time & time() const
Return the top-level database.
Lookup type of boundary radiation properties.
GeometricField< vector, fvPatchField, volMesh > volVectorField
dimensionedScalar asin(const dimensionedScalar &ds)
Macros for easy insertion into run-time selection tables.
dimensionedSymmTensor twoSymm(const dimensionedSymmTensor &dt)
void smooth(volScalarField &field, const scalar coeff)
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
IOoject and searching on triSurface.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar cos(const dimensionedScalar &ds)
static const Identity< scalar > I
dimensionedScalar lambda("lambda", dimTime/sqr(dimLength), laminarTransport)
dimensionedScalar tr(const dimensionedSphericalTensor &dt)
const fvMesh & mesh() const
Return reference to the fvMesh to be moved.
label whichPatch(const label meshFacei) const
Return patch index for a given mesh face index. Uses binary search.
static tmp< GeometricField< vector, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< vector >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
Calculate the divergence of the given field.
void constrain(fvMatrix< Type > &eqn)
Apply constraints to equation.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const word & constant() const noexcept
Return constant name.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
defineTypeNameAndDebug(combustionModel, 0)
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.
const dimensionedScalar mu
Atomic mass unit.
vector point
Point is a vector.
#define R(A, B, C, D, E, F, K, M)
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
PtrList< volScalarField > & Y
fvMatrix< vector > fvVectorMatrix
~surfaceAlignedSBRStressFvMotionSolver()
Destructor.
Mesh motion solver for an fvMesh. Based on solving the cell-centre solid-body rotation stress equatio...
Field< vector > vectorField
Specialisation of Field<T> for vector.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
static options & New(const fvMesh &mesh)
Construct fvOptions and register to database if not present.
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Provides functions smooth spread and sweep which use the FaceCellWave algorithm to smooth and redistr...
Do not request registration (bool: false)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
static constexpr const zero Zero
Global zero (0)