Skip to content
Snippets Groups Projects

BUG: wrong cellZone addressing in uniformityCellZone (fixes #3360)

Merged Vaggelis Papoutsis requested to merge fix-3360-wrong-addressing into master
All threads resolved!
1 file
+ 12
12
Compare changes
  • Side-by-side
  • Inline
@@ -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];
Loading