CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

weighted average for OpenFoam9

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Krapf

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 21, 2022, 06:29
Question weighted average for OpenFoam9
  #1
New Member
 
Ali Saei
Join Date: Dec 2021
Posts: 2
Rep Power: 0
broali is on a distinguished road
Hi Foamers,

I want to calculate the weighted average of a field in openfoam 9, but I realised that as opposed to the other version (e.g. openfoam 6 https://cpp.openfoam.org/v6/classFoa...ieldValue.html), there is no option for weightedAverage in surfaceFieldValue
(https://cpp.openfoam.org/v9/classFoa...ieldValue.html).
Any suggestion how can I calculate it for OpenFoam9?

Cheers
broali is offline   Reply With Quote

Old   November 21, 2022, 07:52
Default
  #2
New Member
 
Juan Pablo Carbajal
Join Date: Jun 2021
Posts: 17
Rep Power: 4
kakila is on a distinguished road
Any news on this? weightedSum also disappeared from OpenFoam v10. It was the easiest way to compute flows of a given phase in interFoam.

I tried areaIntegrate and areaAverage, but not getting the desired result.
Here an example that aims at computing the flow of water across a surface

Quote:
#include "include/caseParameters"

type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
writeFields no;

regionType patch;
name Outlet;

operation areaIntegrate;
fields (alpha.water);
The problem is that, that doesn't give the flow. The intended integrand would be of phi*alpha.water.
Before I could achieve this with weightedSum, using alpha.water as weighting field.

How to do this in OF10?

Update:
Looking at the docs here: https://cpp.openfoam.org/v10/classFo...e.html#details

I find that this seems to achieve the intended calculation
Quote:
#include "include/caseParameters"

type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");
writeFields no;

regionType patch;
name Inlet;

operation areaIntegrate;
fields (phi);
weightField alpha.water;
because the "weightField " is indeed processed.

Last edited by kakila; November 21, 2022 at 09:00. Reason: update
kakila is offline   Reply With Quote

Old   November 21, 2022, 12:32
Default
  #3
Senior Member
 
Join Date: Oct 2017
Posts: 121
Rep Power: 8
Krapf is on a distinguished road
Quote:
Weighted operations have been removed. Weighting for averages and sums is now triggered simply by the existence of the "weightField" or "weightFields" entry.
Source: https://github.com/OpenFOAM/OpenFOAM...b34102fff0c63f
kakila likes this.
Krapf is offline   Reply With Quote

Old   November 21, 2022, 12:35
Default
  #4
New Member
 
Ali Saei
Join Date: Dec 2021
Posts: 2
Rep Power: 0
broali is on a distinguished road
Thank you both for your help. Clear!
broali is offline   Reply With Quote

Old   February 22, 2023, 05:40
Default
  #5
zjy
New Member
 
Join Date: Jun 2022
Posts: 4
Rep Power: 3
zjy is on a distinguished road
Quote:
Originally Posted by kakila View Post
Any news on this? weightedSum also disappeared from OpenFoam v10. It was the easiest way to compute flows of a given phase in interFoam.

I tried areaIntegrate and areaAverage, but not getting the desired result.
Here an example that aims at computing the flow of water across a surface



The problem is that, that doesn't give the flow. The intended integrand would be of phi*alpha.water.
Before I could achieve this with weightedSum, using alpha.water as weighting field.

How to do this in OF10?

Update:
Looking at the docs here: https://cpp.openfoam.org/v10/classFo...e.html#details

I find that this seems to achieve the intended calculation

because the "weightField " is indeed processed.
On of9, I hope to use the following code to calculate the flow on a certain plane in the two-phase flow dambreak,

surfaceFieldValue2
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");

log true;
writeControl writeTime;
writeFields true;

surfaceFormat none;
regionType faceZone;
name flowrate2;

operation sum;

weightField alpha.water;

fields (phi);
}

but the following error occurs:
[2] --> FOAM FATAL ERROR:
[2] surfaceFieldValue surfaceFieldValue1: faceZone(flowrate1):
Unable to process internal faces for volume field alpha.water
Do you know how to solve it
zjy is offline   Reply With Quote

Old   July 3, 2023, 14:11
Default
  #6
Member
 
Julio Pieri
Join Date: Sep 2017
Posts: 96
Rep Power: 8
JulioPieri is on a distinguished road
Quote:
Originally Posted by zjy View Post
On of9, I hope to use the following code to calculate the flow on a certain plane in the two-phase flow dambreak,

surfaceFieldValue2
{
type surfaceFieldValue;
libs ("libfieldFunctionObjects.so");

log true;
writeControl writeTime;
writeFields true;

surfaceFormat none;
regionType faceZone;
name flowrate2;

operation sum;

weightField alpha.water;

fields (phi);
}

but the following error occurs:
[2] --> FOAM FATAL ERROR:
[2] surfaceFieldValue surfaceFieldValue1: faceZone(flowrate1):
Unable to process internal faces for volume field alpha.water
Do you know how to solve it
I know this is an old thread, but I believe the problem is related to the fact that alpha.water is not defined on faces. You have to first make cell/face fields available for each other, and then apply the surface field value

Check: faceZoneAverage function object does not work with field U,p etc.
JulioPieri is offline   Reply With Quote

Reply

Tags
openfoam 9, surfacefieldvalue, weighted average


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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 05:37
How to evaluate mass weighted average in Ansys CFD post processing SugarOnichan FLUENT 1 February 11, 2022 01:54
Converging Diverging Nozzle with dbnsTurbFoam Saleh Abuhanieh OpenFOAM Running, Solving & CFD 4 December 13, 2019 10:26
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 13:48
area weighted average or mass weighted average sa har Main CFD Forum 0 January 5, 2016 13:16


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