mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: flowRate and flowRatePartition objectives are now computed
based on phi, instead of U & Sf
This commit is contained in:
committed by
Andrew Heather
parent
b5b48b66d1
commit
e764f7b573
@ -77,13 +77,12 @@ objectiveFlowRate::objectiveFlowRate
|
|||||||
scalar objectiveFlowRate::J()
|
scalar objectiveFlowRate::J()
|
||||||
{
|
{
|
||||||
J_ = 0;
|
J_ = 0;
|
||||||
const volVectorField& U = vars_.UInst();
|
const surfaceScalarField& phi = vars_.phiInst();
|
||||||
|
|
||||||
forAll(patches_, pI)
|
forAll(patches_, pI)
|
||||||
{
|
{
|
||||||
const label patchI = patches_[pI];
|
const label patchI = patches_[pI];
|
||||||
flowRates_[pI] =
|
flowRates_[pI] = gSum(phi.boundaryField()[patchI]);
|
||||||
gSum(U.boundaryField()[patchI] & mesh_.boundary()[patchI].Sf());
|
|
||||||
J_ += flowRates_[pI];
|
J_ += flowRates_[pI];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,23 +115,21 @@ objectiveFlowRatePartition::objectiveFlowRatePartition
|
|||||||
scalar objectiveFlowRatePartition::J()
|
scalar objectiveFlowRatePartition::J()
|
||||||
{
|
{
|
||||||
J_ = 0;
|
J_ = 0;
|
||||||
const volVectorField& U = vars_.UInst();
|
const surfaceScalarField& phi = vars_.phiInst();
|
||||||
|
|
||||||
// Inlet patches
|
// Inlet patches
|
||||||
inletFlowRate_ = 0;
|
inletFlowRate_ = 0;
|
||||||
for (const label patchI : inletPatches_)
|
for (const label patchI : inletPatches_)
|
||||||
{
|
{
|
||||||
const vectorField& Sf = mesh_.boundary()[patchI].Sf();
|
|
||||||
// Negative value
|
// Negative value
|
||||||
inletFlowRate_ += gSum(U.boundaryField()[patchI] & Sf);
|
inletFlowRate_ += gSum(phi.boundaryField()[patchI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outlet patches
|
// Outlet patches
|
||||||
forAll(outletPatches_, pI)
|
forAll(outletPatches_, pI)
|
||||||
{
|
{
|
||||||
const label patchI = outletPatches_[pI];
|
const label patchI = outletPatches_[pI];
|
||||||
const vectorField& Sf = mesh_.boundary()[patchI].Sf();
|
const scalar outletFlowRate = gSum(phi.boundaryField()[patchI]);
|
||||||
const scalar outletFlowRate = gSum(U.boundaryField()[patchI] & Sf);
|
|
||||||
currentFlowRatePercentage_[pI] = -outletFlowRate/inletFlowRate_;
|
currentFlowRatePercentage_[pI] = -outletFlowRate/inletFlowRate_;
|
||||||
flowRateDifference_[pI] =
|
flowRateDifference_[pI] =
|
||||||
targetFlowRatePercentage_[pI] - currentFlowRatePercentage_[pI];
|
targetFlowRatePercentage_[pI] - currentFlowRatePercentage_[pI];
|
||||||
|
|||||||
Reference in New Issue
Block a user