|
[Sponsors] |
Computation of total pressure drop based on integral definition |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 4, 2018, 08:00 |
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 |
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 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 . 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; My question is, should I multiply objective_inlet and objective_outlet by mesh.magSf()[objPatchList[X]] in order to account for the differential 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. |
|
September 4, 2018, 10:34 |
|
#2 |
Senior Member
Join Date: Sep 2013
Posts: 353
Rep Power: 21 |
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 |
|
September 10, 2018, 07:28 |
|
#3 | |
Member
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8 |
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"]; Code:
error: invalid conversion from ‘const char*’ to ‘Foam::label {aka int}’ [-fpermissive] Quote:
|
||
September 12, 2018, 10:35 |
|
#4 | |
Member
Pablo Alarcón
Join Date: Mar 2018
Location: Liège
Posts: 59
Rep Power: 8 |
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:
|
||
|
|
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 |