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:
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -679,7 +679,7 @@ void Foam::radiation::laserDTRM::calculate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
|
scalar totalQ = gWeightedSum(mesh_.V(), Q_.primitiveField());
|
||||||
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
||||||
|
|
||||||
if (mesh_.time().writeTime())
|
if (mesh_.time().writeTime())
|
||||||
|
|||||||
@ -79,7 +79,7 @@ cylindricalInletVelocityFvPatchVectorField
|
|||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})),
|
origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.get<vector>("axis")),
|
||||||
axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
|
axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
|
||||||
radialVelocity_
|
radialVelocity_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -109,8 +109,7 @@ void Foam::fixedMeanFvPatchField<Type>::updateCoeffs()
|
|||||||
Field<Type> newValues(this->patchInternalField());
|
Field<Type> newValues(this->patchInternalField());
|
||||||
|
|
||||||
Type meanValuePsi =
|
Type meanValuePsi =
|
||||||
gSum(this->patch().magSf()*newValues)
|
gWeightedAverage(this->patch().magSf(), newValues);
|
||||||
/gSum(this->patch().magSf());
|
|
||||||
|
|
||||||
if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue))
|
if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenFOAM Foundation
|
Copyright (C) 2018 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -117,9 +117,7 @@ void Foam::fixedMeanOutletInletFvPatchField<Type>::updateCoeffs()
|
|||||||
|
|
||||||
Field<Type> newValues(this->patchInternalField());
|
Field<Type> newValues(this->patchInternalField());
|
||||||
|
|
||||||
Type meanValuePsi =
|
Type meanValuePsi = gWeightedAverage(this->patch().magSf(), newValues);
|
||||||
gSum(this->patch().magSf()*newValues)
|
|
||||||
/gSum(this->patch().magSf());
|
|
||||||
|
|
||||||
if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue))
|
if (mag(meanValue) > SMALL && mag(meanValuePsi) > 0.5*mag(meanValue))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -285,7 +285,7 @@ Foam::PatchFunction1Types::Sampled<Type>::value
|
|||||||
(
|
(
|
||||||
mag(this->mappedPatchBase::patch_.faceAreas())
|
mag(this->mappedPatchBase::patch_.faceAreas())
|
||||||
);
|
);
|
||||||
averagePsi = gSum(magSf*newValues)/gSum(magSf);
|
averagePsi = gWeightedAverage(magSf, newValues);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -788,8 +788,7 @@ Foam::mappedPatchFieldBase<Type>::mappedField
|
|||||||
if (setAverage_)
|
if (setAverage_)
|
||||||
{
|
{
|
||||||
Type averagePsi =
|
Type averagePsi =
|
||||||
gSum(patchField_.patch().magSf()*newValues)
|
gWeightedAverage(patchField_.patch().magSf(), newValues);
|
||||||
/gSum(patchField_.patch().magSf());
|
|
||||||
|
|
||||||
if (mag(averagePsi) > 0.5*mag(average_))
|
if (mag(averagePsi) > 0.5*mag(average_))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -369,7 +369,7 @@ void Foam::outletMappedUniformInletFvPatchField<Type>::updateCoeffs()
|
|||||||
|
|
||||||
mapField.append
|
mapField.append
|
||||||
(
|
(
|
||||||
gSum(outlet.magSf()*outletFld)/gSum(outlet.magSf())
|
gWeightedAverage(outlet.magSf(), outletFld)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -130,8 +130,8 @@ void Foam::outletPhaseMeanVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
patch().lookupPatchField<volScalarField>(alphaName_)
|
patch().lookupPatchField<volScalarField>(alphaName_)
|
||||||
);
|
);
|
||||||
|
|
||||||
alphap = max(alphap, scalar(0));
|
// Clamp to 0-1 range
|
||||||
alphap = min(alphap, scalar(1));
|
alphap.clamp_range(Foam::zero_one{});
|
||||||
|
|
||||||
// Get the patchInternalField (zero-gradient field)
|
// Get the patchInternalField (zero-gradient field)
|
||||||
vectorField Uzg(patchInternalField());
|
vectorField Uzg(patchInternalField());
|
||||||
|
|||||||
@ -211,7 +211,7 @@ void Foam::plenumPressureFvPatchScalarField::updateCoeffs()
|
|||||||
{
|
{
|
||||||
if (hasRho_)
|
if (hasRho_)
|
||||||
{
|
{
|
||||||
massFlowRate = - gSum(rho_*phi);
|
massFlowRate = - rho_*gSum(phi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -243,7 +243,7 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
{
|
{
|
||||||
const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
|
const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
|
||||||
|
|
||||||
rho = gSum(rhop*patch().magSf())/gSum(patch().magSf());
|
rho = gWeightedAverage(patch().magSf(), rhop);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -41,7 +41,7 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
origin_(),
|
origin_(Zero),
|
||||||
axis_(Zero),
|
axis_(Zero),
|
||||||
omega_(nullptr)
|
omega_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -56,8 +56,8 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
|
fixedValueFvPatchField<vector>(p, iF, dict, IOobjectOption::NO_READ),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.get<vector>("origin")),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.get<vector>("axis")),
|
||||||
omega_(Function1<scalar>::New("omega", dict, &db()))
|
omega_(Function1<scalar>::New("omega", dict, &db()))
|
||||||
{
|
{
|
||||||
if (!this->readValueEntry(dict))
|
if (!this->readValueEntry(dict))
|
||||||
|
|||||||
@ -57,8 +57,7 @@ void Foam::swirlFanVelocityFvPatchField::calcFanJump()
|
|||||||
deltaP /= patch().lookupPatchField<volScalarField>(rhoName_);
|
deltaP /= patch().lookupPatchField<volScalarField>(rhoName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector axisHat =
|
const vector axisHat = gSum(patch().Sf())/gSum(patch().magSf());
|
||||||
gSum(patch().nf()*patch().magSf())/gSum(patch().magSf());
|
|
||||||
|
|
||||||
vectorField tanDir
|
vectorField tanDir
|
||||||
(
|
(
|
||||||
@ -131,7 +130,7 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
|
|||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
pName_("p"),
|
pName_("p"),
|
||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
origin_(),
|
origin_(Zero),
|
||||||
rpm_(nullptr),
|
rpm_(nullptr),
|
||||||
fanEff_(1),
|
fanEff_(1),
|
||||||
rEff_(0),
|
rEff_(0),
|
||||||
@ -158,7 +157,7 @@ Foam::swirlFanVelocityFvPatchField::swirlFanVelocityFvPatchField
|
|||||||
(
|
(
|
||||||
"origin",
|
"origin",
|
||||||
returnReduceOr(patch().size())
|
returnReduceOr(patch().size())
|
||||||
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
|
? gWeightedAverage(patch().magSf(), patch().Cf())
|
||||||
: Zero
|
: Zero
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
|||||||
fixedValueFvPatchField<vector>(p, iF),
|
fixedValueFvPatchField<vector>(p, iF),
|
||||||
phiName_("phi"),
|
phiName_("phi"),
|
||||||
rhoName_("rho"),
|
rhoName_("rho"),
|
||||||
origin_(),
|
origin_(Zero),
|
||||||
axis_(Zero),
|
axis_(Zero),
|
||||||
flowRate_(),
|
flowRate_(),
|
||||||
rpm_()
|
rpm_()
|
||||||
@ -69,7 +69,7 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
|||||||
(
|
(
|
||||||
"origin",
|
"origin",
|
||||||
returnReduceOr(patch().size())
|
returnReduceOr(patch().size())
|
||||||
? gSum(patch().Cf()*patch().magSf())/gSum(patch().magSf())
|
? gWeightedAverage(patch().magSf(), patch().Cf())
|
||||||
: Zero
|
: Zero
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -74,8 +74,8 @@ swirlInletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.get<vector>("origin")),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.get<vector>("axis")),
|
||||||
axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
|
axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
|
||||||
radialVelocity_
|
radialVelocity_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -895,8 +895,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::updateCoeffs()
|
|||||||
// (PCR:p. 522)
|
// (PCR:p. 522)
|
||||||
const vector UBulk
|
const vector UBulk
|
||||||
(
|
(
|
||||||
gSum(UMean()*patch().magSf())
|
gWeightedAverage(patch().magSf(), UMean())
|
||||||
/(gSum(patch().magSf()) + ROOTVSMALL)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Move eddies using bulk velocity
|
// Move eddies using bulk velocity
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -174,11 +174,7 @@ void Foam::turbulentDigitalFilterInletFvPatchField<Type>::mapMean
|
|||||||
const vectorField& mean = tmean.cref();
|
const vectorField& mean = tmean.cref();
|
||||||
|
|
||||||
// Calculate flow-rate correction factor for vector fields (KCX:Eq. 8)
|
// Calculate flow-rate correction factor for vector fields (KCX:Eq. 8)
|
||||||
const vector bulk
|
const vector bulk = gWeightedAverage(this->patch().magSf(), mean);
|
||||||
(
|
|
||||||
gSum(mean*this->patch().magSf())
|
|
||||||
/(gSum(this->patch().magSf()) + ROOTVSMALL)
|
|
||||||
);
|
|
||||||
|
|
||||||
const scalar correct
|
const scalar correct
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -125,14 +125,14 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
|
|
||||||
scalarField alphap(alpha.boundaryField()[patch().index()]);
|
scalarField alphap(alpha.boundaryField()[patch().index()]);
|
||||||
|
|
||||||
alphap = max(alphap, scalar(0));
|
// Clamp to 0-1 range
|
||||||
alphap = min(alphap, scalar(1));
|
alphap.clamp_range(Foam::zero_one{});
|
||||||
|
|
||||||
const scalar t = db().time().timeOutputValue();
|
const scalar t = db().time().timeOutputValue();
|
||||||
scalar flowRate = flowRate_->value(t);
|
scalar flowRate = flowRate_->value(t);
|
||||||
|
|
||||||
// a simpler way of doing this would be nice
|
// a simpler way of doing this would be nice
|
||||||
scalar avgU = -flowRate/gSum(patch().magSf()*alphap);
|
const scalar avgU = -flowRate/gWeightedSum(patch().magSf(), alphap);
|
||||||
|
|
||||||
vectorField n(patch().nf());
|
vectorField n(patch().nf());
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013-2015 OpenFOAM Foundation
|
Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -110,23 +110,18 @@ bool Foam::functionObjects::DESModelRegions::execute()
|
|||||||
{
|
{
|
||||||
Log << type() << " " << name() << " execute:" << nl;
|
Log << type() << " " << name() << " execute:" << nl;
|
||||||
|
|
||||||
volScalarField& DESModelRegions =
|
auto& regions = lookupObjectRef<volScalarField>(resultName_);
|
||||||
lookupObjectRef<volScalarField>(resultName_);
|
|
||||||
|
|
||||||
|
if
|
||||||
if (foundObject<DESModelBase>(turbulenceModel::propertiesName))
|
|
||||||
{
|
|
||||||
const DESModelBase& model =
|
|
||||||
lookupObject<DESModelBase>
|
|
||||||
(
|
(
|
||||||
turbulenceModel::propertiesName
|
const auto* modelp
|
||||||
);
|
= cfindObject<DESModelBase>(turbulenceModel::propertiesName)
|
||||||
|
)
|
||||||
DESModelRegions == model.LESRegion();
|
{
|
||||||
|
regions == (*modelp).LESRegion();
|
||||||
|
|
||||||
const scalar prc =
|
const scalar prc =
|
||||||
gSum(DESModelRegions.primitiveField()*mesh_.V())
|
gWeightedAverage(mesh_.V(), regions.primitiveField())*100.0;
|
||||||
/gSum(mesh_.V())*100.0;
|
|
||||||
|
|
||||||
file() << time_.value()
|
file() << time_.value()
|
||||||
<< token::TAB << prc
|
<< token::TAB << prc
|
||||||
@ -149,14 +144,13 @@ bool Foam::functionObjects::DESModelRegions::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::DESModelRegions::write()
|
bool Foam::functionObjects::DESModelRegions::write()
|
||||||
{
|
{
|
||||||
const volScalarField& DESModelRegions =
|
const auto& regions = lookupObject<volScalarField>(resultName_);
|
||||||
lookupObject<volScalarField>(resultName_);
|
|
||||||
|
|
||||||
Log << type() << " " << name() << " output:" << nl
|
Log << type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << DESModelRegions.name() << nl
|
<< " writing field " << regions.name() << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
DESModelRegions.write();
|
regions.write();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2019 OpenFOAM Foundation
|
Copyright (C) 2019 OpenFOAM Foundation
|
||||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -89,12 +89,15 @@ Foam::dimensionedScalar Foam::functionObjects::comfort::Trad() const
|
|||||||
|
|
||||||
if (isType<wallFvPatch>(pTBf))
|
if (isType<wallFvPatch>(pTBf))
|
||||||
{
|
{
|
||||||
areaIntegral += gSum(pSf);
|
areaIntegral += sum(pSf);
|
||||||
TareaIntegral += gSum(pSf*pT);
|
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
|
// Bounds based on EN ISO 7730
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -272,7 +272,7 @@ bool Foam::functionObjects::wallHeatFlux::execute()
|
|||||||
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
|
const scalarField& hfp = wallHeatFlux.boundaryField()[patchi];
|
||||||
|
|
||||||
const MinMax<scalar> limits = gMinMax(hfp);
|
const MinMax<scalar> limits = gMinMax(hfp);
|
||||||
const scalar integralHfp = gSum(magSf[patchi]*hfp);
|
const scalar integralHfp = gWeightedSum(magSf[patchi], hfp);
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,8 +64,8 @@ angularOscillatingDisplacementPointPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.get<vector>("axis")),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.get<vector>("origin")),
|
||||||
angle0_(dict.get<scalar>("angle0")),
|
angle0_(dict.get<scalar>("angle0")),
|
||||||
amplitude_(dict.get<scalar>("amplitude")),
|
amplitude_(dict.get<scalar>("amplitude")),
|
||||||
omega_(dict.get<scalar>("omega"))
|
omega_(dict.get<scalar>("omega"))
|
||||||
|
|||||||
@ -64,8 +64,8 @@ angularOscillatingVelocityPointPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValuePointPatchField<vector>(p, iF, dict),
|
fixedValuePointPatchField<vector>(p, iF, dict),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.get<vector>("axis")),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.get<vector>("origin")),
|
||||||
angle0_(dict.get<scalar>("angle0")),
|
angle0_(dict.get<scalar>("angle0")),
|
||||||
amplitude_(dict.get<scalar>("amplitude")),
|
amplitude_(dict.get<scalar>("amplitude")),
|
||||||
omega_(dict.get<scalar>("omega"))
|
omega_(dict.get<scalar>("omega"))
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -337,7 +337,7 @@ void Foam::fv::directionalPressureGradientExplicitSource::correct
|
|||||||
);
|
);
|
||||||
const scalarField rho(turbModel.rho(),cells_);
|
const scalarField rho(turbModel.rho(),cells_);
|
||||||
const scalarField cv(mesh_.V(), cells_);
|
const scalarField cv(mesh_.V(), cells_);
|
||||||
scalar rhoAve = gSumProd(rho, cv)/gSum(cv);
|
scalar rhoAve = gWeightedAverage(cv, rho);
|
||||||
volFlowRate = mag(totalphi)/rhoAve;
|
volFlowRate = mag(totalphi)/rhoAve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2687,7 +2687,7 @@ Foam::label Foam::snappyRefineDriver::directionalSmooth
|
|||||||
|
|
||||||
const vectorField residual(baseNewPoints - baseMeshPoints);
|
const vectorField residual(baseNewPoints - baseMeshPoints);
|
||||||
{
|
{
|
||||||
scalar res(gSum(mag(residual)));
|
scalar res(gSumMag(residual));
|
||||||
|
|
||||||
if (iter == 0)
|
if (iter == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -700,8 +700,7 @@ Foam::PatchFunction1Types::MappedFile<Type>::value
|
|||||||
|
|
||||||
if (this->faceValues())
|
if (this->faceValues())
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(this->patch_.faceAreas()));
|
averagePsi = gWeightedAverage(this->patch_.magFaceAreas(), fld);
|
||||||
averagePsi = gSum(magSf*fld)/gSum(magSf);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,7 +39,7 @@ adjointRotatingWallVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
adjointWallVelocityFvPatchVectorField(p, iF),
|
adjointWallVelocityFvPatchVectorField(p, iF),
|
||||||
origin_(),
|
origin_(Zero),
|
||||||
axis_(Zero),
|
axis_(Zero),
|
||||||
omega_(nullptr)
|
omega_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -71,17 +71,17 @@ objectiveTopOSolidVolume::objectiveTopOSolidVolume
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
scalar objectiveTopOSolidVolume::J()
|
scalar objectiveTopOSolidVolume::J()
|
||||||
{
|
{
|
||||||
J_ = Zero;
|
J_ = Zero;
|
||||||
if (mesh_.foundObject<volScalarField>("beta"))
|
|
||||||
|
if (const auto* betap = mesh_.cfindObject<volScalarField>("beta"))
|
||||||
{
|
{
|
||||||
const volScalarField& beta = mesh_.lookupObject<volScalarField>("beta");
|
const auto& beta = *betap;
|
||||||
const DimensionedField<scalar, volMesh>& V = mesh_.V();
|
|
||||||
const scalar time = mesh_.time().timeOutputValue();
|
const scalar time = mesh_.time().timeOutputValue();
|
||||||
|
|
||||||
J_ =
|
J_ =
|
||||||
gSum(beta.primitiveField()*V)/gSum(V)
|
gWeightedAverage(mesh_.V(), beta.primitiveField())
|
||||||
- targetPercentage_->value(time);
|
- targetPercentage_->value(time);
|
||||||
if (percentInDenom_)
|
if (percentInDenom_)
|
||||||
{
|
{
|
||||||
@ -101,6 +101,7 @@ scalar objectiveTopOSolidVolume::J()
|
|||||||
void objectiveTopOSolidVolume::update_dJdb()
|
void objectiveTopOSolidVolume::update_dJdb()
|
||||||
{
|
{
|
||||||
const scalar time = mesh_.time().timeOutputValue();
|
const scalar time = mesh_.time().timeOutputValue();
|
||||||
|
|
||||||
dJdbPtr_().primitiveFieldRef() = scalar(1)/gSum(mesh_.V());
|
dJdbPtr_().primitiveFieldRef() = scalar(1)/gSum(mesh_.V());
|
||||||
if (percentInDenom_)
|
if (percentInDenom_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,17 +71,17 @@ objectiveTopOVolume::objectiveTopOVolume
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
scalar objectiveTopOVolume::J()
|
scalar objectiveTopOVolume::J()
|
||||||
{
|
{
|
||||||
J_ = Zero;
|
J_ = Zero;
|
||||||
if (mesh_.foundObject<volScalarField>("beta"))
|
|
||||||
|
if (const auto* betap = mesh_.cfindObject<volScalarField>("beta"))
|
||||||
{
|
{
|
||||||
const volScalarField& beta = mesh_.lookupObject<volScalarField>("beta");
|
const auto& beta = *betap;
|
||||||
const DimensionedField<scalar, volMesh>& V = mesh_.V();
|
|
||||||
const scalar time = mesh_.time().timeOutputValue();
|
const scalar time = mesh_.time().timeOutputValue();
|
||||||
|
|
||||||
J_ =
|
J_ =
|
||||||
scalar(1) - gSum(beta.primitiveField()*V)/gSum(V)
|
scalar(1) - gWeightedAverage(mesh_.V(), beta.primitiveField())
|
||||||
- targetPercentage_->value(time);
|
- targetPercentage_->value(time);
|
||||||
if (percentInDenom_)
|
if (percentInDenom_)
|
||||||
{
|
{
|
||||||
@ -101,6 +101,7 @@ scalar objectiveTopOVolume::J()
|
|||||||
void objectiveTopOVolume::update_dJdb()
|
void objectiveTopOVolume::update_dJdb()
|
||||||
{
|
{
|
||||||
const scalar time = mesh_.time().timeOutputValue();
|
const scalar time = mesh_.time().timeOutputValue();
|
||||||
|
|
||||||
dJdbPtr_().primitiveFieldRef() = -scalar(1)/gSum(mesh_.V());
|
dJdbPtr_().primitiveFieldRef() = -scalar(1)/gSum(mesh_.V());
|
||||||
if (percentInDenom_)
|
if (percentInDenom_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -62,8 +62,9 @@ Foam::scalar Foam::betaMax::computeLength(const dictionary& dict) const
|
|||||||
for (const label pI : inletPatches)
|
for (const label pI : inletPatches)
|
||||||
{
|
{
|
||||||
const fvPatch& patch = mesh_.boundary()[pI];
|
const fvPatch& patch = mesh_.boundary()[pI];
|
||||||
length += gSum(patch.magSf());
|
length += sum(patch.magSf());
|
||||||
}
|
}
|
||||||
|
reduce(length, sumOp<scalar>());
|
||||||
|
|
||||||
// Divide with the span in the empty direction
|
// Divide with the span in the empty direction
|
||||||
const Vector<label>& geometricD = mesh_.geometricD();
|
const Vector<label>& geometricD = mesh_.geometricD();
|
||||||
|
|||||||
@ -513,7 +513,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
Info<< " qEffVap: " << gMin(qEff) << " - "
|
Info<< " qEffVap: " << gMin(qEff) << " - "
|
||||||
<< gMax(qEff) << endl;
|
<< gMax(qEff) << endl;
|
||||||
|
|
||||||
scalar Qeff = gSum(qEff*patch().magSf());
|
scalar Qeff = gWeightedSum(patch().magSf(), qEff);
|
||||||
Info<< " Effective heat transfer rate to vapor:" << Qeff
|
Info<< " Effective heat transfer rate to vapor:" << Qeff
|
||||||
<< nl << endl;
|
<< nl << endl;
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
Info<< " alphatlEff: " << gMin(liquidw*(*this + alphaw))
|
Info<< " alphatlEff: " << gMin(liquidw*(*this + alphaw))
|
||||||
<< " - " << gMax(liquidw*(*this + alphaw)) << endl;
|
<< " - " << gMax(liquidw*(*this + alphaw)) << endl;
|
||||||
|
|
||||||
scalar Qeff = gSum(qEff*patch().magSf());
|
scalar Qeff = gWeightedSum(patch().magSf(), qEff);
|
||||||
Info<< " Effective heat transfer rate to liquid: " << Qeff
|
Info<< " Effective heat transfer rate to liquid: " << Qeff
|
||||||
<< endl << nl;
|
<< endl << nl;
|
||||||
|
|
||||||
@ -1166,7 +1166,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
*hew.snGrad()
|
*hew.snGrad()
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar Qc = gSum(qc*patch().magSf());
|
scalar Qc = gWeightedSum(patch().magSf(), qc);
|
||||||
Info<< " Convective heat transfer: " << Qc << endl;
|
Info<< " Convective heat transfer: " << Qc << endl;
|
||||||
|
|
||||||
const scalarField qFilm
|
const scalarField qFilm
|
||||||
@ -1174,7 +1174,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
relax*fLiquid*nFilms*htcFilmBoiling*(Tw - Tsatw)
|
relax*fLiquid*nFilms*htcFilmBoiling*(Tw - Tsatw)
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar QFilm = gSum(qFilm*patch().magSf());
|
scalar QFilm = gWeightedSum(patch().magSf(), qFilm);
|
||||||
Info<< " Film boiling heat transfer: " << QFilm << endl;
|
Info<< " Film boiling heat transfer: " << QFilm << endl;
|
||||||
|
|
||||||
Info<< " Htc Film Boiling coeff: "
|
Info<< " Htc Film Boiling coeff: "
|
||||||
@ -1199,7 +1199,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar QsubCool = gSum(qSubCool*patch().magSf());
|
scalar QsubCool = gWeightedSum(patch().magSf(), qSubCool);
|
||||||
|
|
||||||
Info<< " Sub Cool boiling heat transfer: " << QsubCool
|
Info<< " Sub Cool boiling heat transfer: " << QsubCool
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2020 OpenFOAM Foundation
|
Copyright (C) 2015-2020 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -157,9 +157,11 @@ void Foam::fixedMultiPhaseHeatFluxFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
MinMax<scalar> limits = gMinMax(Q);
|
||||||
|
|
||||||
Info<< patch().name() << " " << ": overall heat flux "
|
Info<< patch().name() << " " << ": overall heat flux "
|
||||||
<< gMin(Q) << " - " << gMax(Q) << " W/m2, power: "
|
<< limits.min() << " - " << limits.max() << " W/m2, power: "
|
||||||
<< gSum(patch().magSf()*Q) << " W" << endl;
|
<< gWeightedSum(patch().magSf(), Q) << " W" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
operator==((scalar(1) - relax_)*Tp + relax_*max(Tmin_,(q_ + A)/(B)));
|
operator==((scalar(1) - relax_)*Tp + relax_*max(Tmin_,(q_ + A)/(B)));
|
||||||
|
|||||||
@ -402,10 +402,12 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
scalar Qc = gSum(qConv*patch().magSf());
|
scalar Qc = gWeightedSum(patch().magSf(), qConv);
|
||||||
scalar qr = gSum(qRad*patch().magSf());
|
scalar qr = gWeightedSum(patch().magSf(), qRad);
|
||||||
scalar Qt = gSum((qConv + qRad)*patch().magSf());
|
scalar Qt = gSum((qConv + qRad)*patch().magSf());
|
||||||
|
|
||||||
|
MinMax<scalar> limits = gMinMax(*this);
|
||||||
|
|
||||||
Info<< mesh.name() << ':'
|
Info<< mesh.name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
<< this->internalField().name() << " <- "
|
<< this->internalField().name() << " <- "
|
||||||
@ -416,8 +418,8 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
<< " radiative heat [W] : " << qr << nl
|
<< " radiative heat [W] : " << qr << nl
|
||||||
<< " total heat [W] : " << Qt << nl
|
<< " total heat [W] : " << Qt << nl
|
||||||
<< " wall temperature "
|
<< " wall temperature "
|
||||||
<< " min:" << gMin(*this)
|
<< " min:" << limits.min()
|
||||||
<< " max:" << gMax(*this)
|
<< " max:" << limits.max()
|
||||||
<< " avg:" << gAverage(*this)
|
<< " avg:" << gAverage(*this)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -1048,15 +1048,20 @@ void kinematicSingleLayer::info()
|
|||||||
outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
|
outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
|
||||||
addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
|
addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
|
||||||
|
|
||||||
|
MinMax<scalar> limits_U = gMinMaxMag(Uinternal);
|
||||||
|
MinMax<scalar> limits_delta = gMinMax(deltaInternal);
|
||||||
|
|
||||||
Info<< indent << "added mass = " << addedMassTotal << nl
|
Info<< indent << "added mass = " << addedMassTotal << nl
|
||||||
<< indent << "current mass = "
|
<< indent << "current mass = "
|
||||||
<< gSum((deltaRho_*magSf())()) << nl
|
<< gWeightedSum(magSf(), deltaRho_) << nl
|
||||||
<< indent << "min/max(mag(U)) = " << gMin(mag(Uinternal)) << ", "
|
<< indent << "min/max(mag(U)) = "
|
||||||
<< gMax(mag(Uinternal)) << nl
|
<< limits_U.min() << ", "
|
||||||
<< indent << "min/max(delta) = " << gMin(deltaInternal) << ", "
|
<< limits_U.max() << nl
|
||||||
<< gMax(deltaInternal) << nl
|
<< indent << "min/max(delta) = "
|
||||||
|
<< limits_delta.min() << ", "
|
||||||
|
<< limits_delta.max() << nl
|
||||||
<< indent << "coverage = "
|
<< indent << "coverage = "
|
||||||
<< gSum(alpha_.primitiveField()*magSf())/gSum(magSf()) << nl;
|
<< gWeightedAverage(magSf(), alpha_.primitiveField()) << nl;
|
||||||
|
|
||||||
injection_.info(Info);
|
injection_.info(Info);
|
||||||
transfer_.info(Info);
|
transfer_.info(Info);
|
||||||
|
|||||||
@ -170,14 +170,16 @@ void Foam::radiation::fixedIncidentRadiationFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
MinMax<scalar> limits = gMinMax(*this);
|
||||||
|
|
||||||
scalar qr = gSum(kappa(*this)*gradient()*patch().magSf());
|
scalar qr = gSum(kappa(*this)*gradient()*patch().magSf());
|
||||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
<< this->internalField().name() << " -> "
|
<< this->internalField().name() << " -> "
|
||||||
<< " radiativeFlux:" << qr
|
<< " radiativeFlux:" << qr
|
||||||
<< " walltemperature "
|
<< " walltemperature "
|
||||||
<< " min:" << gMin(*this)
|
<< " min:" << limits.min()
|
||||||
<< " max:" << gMax(*this)
|
<< " max:" << limits.max()
|
||||||
<< " avg:" << gAverage(*this)
|
<< " avg:" << gAverage(*this)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -733,11 +733,13 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
if (debug && fluid_)
|
if (debug && fluid_)
|
||||||
{
|
{
|
||||||
scalar Qdm = gSum(dm*magSf);
|
scalar Qdm = gWeightedSum(magSf, dm);
|
||||||
scalar QMass = gSum(mass_);
|
scalar QMass = gSum(mass_);
|
||||||
scalar Qt = gSum(myKDelta_*(Tp - Tin)*magSf);
|
scalar Qt = gSum(myKDelta_*(Tp - Tin)*magSf);
|
||||||
scalar QtSolid = gSum(KDeltaNbr*(Tp - nbrIntFld)*magSf);
|
scalar QtSolid = gSum(KDeltaNbr*(Tp - nbrIntFld)*magSf);
|
||||||
|
|
||||||
|
MinMax<scalar> limits = gMinMax(*this);
|
||||||
|
|
||||||
Info<< mesh.name() << ':'
|
Info<< mesh.name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
<< internalField().name() << " <- "
|
<< internalField().name() << " <- "
|
||||||
@ -751,8 +753,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
<< " Total heat (>0 leaving the wall to the solid) [W] : "
|
<< " Total heat (>0 leaving the wall to the solid) [W] : "
|
||||||
<< QtSolid << nl
|
<< QtSolid << nl
|
||||||
<< " wall temperature "
|
<< " wall temperature "
|
||||||
<< " min:" << gMin(*this)
|
<< " min:" << limits.min()
|
||||||
<< " max:" << gMax(*this)
|
<< " max:" << limits.max()
|
||||||
<< " avg:" << gAverage(*this)
|
<< " avg:" << gAverage(*this)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -168,7 +168,7 @@ void Foam::lumpedMassWallTemperatureFvPatchScalarField::updateCoeffs()
|
|||||||
const scalarField q(tkappa.ref()*snGrad());
|
const scalarField q(tkappa.ref()*snGrad());
|
||||||
|
|
||||||
// Total heat in or out of the wall
|
// Total heat in or out of the wall
|
||||||
const scalar Q = gSum(q*magSf);
|
const scalar Q = gWeightedSum(magSf, q);
|
||||||
|
|
||||||
Tp += -(Q/mass_/Cp_)*deltaT;
|
Tp += -(Q/mass_/Cp_)*deltaT;
|
||||||
|
|
||||||
|
|||||||
@ -212,7 +212,7 @@ void Foam::outletMachNumberPressureFvPatchScalarField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const scalarField r(pBack_/ptot);
|
const scalarField r(pBack_/ptot);
|
||||||
const scalar area = gSum(mag(patch().Sf()));
|
const scalar area = gSum(patch().magSf());
|
||||||
M =
|
M =
|
||||||
A1_/(c1_*area)
|
A1_/(c1_*area)
|
||||||
*sqrt(2/(gamma-1)*(pow(r, 2/gamma) - pow(r, (gamma+1)/gamma)));
|
*sqrt(2/(gamma-1)*(pow(r, 2/gamma) - pow(r, (gamma+1)/gamma)));
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -153,7 +153,7 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
|
|||||||
db().lookupObject<surfaceScalarField>(phiName_);
|
db().lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
|
const scalarField& outletPatchPhi = phi.boundaryField()[outletPatchID];
|
||||||
scalar sumOutletPatchPhi = gSum(outletPatchPhi);
|
const scalar sumOutletPatchPhi = gSum(outletPatchPhi);
|
||||||
|
|
||||||
if (sumOutletPatchPhi > SMALL)
|
if (sumOutletPatchPhi > SMALL)
|
||||||
{
|
{
|
||||||
@ -164,22 +164,21 @@ void Foam::outletMappedUniformInletHeatAdditionFvPatchField::updateCoeffs()
|
|||||||
const scalarField& pT = thermo.T().boundaryField()[outletPatchID];
|
const scalarField& pT = thermo.T().boundaryField()[outletPatchID];
|
||||||
|
|
||||||
scalar averageOutletField =
|
scalar averageOutletField =
|
||||||
gSum(outletPatchPhi*outletPatchField)/sumOutletPatchPhi;
|
gWeightedSum(outletPatchPhi, outletPatchField)/sumOutletPatchPhi;
|
||||||
|
|
||||||
// Calculate Q as a function of average outlet temperature
|
// Calculate Q as a function of average outlet temperature
|
||||||
const scalar Q = Qptr_->value(averageOutletField);
|
const scalar Q = Qptr_->value(averageOutletField);
|
||||||
|
|
||||||
const scalarField Cpf(thermo.Cp(pp, pT, outletPatchID));
|
const scalarField Cpf(thermo.Cp(pp, pT, outletPatchID));
|
||||||
|
|
||||||
scalar totalPhiCp = gSum(outletPatchPhi)*gAverage(Cpf);
|
scalar totalPhiCp = sumOutletPatchPhi*gAverage(Cpf);
|
||||||
|
|
||||||
operator==(clamp(averageOutletField + Q/totalPhiCp, TMin_, TMax_));
|
operator==(clamp(averageOutletField + Q/totalPhiCp, TMin_, TMax_));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scalar averageOutletField =
|
scalar averageOutletField =
|
||||||
gSum(outletPatch.magSf()*outletPatchField)
|
gWeightedAverage(outletPatch.magSf(), outletPatchField);
|
||||||
/gSum(outletPatch.magSf());
|
|
||||||
|
|
||||||
operator==(averageOutletField);
|
operator==(averageOutletField);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
scalar phi = gSum(-phip*(*this));
|
scalar phi = -gWeightedSum(phip, *this);
|
||||||
|
|
||||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
|
|||||||
@ -690,7 +690,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
htc[i] = qField[i]/deltaT[i];
|
htc[i] = qField[i]/deltaT[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const scalar aveHtc = gSum(htc*patch().magSf())/max(magSf, SMALL);
|
const scalar aveHtc = gWeightedAverage(patch().magSf(), htc);
|
||||||
|
|
||||||
|
|
||||||
// Calculate heat-transfer coeff based on the second definition
|
// Calculate heat-transfer coeff based on the second definition
|
||||||
@ -704,8 +704,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
|
|||||||
htcPatch[i] = qField[i]/deltaTPatch[i];
|
htcPatch[i] = qField[i]/deltaTPatch[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const scalar aveHtcPatch =
|
const scalar aveHtcPatch = gWeightedAverage(patch().magSf(), htcPatch);
|
||||||
gSum(htcPatch*patch().magSf())/max(magSf, SMALL);
|
|
||||||
|
|
||||||
// Calculate various averages of temperature
|
// Calculate various averages of temperature
|
||||||
const scalarMinMax TpMinMax = gMinMax(Tp);
|
const scalarMinMax TpMinMax = gMinMax(Tp);
|
||||||
|
|||||||
@ -140,15 +140,17 @@ updateCoeffs()
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
scalar Q = gSum((*this)*patch().magSf());
|
scalar Q = gWeightedSum(patch().magSf(), *this);
|
||||||
|
|
||||||
|
MinMax<scalar> limits = gMinMax(*this);
|
||||||
|
|
||||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||||
<< patch().name() << ':'
|
<< patch().name() << ':'
|
||||||
<< this->internalField().name() << " <- "
|
<< this->internalField().name() << " <- "
|
||||||
<< " heat transfer rate:" << Q
|
<< " heat transfer rate:" << Q
|
||||||
<< " wall radiative heat flux "
|
<< " wall radiative heat flux "
|
||||||
<< " min:" << gMin(*this)
|
<< " min:" << limits.min()
|
||||||
<< " max:" << gMax(*this)
|
<< " max:" << limits.max()
|
||||||
<< " avg:" << gAverage(*this)
|
<< " avg:" << gAverage(*this)
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1118,7 +1118,7 @@ void Foam::radiation::viewFactor::calculate()
|
|||||||
{
|
{
|
||||||
const scalarField& qrp = qrBf[patchID];
|
const scalarField& qrp = qrBf[patchID];
|
||||||
const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];
|
const scalarField& magSf = mesh_.magSf().boundaryField()[patchID];
|
||||||
const scalar heatFlux = gSum(qrp*magSf);
|
const scalar heatFlux = gWeightedSum(magSf, qrp);
|
||||||
|
|
||||||
Info<< "Total heat transfer rate at patch: "
|
Info<< "Total heat transfer rate at patch: "
|
||||||
<< patchID << " "
|
<< patchID << " "
|
||||||
|
|||||||
Reference in New Issue
Block a user