Compare commits
4 Commits
feature-su
...
rpmbuild-2
| Author | SHA1 | Date | |
|---|---|---|---|
| f00230dfa9 | |||
| 0bb0c1db74 | |||
| 535a4fccb4 | |||
| e1b04cb6a7 |
@ -1,2 +1,2 @@
|
||||
api=2412
|
||||
patch=0
|
||||
patch=250528
|
||||
|
||||
@ -183,7 +183,8 @@ void Foam::zoneDistribute::setUpCommforZone
|
||||
Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
|
||||
(
|
||||
const label celli,
|
||||
const label globalIdx
|
||||
const label globalIdx,
|
||||
const vector globalIdxCellCentre
|
||||
) const
|
||||
{
|
||||
// Initialise cyclic patch label list
|
||||
@ -197,26 +198,26 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
|
||||
|
||||
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
|
||||
|
||||
// Making list of cyclic patches to which celli belongs
|
||||
List<label> celliCyclicPatches;
|
||||
forAll(bMesh, patchi)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(bMesh[patchi]))
|
||||
{
|
||||
// Note: Probably not efficient due to use of found(celli) but
|
||||
// typically only used for very few cells (interface cells and their
|
||||
// point neighbours on cyclic boundaries).
|
||||
if (bMesh[patchi].faceCells().found(celli))
|
||||
{
|
||||
celliCyclicPatches.append(patchi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// So celli belongs to at least one cyclic patch.
|
||||
// Let us figure out which.
|
||||
if (globalNumbering_.isLocal(globalIdx)) // celli and globalIdx on same proc
|
||||
{
|
||||
// Making list of cyclic patches to which celli belongs
|
||||
List<label> celliCyclicPatches;
|
||||
forAll(bMesh, patchi)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(bMesh[patchi]))
|
||||
{
|
||||
// Note: Probably not efficient due to use of found(celli) but
|
||||
// typically only used for very cells (interface cells and their
|
||||
// point neighbours on cyclic boundaries).
|
||||
if (bMesh[patchi].faceCells().found(celli))
|
||||
{
|
||||
celliCyclicPatches.append(patchi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all local point neighbor cells of celli, i.e. all point
|
||||
// neighbours that are not on the other side of a cyclic patch.
|
||||
List<label> localPointNeiCells(0);
|
||||
@ -243,14 +244,14 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
|
||||
{
|
||||
for (const label patchi : celliCyclicPatches)
|
||||
{
|
||||
// find the corresponding cyclic neighbor patch ID
|
||||
// Find the corresponding cyclic neighbor patch ID
|
||||
const cyclicPolyPatch& cpp =
|
||||
static_cast<const cyclicPolyPatch&>(bMesh[patchi]);
|
||||
|
||||
const label neiPatch = cpp.neighbPatchID();
|
||||
|
||||
// Check if the cell globalIdx is on neiPatch.
|
||||
// If it is, append neiPatch to list of
|
||||
// If it is, append neiPatch to list of patches to return
|
||||
if (bMesh[neiPatch].faceCells().found(localIdx))
|
||||
{
|
||||
patches.append(neiPatch);
|
||||
@ -267,75 +268,71 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
|
||||
}
|
||||
else // celli and globalIdx on differet processors
|
||||
{
|
||||
// Note: The following is needed if a celli is located at the interface
|
||||
// (plicRDF), on a cyclic patch and a processor patch. In this case
|
||||
// globalIdx may be on a different processor, but requires the
|
||||
// transformation from a cyclic patch on the processor of celli.
|
||||
List<label> cyclicID(3, -1);
|
||||
List<vector> separationVectors(3, vector(0,0,0));
|
||||
scalar distance = GREAT;
|
||||
|
||||
const List<label>& faces = mesh_.cells()[celli];
|
||||
|
||||
// Loop over all faces of celli and find cyclic patches
|
||||
for (const label facei : faces)
|
||||
forAll(celliCyclicPatches, cID)
|
||||
{
|
||||
if (mesh_.isInternalFace(facei)) continue;
|
||||
cyclicID[cID] = celliCyclicPatches[cID];
|
||||
|
||||
const label patchi = bMesh.whichPatch(facei);
|
||||
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(bMesh[patchi]);
|
||||
const label& patchI = celliCyclicPatches[cID];
|
||||
const cyclicPolyPatch& cpp =
|
||||
static_cast<const cyclicPolyPatch&>(bMesh[patchI]);
|
||||
|
||||
if (cpp)
|
||||
if(cpp.transform() == coupledPolyPatch::transformType::ROTATIONAL)
|
||||
{
|
||||
// Get the neighbor cell across the cyclic face
|
||||
const label cycNeiPatch = cpp->neighbPatchID();
|
||||
const label cycNeiCell =
|
||||
bMesh[cycNeiPatch].faceCells()[facei - cpp->start()];
|
||||
const List<label>& cycNeiCellFaces = mesh_.cells()[cycNeiCell];
|
||||
FatalErrorInFunction
|
||||
<< "Rotational cyclic patches are not supported in parallel.\n"
|
||||
<< "Try to decompose the domain so that the rotational cyclic patch "
|
||||
<< "is not split in between processors."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
cpp.neighbPatch().transformPosition(separationVectors[cID], 0);
|
||||
}
|
||||
|
||||
// Loop over all the faces of the neighbor cell
|
||||
for (const label cycNeiCellFace : cycNeiCellFaces)
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
for(int k = 0; k < 2; k++)
|
||||
{
|
||||
if (mesh_.isInternalFace(cycNeiCellFace))
|
||||
vector separation = i*separationVectors[0]
|
||||
+ j*separationVectors[1]
|
||||
+ k*separationVectors[2];
|
||||
|
||||
scalar testDistance = mag
|
||||
(
|
||||
(globalIdxCellCentre - separation)
|
||||
-
|
||||
mesh_.C()[celli]
|
||||
);
|
||||
if(debug) Info << "testDistance " << testDistance << endl;
|
||||
|
||||
if( testDistance < distance )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
distance = testDistance;
|
||||
patches = List<label>(0);
|
||||
List<label> applyCyclic({i,j,k});
|
||||
|
||||
// Check if the neighbor cell has processor patches
|
||||
const label neiPatch = bMesh.whichPatch(cycNeiCellFace);
|
||||
const processorPolyPatch* ppp =
|
||||
isA<processorPolyPatch>(bMesh[neiPatch]);
|
||||
if(debug) Info << "distance " << distance << endl;
|
||||
if(debug) Info << "separation " << separation << endl;
|
||||
if(debug) Info << "applyCyclic " << applyCyclic << endl;
|
||||
|
||||
if (ppp)
|
||||
{
|
||||
// Avoid duplicate entries
|
||||
if (patches.found(cycNeiPatch))
|
||||
for(int n = 0; n < 3; n++)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Since we can not access any information on globalIdx
|
||||
// we use the cell centre map from the stencil to
|
||||
// identify the cell.
|
||||
const label localFaceID = cycNeiCellFace - ppp->start();
|
||||
const vector neiCentre =
|
||||
ppp->neighbFaceCellCentres()[localFaceID];
|
||||
|
||||
forAll(cyclicCentres_()[celli], k)
|
||||
{
|
||||
if
|
||||
(
|
||||
(
|
||||
mag(cyclicCentres_()[celli][k] - neiCentre)
|
||||
< 100*SMALL
|
||||
)
|
||||
&& (stencil_[celli][k] == globalIdx)
|
||||
)
|
||||
if(cyclicID[n] != -1 && applyCyclic[n] == 1)
|
||||
{
|
||||
patches.append(cycNeiPatch);
|
||||
// Here an alternative might be to append patchi
|
||||
// and do:
|
||||
// cpp.transformPosition()
|
||||
// instead of
|
||||
// cpp.neighbPatch().transformPosition()
|
||||
// in getValue()
|
||||
const cyclicPolyPatch& cpp =
|
||||
static_cast<const cyclicPolyPatch&>
|
||||
(
|
||||
bMesh[cyclicID[n]]
|
||||
);
|
||||
if(debug)
|
||||
{
|
||||
Info << "cpp.name() " << cpp.name() << endl;
|
||||
}
|
||||
patches.append(cpp.neighbPatchID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ public:
|
||||
|
||||
//- Finds and returns list of all cyclic patch labels to which celli's
|
||||
// point neighbour cell, globalIdx, belongs. celli and globalIdx touch
|
||||
// in at least one point on these patces. globalIdx typically belongs
|
||||
// in at least one point on these patches. globalIdx typically belongs
|
||||
// to stencil_[celli]. The returned label list is used to transform
|
||||
// positions across cyclic boundaries e.g. to be able to calculate
|
||||
// distances between cell centres and interface centres in plicRDF
|
||||
@ -194,7 +194,8 @@ public:
|
||||
List<label> getCyclicPatches
|
||||
(
|
||||
const label celli,
|
||||
const label globalIdx
|
||||
const label globalIdx,
|
||||
const vector globalIdxCellCentre
|
||||
) const;
|
||||
|
||||
//- Gives patchNumber and patchFaceNumber for a given
|
||||
|
||||
@ -174,7 +174,12 @@ Foam::Map<Foam::Field<Type>> Foam::zoneDistribute::getPositionFields
|
||||
List<label> cyclicPatches(0);
|
||||
if(checkTransformation)
|
||||
{
|
||||
cyclicPatches = getCyclicPatches(celli, gblIdx);
|
||||
cyclicPatches = getCyclicPatches
|
||||
(
|
||||
celli,
|
||||
gblIdx,
|
||||
getValue(phi, neiValues, gblIdx)
|
||||
);
|
||||
}
|
||||
|
||||
tmpField.append
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2007-2023 PCOpt/NTUA
|
||||
Copyright (C) 2013-2023 FOSS GP
|
||||
Copyright (C) 2007-2025 PCOpt/NTUA
|
||||
Copyright (C) 2013-2025 FOSS GP
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -118,11 +118,11 @@ scalar objectiveUniformityCellZone::J()
|
||||
const volVectorField& U = vars_.UInst();
|
||||
const scalarField& V = mesh_.V().field();
|
||||
|
||||
for (const label zI : zones_)
|
||||
forAll(zones_, zI)
|
||||
{
|
||||
const cellZone& zoneI = mesh_.cellZones()[zI];
|
||||
scalarField VZone(V, zoneI);
|
||||
vectorField UZone(U.primitiveField(), zoneI);
|
||||
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
|
||||
scalarField VZone(V, cz);
|
||||
vectorField UZone(U.primitiveField(), cz);
|
||||
volZone_[zI] = gSum(VZone);
|
||||
UMean_[zI] = gSum(UZone*VZone)/volZone_[zI];
|
||||
UVar_[zI] = gSum(magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];
|
||||
@ -138,10 +138,10 @@ void objectiveUniformityCellZone::update_dJdv()
|
||||
{
|
||||
const volVectorField& U = vars_.U();
|
||||
|
||||
for (const label zI : zones_)
|
||||
forAll(zones_, zI)
|
||||
{
|
||||
const cellZone& zoneI = mesh_.cellZones()[zI];
|
||||
for (const label cellI : zoneI)
|
||||
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
|
||||
for (const label cellI : cz)
|
||||
{
|
||||
dJdvPtr_()[cellI] = (U[cellI] - UMean_[zI])/volZone_[zI];
|
||||
}
|
||||
@ -154,10 +154,10 @@ void objectiveUniformityCellZone::update_divDxDbMultiplier()
|
||||
volScalarField& divDxDbMult = divDxDbMultPtr_();
|
||||
const volVectorField& U = vars_.U();
|
||||
|
||||
for (const label zI : zones_)
|
||||
forAll(zones_, zI)
|
||||
{
|
||||
const cellZone& zoneI = mesh_.cellZones()[zI];
|
||||
for (const label cellI : zoneI)
|
||||
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
|
||||
for (const label cellI : cz)
|
||||
{
|
||||
divDxDbMult[cellI] =
|
||||
0.5*(magSqr(U[cellI] - UMean_[zI]) - UVar_[zI])/volZone_[zI];
|
||||
|
||||
@ -260,7 +260,7 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
|
||||
const labelListList& stencil = distribute.getStencil();
|
||||
|
||||
|
||||
forAll(nextToInterface,celli)
|
||||
forAll(nextToInterface, celli)
|
||||
{
|
||||
if (nextToInterface[celli])
|
||||
{
|
||||
@ -289,7 +289,17 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
|
||||
centre,
|
||||
mapCentres,
|
||||
gblIdx,
|
||||
distribute.getCyclicPatches(celli, gblIdx)
|
||||
distribute.getCyclicPatches
|
||||
(
|
||||
celli,
|
||||
gblIdx,
|
||||
distribute.getValue
|
||||
(
|
||||
centre,
|
||||
mapCentres,
|
||||
gblIdx
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
vector distanceToIntSeg(c - p);
|
||||
@ -341,7 +351,12 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
|
||||
forAll(stencil[pCellI], j)
|
||||
{
|
||||
const label gblIdx = stencil[pCellI][j];
|
||||
vector n = -distribute.getValue(normal, mapNormal, gblIdx);
|
||||
vector n = -distribute.getValue
|
||||
(
|
||||
normal,
|
||||
mapNormal,
|
||||
gblIdx
|
||||
);
|
||||
if (mag(n) != 0)
|
||||
{
|
||||
n /= mag(n);
|
||||
@ -352,7 +367,17 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
|
||||
centre,
|
||||
mapCentres,
|
||||
gblIdx,
|
||||
distribute.getCyclicPatches(pCellI, gblIdx)
|
||||
distribute.getCyclicPatches
|
||||
(
|
||||
pCellI,
|
||||
gblIdx,
|
||||
distribute.getValue
|
||||
(
|
||||
centre,
|
||||
mapCentres,
|
||||
gblIdx
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
vector distanceToIntSeg(c - p);
|
||||
|
||||
@ -103,7 +103,12 @@ void Foam::reconstruction::plicRDF::interpolateNormal()
|
||||
centre_,
|
||||
mapCentre,
|
||||
gblIdx,
|
||||
exchangeFields.getCyclicPatches(celli, gblIdx)
|
||||
exchangeFields.getCyclicPatches
|
||||
(
|
||||
celli,
|
||||
gblIdx,
|
||||
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
|
||||
)
|
||||
)
|
||||
);
|
||||
vector distanceToIntSeg = (tensor::I- n*n) & (p - centre);
|
||||
@ -157,7 +162,12 @@ void Foam::reconstruction::plicRDF::interpolateNormal()
|
||||
exchangeFields.getPosition
|
||||
(
|
||||
mesh_.C(), mapCC, gblIdx,
|
||||
exchangeFields.getCyclicPatches(celli, gblIdx)
|
||||
exchangeFields.getCyclicPatches
|
||||
(
|
||||
celli,
|
||||
gblIdx,
|
||||
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
|
||||
)
|
||||
)
|
||||
);
|
||||
alphaValues.append
|
||||
@ -208,7 +218,12 @@ void Foam::reconstruction::plicRDF::gradSurf(const volScalarField& phi)
|
||||
exchangeFields.getPosition
|
||||
(
|
||||
mesh_.C(), mapCC, gblIdx,
|
||||
exchangeFields.getCyclicPatches(celli, gblIdx)
|
||||
exchangeFields.getCyclicPatches
|
||||
(
|
||||
celli,
|
||||
gblIdx,
|
||||
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
|
||||
)
|
||||
)
|
||||
);
|
||||
phiValues.append
|
||||
|
||||
Reference in New Issue
Block a user