CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Computation of total pressure drop based on integral definition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 4, 2018, 08:00
Default Computation of total pressure drop based on integral definition
  #1
Member
 
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8
palarcon is on a distinguished road
Hello everybody

I'm working on topology optimization with OpenFOAM and I'm using and adapting the solver adjointShapeOptimizationFoam.
In order to do that, I need to compute and print the objective function used on that solver (which is not the same used on the paper which is based on).
The real objective function used in this solver is the total pressure drop, which mathematically is

J=\int_{\Gamma_i}d\Gamma_i\left( p+\frac{1}{2}v^{2} \right) - \int_{\Gamma_o}d\Gamma_o \left( p+\frac{1}{2}v^{2} \right)

which is the total pressure at the inlet minus the total pressure at the outlet.
I'm not sure about the implementation into my solver, mainly for the differential part d\Gamma.

My current implementation is

Code:
objective_inlet  = sum((p.boundaryField()[objPatchList[0]] + 0.5*magSqr(U.boundaryField()[objPatchList[0]])));
objective_outlet = sum((p.boundaryField()[objPatchList[1]] + 0.5*magSqr(U.boundaryField()[objPatchList[1]])));
objective = objective_outlet - objective_inlet;
where objPatchList[0] is the inlet and objPatchList[1] is the oulet.

My question is, should I multiply objective_inlet and objective_outlet by mesh.magSf()[objPatchList[X]] in order to account for the differential d\Gamma in the analytical expression?

PS: I know that I posted a similar question some time ago, but my knowledge of the problem was different at that time.
palarcon is offline   Reply With Quote

Old   September 4, 2018, 10:34
Default
  #2
Senior Member
 
Join Date: Sep 2013
Posts: 353
Rep Power: 21
Bloerb will become famous soon enough
You need to multiply each face value with its area before the summation.
Code:
const scalarField& pFace = p.boundaryField()["inlet"];
const scalarField& areaFace = mesh.magSf().boundaryField()["inlet"];

areaPatch = sum(areaFace);
pressureSum = sum(pFace);
IntegralPressure = sum(areaFace*pFace);

// Is not equal to 
IntegralPressure = areaPatch*pressureSum
You might also want to consider gSum...
Bloerb is offline   Reply With Quote

Old   September 10, 2018, 07:28
Default
  #3
Member
 
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8
palarcon is on a distinguished road
Sorry for the late reply, but I was solving other problems related to my code.
I'm trying to code what you suggest me, but when I try to add the lines I have compilations errors.
For example, if I only add the first line

Code:
const scalarField& pFace = p.boundaryField()["inlet"];
I get the following error

Code:
error: invalid conversion from ‘const char*’ to ‘Foam::label {aka int}’ [-fpermissive]
do you have any advise?



Quote:
Originally Posted by Bloerb View Post
You need to multiply each face value with its area before the summation.
Code:
const scalarField& pFace = p.boundaryField()["inlet"];
const scalarField& areaFace = mesh.magSf().boundaryField()["inlet"];

areaPatch = sum(areaFace);
pressureSum = sum(pFace);
IntegralPressure = sum(areaFace*pFace);

// Is not equal to 
IntegralPressure = areaPatch*pressureSum
You might also want to consider gSum...
palarcon is offline   Reply With Quote

Old   September 12, 2018, 10:35
Default
  #4
Member
 
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8
palarcon is on a distinguished road
I was able to code all of the previous, but my last question is, which definition of IntegralPressure is the correct one for my case?

Quote:
Originally Posted by Bloerb View Post
You need to multiply each face value with its area before the summation.
Code:
const scalarField& pFace = p.boundaryField()["inlet"];
const scalarField& areaFace = mesh.magSf().boundaryField()["inlet"];

areaPatch = sum(areaFace);
pressureSum = sum(pFace);
IntegralPressure = sum(areaFace*pFace);

// Is not equal to 
IntegralPressure = areaPatch*pressureSum
You might also want to consider gSum...
palarcon is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Total pressure in rel frame and total pressure Salut CFX 14 May 8, 2023 03:29
Difference between total pressure, total pressure in Stn and in Rel frames turbo5 CFX 6 January 21, 2016 17:05
Error in run Batch file saba1366 CFX 4 February 10, 2013 02:15
Total pressure in CFX famarcfd CFX 0 June 17, 2011 11:33
Hydrostatic pressure in 2-phase flow modeling (long) DS & HB Main CFD Forum 0 January 8, 2000 16:00


All times are GMT -4. The time now is 16:45.