52 result[2*i + 1] = b[i];
121 namespace fvMeshStitchers
131 void Foam::fvMeshStitchers::moving::conformCorrectMeshPhi
140 if (isA<nonConformalFvPatch>(phiBf[nccPatchi].patch()))
143 refCast<const nonConformalFvPatch>(phiBf[nccPatchi].patch());
168 void Foam::fvMeshStitchers::moving::createNonConformalCorrectMeshPhiGeometry
181 const label origPatchi = origPatchIDs[i];
184 const label errorPatchi = errorPatchIDs[i];
186 polyFacesBf[errorPatchi] =
212 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
215 refCast<const nonConformalCoupledFvPatch>(fvp);
217 if (!nccFvp.
owner())
continue;
219 forAll(nccFvp, nccPatchFacei)
223 mesh().polyFacesBf()[nccPatchi][nccPatchFacei]
224 -
mesh().nInternalFaces()
238 const label meshEdgei =
241 forAll(
mesh().edgeFaces()[meshEdgei], edgeFacei)
243 const label facei =
mesh().edgeFaces()[meshEdgei][edgeFacei];
245 if (
mesh().isInternalFace(facei))
continue;
247 const label bFacei = facei -
mesh().nInternalFaces();
249 if (bFaceNSet[bFacei])
251 ownerOrigBoundaryEdgeNSet[ownerOrigBoundaryEdgei] += 1;
259 ownerOrigBoundaryEdgeNSet,
269 if (ownerOrigBoundaryEdgeNSet[ownerOrigBoundaryEdgei] < 2)
continue;
271 const label meshEdgei =
274 forAll(
mesh().edgeFaces()[meshEdgei], edgeFacei)
276 const label facei =
mesh().edgeFaces()[meshEdgei][edgeFacei];
278 set.insert(
mesh().faceOwner()[facei]);
280 if (facei <
mesh().nInternalFaces())
282 set.insert(
mesh().faceNeighbour()[facei]);
291 void Foam::fvMeshStitchers::moving::unconformInternalFaceCorrectMeshPhi
297 mesh().magSf().boundaryField();
305 boolList bFaceIsOwnerOrig(
mesh().nFaces() -
mesh().nInternalFaces(),
false);
311 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
314 refCast<const nonConformalCoupledFvPatch>(fvp);
316 if (!nccFvp.
owner())
continue;
318 forAll(nccFvp, nccPatchFacei)
323 bFaceIsOwnerOrig[bFacei] =
true;
324 bFaceNccMagSf[bFacei] += magSfBf[nccPatchi][nccPatchFacei];
352 if (
mesh().isInternalFace(facei))
continue;
354 const label bFacei = facei -
mesh().nInternalFaces();
356 bFaceSubRegion[bFacei] =
357 subMeshRegions[subMesh.
faceOwner()[subFacei]];
361 labelList subMeshRegionRefCells(subNRegions, -1);
366 forAll(subMeshRegions, subCelli)
368 subMeshRegionRefProcs[subMeshRegions[subCelli]] = proci;
372 forAll(subMeshRegions, subCelli)
376 subMeshRegionRefProcs[subMeshRegions[subCelli]] == proci
377 && subMeshRegionRefCells[subMeshRegions[subCelli]] == -1
380 subMeshRegionRefCells[subMeshRegions[subCelli]] = subCelli;
392 synchronisedBoundaryField<scalar>(phiBf,
true, 0, 1)
396 scalarList regionPhiError(subNRegions, scalar(0));
402 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
405 refCast<const nonConformalCoupledFvPatch>(fvp);
407 if (!nccFvp.
owner())
continue;
409 forAll(nccFvp, nccPatchFacei)
411 const label subRegioni =
414 mesh().polyFacesBf()[nccPatchi][nccPatchFacei]
415 -
mesh().nInternalFaces()
418 regionPhiError[subRegioni] +=
419 syncPhiBf[nccPatchi][nccPatchFacei]
420 - phiBf[nccPatchi][nccPatchFacei];
422 regionMagSf[subRegioni] +=
423 magSfBf[nccPatchi][nccPatchFacei];
435 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
438 refCast<const nonConformalCoupledFvPatch>(fvp);
440 if (!nccFvp.
owner())
continue;
442 forAll(nccFvp, nccPatchFacei)
444 const label subRegioni =
447 mesh().polyFacesBf()[nccPatchi][nccPatchFacei]
448 -
mesh().nInternalFaces()
451 phiBf[nccPatchi][nccPatchFacei] =
452 syncPhiBf[nccPatchi][nccPatchFacei]
453 - magSfBf[nccPatchi][nccPatchFacei]
454 /regionMagSf[subRegioni]
455 *regionPhiError[subRegioni];
482 subPhi[subFacei] = phi[facei];
484 forAll(subPhi.boundaryField(), subPatchi)
486 const fvPatch& subFvp = subPhi.boundaryField()[subPatchi].
patch();
488 forAll(subPhi.boundaryField()[subPatchi], subPatchFacei)
490 const label subFacei = subFvp.
start() + subPatchFacei;
493 if (
mesh().isInternalFace(facei))
497 subPhi.boundaryFieldRef()[subPatchi][subPatchFacei] =
502 const label bFacei = facei -
mesh().nInternalFaces();
505 mesh().polyBFacePatches()[bFacei];
507 mesh().polyBFacePatchFaces()[bFacei];
511 subPhi.boundaryFieldRef()[subPatchi][subPatchFacei] +=
512 phiBf[patches[i]][patchFaces[i]];
522 - (subV - subV0)/subV
533 MeshPhiPatchTypes[
patchi] =
535 && !isA<internalFvPatch>(subFvp)
564 forAll(subMeshRegionRefCells, i)
602 subChangedPatchAndFaces.
clear();
603 subChangedFacePci.
clear();
608 forAll(subFvp, subPatchFacei)
610 const label subFacei = subFvp.
start() + subPatchFacei;
612 const label bFacei = facei -
mesh().nInternalFaces();
614 if (bFacei >= 0 && bFaceIsOwnerOrig[bFacei])
616 subChangedPatchAndFaces.append({subPatchi, subPatchFacei});
633 preWave.
setFaceInfo(subChangedPatchAndFaces, subChangedFacePci);
634 const label nWaveLayers =
670 for (
label waveLayeri = nWaveLayers - 1; waveLayeri >= 0; waveLayeri --)
673 const label faceLayeri = (waveLayeri + 1)*2;
676 subChangedPatchAndFaces.clear();
677 subChangedFaceCi.
clear();
678 forAll(subInternalFacePci, subFacei)
680 if (subInternalFacePci[subFacei].
layer() == faceLayeri)
682 subChangedPatchAndFaces.append({-1, subFacei});
685 subInternalFaceCi[subFacei].valid(td)
686 ? subInternalFaceCi[subFacei]
691 forAll(subPatchFacePci, subPatchi)
693 forAll(subPatchFacePci[subPatchi], subPatchFacei)
697 subPatchFacePci[subPatchi][subPatchFacei].
layer()
701 subChangedPatchAndFaces.append({subPatchi, subPatchFacei});
704 subPatchFaceCi[subPatchi][subPatchFacei].valid(td)
705 ? subPatchFaceCi[subPatchi][subPatchFacei]
721 wave.
setFaceInfo(subChangedPatchAndFaces, subChangedFaceCi);
726 forAll(subInternalFaceCi, subFacei)
728 subDeltaPhi.primitiveFieldRef()[subFacei] +=
729 subInternalFaceCi[subFacei].deltaPhi();
731 forAll(subPatchFacePci, subPatchi)
733 forAll(subPatchFacePci[subPatchi], subPatchFacei)
735 subDeltaPhi.boundaryFieldRef()[subPatchi][subPatchFacei] +=
736 subPatchFaceCi[subPatchi][subPatchFacei].deltaPhi();
745 phi[subsetter.
faceMap()[subFacei]] =
746 subPhi[subFacei] + subDeltaPhi[subFacei];
761 if (patchi == -1)
continue;
766 const bool coupled = subFvp.
coupled();
777 deltaPhiBf[
patchi][patchFacei] =
778 subPhi.boundaryField()[subPatchi][subPatchFacei]
779 + subDeltaPhi.boundaryField()[subPatchi][subPatchFacei]
780 - phiBf[
patchi][patchFacei];
784 deltaPhiBf[
patchi][patchFacei] =
785 subDeltaPhi.boundaryField()[subPatchi][subPatchFacei];
795 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
798 refCast<const nonConformalCoupledFvPatch>(fvp);
800 if (!nccFvp.
owner())
continue;
805 forAll(nccFvp, nccPatchFacei)
810 const label origPatchFacei =
813 const scalar deltaPhi =
814 magSfBf[nccPatchi][nccPatchFacei]
815 /bFaceNccMagSf[bFacei]
816 *deltaPhiBf[origPatchi][origPatchFacei];
818 deltaPhiBf[nccPatchi][nccPatchFacei] = deltaPhi;
825 if (!isA<nonConformalCoupledFvPatch>(fvp))
continue;
828 refCast<const nonConformalCoupledFvPatch>(fvp);
830 if (!nccFvp.
owner())
continue;
835 forAll(nccFvp, nccPatchFacei)
837 const label origPatchFacei =
840 deltaPhiBf[origPatchi][origPatchFacei] = 0;
849 void Foam::fvMeshStitchers::moving::unconformErrorFaceCorrectMeshPhi
889 if (isA<nonConformalCoupledFvPatch>(fvp))
892 refCast<const nonConformalCoupledFvPatch>(fvp);
899 forAll(nccFvp, nccPatchFacei)
901 const label origPatchFacei =
904 const label errorPatchFacei0 = 2*origPatchFacei;
905 const label errorPatchFacei1 = 2*origPatchFacei + 1;
911 phip[errorPatchFacei0] +=
912 phiErrorbs[i][nccPatchi][nccPatchFacei]/2;
913 phip[errorPatchFacei1] +=
914 phiErrorbs[i][nccPatchi][nccPatchFacei]/2;
933 tnccMeshMagUf.
ref().boundaryFieldRef();
938 if (isA<nonConformalCoupledFvPatch>(fvp))
941 refCast<const nonConformalCoupledFvPatch>(fvp);
945 forAll(nccFvp, nccPatchFacei)
947 const label origPatchFacei =
952 origFvp.patch().faceCentres()[origPatchFacei];
954 origFvp.patch()[origPatchFacei]
957 tnccMeshMagUfb[nccPatchi][nccPatchFacei] =
958 mag(origC - origC0)/
mesh().time().deltaTValue();
971 conformalNccBoundaryField<scalar>(tnccMeshMagUfb)
973 tnccMeshMagUf.
clear();
980 const label origPatchi = origPatchIDs[i];
983 const label errorPatchi = errorPatchIDs[i];
985 forAll(origPp, origPatchFacei)
987 const label errorPatchFacei0 = 2*origPatchFacei;
988 const label errorPatchFacei1 = 2*origPatchFacei + 1;
993 /
max(meshMagUfb[origPatchi][origPatchFacei], vSmall);
997 Sfp[errorPatchFacei0] += errorSf;
998 Sfp[errorPatchFacei1] -= errorSf;
1012 const label origPatchi = origPatchIDs[i];
1018 isA<movingWallVelocityFvPatchVectorField>(origUp)
1019 || isA<movingWallSlipVelocityFvPatchVectorField>(origUp)
1022 const label errorPatchi = errorPatchIDs[i];
1039 void Foam::fvMeshStitchers::moving::unconformCorrectMeshPhi
1041 const SurfaceFieldBoundary<label>& polyFacesBf,
1056 mesh().unconform(polyFacesBf, SfSf, CfSf);
1057 resizeFieldPatchFields(polyFacesBf, phi);
1064 nonConformalBoundaryField<scalar>
1085 unconformInternalFaceCorrectMeshPhi(phi);
1090 unconformErrorFaceCorrectMeshPhi(polyFacesBf, SfSf, CfSf, phi);
const fvPatchList & patches
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
dimensionedScalar sign(const dimensionedScalar &ds)
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
#define forAll(list, i)
Loop across all elements in list.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const dimensionSet dimArea
void clear() const
If object pointer points to valid object:
const fvSchemes & schemes() const
Return the fvSchemes.
Tracking data. Mostly just a collection of references to the.
bool set(const label) const
Is element set.
List< Type > repeat(const UList< Type > &a, const UList< Type > &b)
void surfaceIntegrate(Field< Type > &ivf, const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
virtual label start() const
Return start label of this patch in the polyMesh face list.
label nInternalFaces() const
const Boundary & boundaryField() const
Return const-reference to the boundary field.
T & ref() const
Return non-const reference or generate a fatal error.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
friend bool operator!=(const layerAndWeight &a, const layerAndWeight &b)
void size(const label)
Override size to be inconsistent with allocated storage.
void setReference(const label celli, const Type &value, const bool forceReference=false)
Set reference level for solution.
Mesh manipulator that uses the intersection provided by the cyclic non-conformal poly patches to crea...
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static tmp< GeometricField< scalar, fvsPatchField, surfaceMesh > > New(const word &name, const Internal &, const PtrList< fvsPatchField< scalar >> &)
Return a temporary field constructed from name,.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m K].
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
label nTotalCells() const
Return total number of cells in decomposed mesh.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Calculate the matrix for the laplacian of the field.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
void setFluxRequired(const word &name) const
const labelList & faceFlipMap() const
Return face map with sign to encode flipped faces.
label nOldTimes() const
Return the number of old time fields stored.
wordList types() const
Return a list of patch types.
const Time & time() const
Return the top-level database.
Macros for easy insertion into run-time selection tables.
const labelList & faceMap() const
Return face map.
static const layerAndWeight max
static bool constraintType(const word &pt)
Return true if the given type is a constraint type.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
const labelList & patchMap() const
Return patch map.
const fvMesh & subMesh() const
Return reference to subset mesh.
const dimensionSet dimTime
friend Istream & operator>>(Istream &is, layerAndWeight &l)
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
moving(fvMesh &)
Construct from fvMesh.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static const DimensionedField< Type, GeoMesh > & null()
Return a null DimensionedField.
This boundary condition provides a slip velocity condition for cases with moving walls.
void clear()
Clear the list, i.e. set size to zero.
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
const polyPatch & patch() const
Return the polyPatch.
static const layerAndWeight min
virtual ~moving()
Destructor.
friend Ostream & operator<<(Ostream &os, const layerAndWeight &l)
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
virtual const labelList & faceOwner() const
Return face owner.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
const globalMeshData & globalData() const
Return parallel info.
static const label labelMax
faceListList boundary(nPatches)
tmp< GeometricBoundaryField > boundaryNeighbourField() const
Return BoundaryField of the values on the other side of couples.
const Field< PointType > & faceNormals() const
Return face normals for patch.
An STL-conforming hash table.
virtual label size() const
Return size.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
void setFaceInfo(const List< labelPair > &changedPatchAndFaces, const List< Type > &changedFacesInfo)
Set initial changed faces.
const dimensionSet dimVelocity
defineTypeNameAndDebug(combustionModel, 0)
static nonConformalBoundary & New(polyMesh &mesh)
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
label size() const
Return the number of elements in the UPtrList.
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
Map volume field.
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
Boundary & boundaryFieldRef()
Return a reference to the boundary field.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< fvMatrix< Type > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Operator to apply a binary operation to a pair of lists.
label nRegions() const
Return total number of regions.
const dimensionSet dimVolume
dimensioned< scalar > mag(const dimensioned< Type > &)
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > flux() const
Return the face-flux field from the matrix.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
label size() const
Return the number of elements in the UList.
void clear()
Clear the addressed list, i.e. set the size to zero.
friend bool operator==(const layerAndWeight &a, const layerAndWeight &b)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
virtual bool coupled() const
Return true if this patch is coupled.
label wave(const fvMesh &mesh, const List< labelPair > &changedPatchAndFaces, const label nCorrections, GeometricField< scalar, PatchField, GeoMesh > &distance, TrackingData &td, GeometricField< DataType, PatchField, GeoMesh > &... data)
Wave distance (and maybe additional) data from faces. If nCorrections is.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
void setLargeCellSubset(const labelList ®ion, const label currentRegion, const label patchID=-1, const bool syncCouples=true)
Set the subset from all cells with region == currentRegion.
const surfaceScalarField & deltaCoeffs() const
Return reference to cell-centre difference coefficients.
dimensionedScalar deltaT() const
Return time step.
A zero-sized class without any storage. Used, for example, in HashSet.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const vectorField::subField faceCentres() const
Return face centres.