mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use weighted average/sum in a few places
- minor adjustments to some BCs construction: * ensure origin/axis are zero-initialized * use dictionary get<> instead of lookup
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,23 +110,18 @@ bool Foam::functionObjects::DESModelRegions::execute()
|
||||
{
|
||||
Log << type() << " " << name() << " execute:" << nl;
|
||||
|
||||
volScalarField& DESModelRegions =
|
||||
lookupObjectRef<volScalarField>(resultName_);
|
||||
auto& regions = lookupObjectRef<volScalarField>(resultName_);
|
||||
|
||||
|
||||
if (foundObject<DESModelBase>(turbulenceModel::propertiesName))
|
||||
if
|
||||
(
|
||||
const auto* modelp
|
||||
= cfindObject<DESModelBase>(turbulenceModel::propertiesName)
|
||||
)
|
||||
{
|
||||
const DESModelBase& model =
|
||||
lookupObject<DESModelBase>
|
||||
(
|
||||
turbulenceModel::propertiesName
|
||||
);
|
||||
|
||||
DESModelRegions == model.LESRegion();
|
||||
regions == (*modelp).LESRegion();
|
||||
|
||||
const scalar prc =
|
||||
gSum(DESModelRegions.primitiveField()*mesh_.V())
|
||||
/gSum(mesh_.V())*100.0;
|
||||
gWeightedAverage(mesh_.V(), regions.primitiveField())*100.0;
|
||||
|
||||
file() << time_.value()
|
||||
<< token::TAB << prc
|
||||
@ -149,14 +144,13 @@ bool Foam::functionObjects::DESModelRegions::execute()
|
||||
|
||||
bool Foam::functionObjects::DESModelRegions::write()
|
||||
{
|
||||
const volScalarField& DESModelRegions =
|
||||
lookupObject<volScalarField>(resultName_);
|
||||
const auto& regions = lookupObject<volScalarField>(resultName_);
|
||||
|
||||
Log << type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << DESModelRegions.name() << nl
|
||||
<< " writing field " << regions.name() << nl
|
||||
<< endl;
|
||||
|
||||
DESModelRegions.write();
|
||||
regions.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,12 +89,15 @@ Foam::dimensionedScalar Foam::functionObjects::comfort::Trad() const
|
||||
|
||||
if (isType<wallFvPatch>(pTBf))
|
||||
{
|
||||
areaIntegral += gSum(pSf);
|
||||
TareaIntegral += gSum(pSf*pT);
|
||||
areaIntegral += sum(pSf);
|
||||
TareaIntegral += weightedSum(pSf, pT);
|
||||
}
|
||||
}
|
||||
|
||||
Trad.value() = TareaIntegral/areaIntegral;
|
||||
reduce(TareaIntegral, sumOp<scalar>());
|
||||
reduce(areaIntegral, sumOp<scalar>());
|
||||
|
||||
Trad.value() = TareaIntegral/(areaIntegral + VSMALL);
|
||||
}
|
||||
|
||||
// Bounds based on EN ISO 7730
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -272,7 +272,7 @@ bool Foam::functionObjects::wallHeatFlux::execute()
|
||||
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
|
||||
|
||||
const MinMax<scalar> limits = gMinMax(hfp);
|
||||
const scalar integralHfp = gSum(magSf[patchi]*hfp);
|
||||
const scalar integralHfp = gWeightedSum(magSf[patchi], hfp);
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user