Skip to content
Snippets Groups Projects
Closed BUG: wrong cellZone addressing in uniformityCellZone
  • View options
  • BUG: wrong cellZone addressing in uniformityCellZone

  • View options
  • Closed Issue created

    Summary

    The mean value, variance and volume fields for each zone are accessed using the wrong indices in objectiveUniformityCellZone.C

    Possible fixes

    For instance

          for (const label zI : zones_)                                               
          {                                                                           
              const cellZone& zoneI = mesh_.cellZones()[zI];                          
              scalarField VZone(V, zoneI);                                            
              vectorField UZone(U.primitiveField(), zoneI);                           
              volZone_[zI] = gSum(VZone);                                             
              UMean_[zI] = gSum(UZone*VZone)/volZone_[zI];                            
              UVar_[zI] = gSum(magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];        
                                                                                      
              J_ += 0.5*UVar_[zI];                                                    
          } 

    should become

          forAll(zones_, zI)                                               
          {                                                                           
              const cellZone& zoneI = mesh_.cellZones()[zones_[zI]];                          
              scalarField VZone(V, zoneI);                                            
              vectorField UZone(U.primitiveField(), zoneI);                           
              volZone_[zI] = gSum(VZone);                                             
              UMean_[zI] = gSum(UZone*VZone)/volZone_[zI];                            
              UVar_[zI] = gSum(magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];        
                                                                                      
              J_ += 0.5*UVar_[zI];                                                    
          } 
    Edited

    Linked items ... 0

  • Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading