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

how to calculate mass flow distribution after bend

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 19, 2021, 03:33
Default how to calculate mass flow distribution after bend
  #1
New Member
 
jackjiang
Join Date: Feb 2020
Posts: 9
Rep Power: 4
jackjiang1989@gmail.com is on a distinguished road
Hello guys,
I'm simulating a liquid flow inside bend, see attachment, liquid (with temperature) flow into bend from the downside and flow out of bend in the upside.

There are 4 tubes both in the inlet and outlet, I want to calculate how much liquid flow from 1 tube in the inlet to the other 4 tubes in the outlet.

I plot the stream line, theoretically I can count how many stream line come from one tube to the other 4 tubes to calculate....

Anyone got any idea??

BR/Jack
Attached Images
File Type: jpg Capture1.jpg (81.9 KB, 9 views)
File Type: jpg Capture.jpg (97.4 KB, 8 views)
jackjiang1989@gmail.com is offline   Reply With Quote

Old   November 21, 2021, 16:24
Default after some struggling a solution done as follows
  #2
New Member
 
jackjiang
Join Date: Feb 2020
Posts: 9
Rep Power: 4
jackjiang1989@gmail.com is on a distinguished road
inspired by this post,
How to extract the coordinate of every single streamline

I export the streamline data from paraview,
1. Apply CellDatatoPointData filter on the StreamTracer filter (interpolate the SeedIds to points)
2. Export the pointdata as .csv file
3. Use the .csv file. calculate how many streamlines are from one inlet to the other outlets. Mass flow from the inlet to outlet, then could be estimated with the percentage from line number.

Here is an example script
Code:
Code:
import numpy as np
import pandas as pd

path = './sample_data10k.csv'
df = pd.read_csv(path)
df=df.loc[:,['Point ID','Points_0','Points_1','Points_2','SeedIds']]
df=df.loc[df.loc[:,'Points_2']>0.01,:]

center_point = [ [0, 0.0185], [0.016021, -0.00925], [-0.016021, -0.00925], [0, 0.0185+0.105], [0.016021, -0.00925+0.105], [-0.016021, -0.00925+0.105] ]
r=0.007

for i,p in enumerate(center_point):
    df.loc[:,'distance_p{}'.format(i)] = ((df.loc[:,'Points_0']-p[0])**2+(df.loc[:,'Points_1']-p[1])**2)**0.5

df_p0 = df.loc[df.loc[:,'distance_p0']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])
df_p1 = df.loc[df.loc[:,'distance_p1']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])
df_p2 = df.loc[df.loc[:,'distance_p2']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])
df_p3 = df.loc[df.loc[:,'distance_p3']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])
df_p4 = df.loc[df.loc[:,'distance_p4']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])
df_p5 = df.loc[df.loc[:,'distance_p5']<r].loc[:,['Point ID','SeedIds']].drop_duplicates(subset=['SeedIds'])

df_plist=[df_p0,df_p1,df_p2,df_p3,df_p4,df_p5]

def find_ID(L1,L2):
    memo=[]
    for i in L1:
        if i in L2:
            memo.append(i)
    return memo

for i in range(3):
    for j in range(3,6):
        print('df_p{x} to df_p{y}'.format(x=i,y=j))
        result_list = find_ID(np.array(df_plist[i]['SeedIds']), np.array(df_plist[j]['SeedIds']))
        print(result_list)
        print('number of streamlines => {}'.format(len(result_list)))

'''
output as follows,
df_p0 to df_p3
['5933', '8485', '141', '171', '370', '446', '968', '1156', '1169', '1358', '1561', '1684', '1729', '2246', '2723', '2741', '2871', '2973', '2989', '3128', '3650', '3710', '4420', '4565', '5303', '5436', '5644', '5873', '6030', '6163', '6360', '6528', '6621', '7708', '8187', '9045', '9382', '9471', '9554', '9587', '9592', '9608', '9895', '9912']
number of streamlines => 44
df_p0 to df_p4
['449', '520', '3384', '5014', '5779', '5782', '5814', '6591', '7307', '8496']
number of streamlines => 10
df_p0 to df_p5
['6424', '37', '200', '2685', '5017', '5443', '6140', '8427', '9426']
number of streamlines => 9
df_p1 to df_p3
['8507', '869', '913', '2273', '2291', '3291', '3788', '4848', '5536', '5572', '5583', '5674', '6463', '7270', '8941', '9597', '9810', '9911']
number of streamlines => 18
df_p1 to df_p4
['4638', '9849', '163', '266', '1100', '1275', '1586', '1854', '1880', '2386', '2552', '3077', '3476', '3806', '3809', '3850', '4479', '4546', '5041', '5123', '5186', '5531', '5585', '5710', '5717', '5911', '6588', '6903', '7022', '7376', '7537', '7755', '7942', '8253', '8612', '8760', '8810', '8937', '9233', '9708', '9962']
number of streamlines => 41
df_p1 to df_p5
[]
number of streamlines => 0
df_p2 to df_p3
['220', '900', '1408', '2776', '3932', '6039', '7489', '8090', '8353', '9234', '9497', '9823']
number of streamlines => 12
df_p2 to df_p4
[]
number of streamlines => 0
df_p2 to df_p5
['4399', '5834', '409', '657', '725', '989', '1110', '1307', '1685', '1936', '2392', '2442', '2477', '2833', '3251', '3426', '4029', '4808', '5125', '5661', '5775', '5798', '5872', '5961', '6014', '6054', '6120', '6152', '6778', '7155', '7454', '8148', '8317', '8328', '8936', '9124', '9511', '9686', '9729', '9772', '9885', '9977']
number of streamlines => 42

'''
jackjiang1989@gmail.com is offline   Reply With Quote

Old   November 22, 2021, 05:15
Default
  #3
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 563
Rep Power: 19
Yann will become famous soon enough
Hi,


I'm not sure to understand your goal. Why not just computing the flowrate in each outlet?


Yann
Yann is offline   Reply With Quote

Old   November 22, 2021, 07:08
Default
  #4
New Member
 
jackjiang
Join Date: Feb 2020
Posts: 9
Rep Power: 4
jackjiang1989@gmail.com is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hi,


I'm not sure to understand your goal. Why not just computing the flowrate in each outlet?


Yann
Hi Yann,
Thank for your reply, computing the flow for each outlet should be easy. Just integral the velocity with the surface...

But, I'm try to know how much fluid is flowing from the specific inlet tube to specific outlet tube.

For example, there are 3 tubes in the inlet and outlet, say the bottom, top-right, top left. I want to calculate how much fluid is flowing from bottom inlet tube to bottom outlet tube. It's a bit tricky.

Because these 3 tubes got different temperature, would like to calculate if there is not diffusion in the bend(only convection), what the temperature would be like for each tubes after the bend.

BR/Jack
jackjiang1989@gmail.com is offline   Reply With Quote

Reply

Tags
openfoam, paraview, post processing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Calculate Mass Flowrate and Mass Flow Averaged Total Pressure at inlet and outlet coolcrasher OpenFOAM Post-Processing 7 November 4, 2021 05:57
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 07:40
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Discrete Phase & Mass Flow Rate MagnusZeus FLUENT 0 December 2, 2011 18:57
how to calculate mass flow at pressure boundary Hugo FLUENT 2 October 11, 2007 16:22


All times are GMT -4. The time now is 08:32.