
[Sponsors] 
how to calculate mass flow distribution after bend 

LinkBack  Thread Tools  Search this Thread  Display Modes 
November 19, 2021, 02:33 
how to calculate mass flow distribution after bend

#1 
New Member
jackjiang
Join Date: Feb 2020
Posts: 10
Rep Power: 5 
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 

November 21, 2021, 15:24 
after some struggling a solution done as follows

#2 
New Member
jackjiang
Join Date: Feb 2020
Posts: 10
Rep Power: 5 
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 ''' 

November 22, 2021, 04:15 

#3 
Senior Member
Yann
Join Date: Apr 2012
Location: France
Posts: 802
Rep Power: 24 
Hi,
I'm not sure to understand your goal. Why not just computing the flowrate in each outlet? Yann 

November 22, 2021, 06:08 

#4  
New Member
jackjiang
Join Date: Feb 2020
Posts: 10
Rep Power: 5 
Quote:
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, topright, 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 

June 5, 2023, 08:33 

#5 
New Member
RJ
Join Date: Jun 2023
Posts: 1
Rep Power: 0 
Hi,
Thank you for posting this, I'm trying to do that same exact thing, could you explain your code a bit more? Did you choose the seed points for your streamlines or are they randomly seeded? 

June 7, 2023, 04:51 
passive scalar?

#6 
New Member
Join Date: Apr 2018
Posts: 8
Rep Power: 7 
Hi,
I think you can do what you want by tracing a passive scalar from inlet 1 to the other inlets. I think that is more conservating than the streamline approach. br. Torjo 

June 9, 2023, 10:40 

#7 
New Member
jackjiang
Join Date: Feb 2020
Posts: 10
Rep Power: 5 
hi,
as far as I can remember Position of seeds points are decided by seed Type in paraview (you can use point cloud or line and set the position), but it doesn't matter I think as long as you can get many "long enough" streamline pass from inlet to outlet. The code above basically is checking 1. area of inlet 1 how many streamline points 2. area of outlet1 how many streamline points same as inlet1, then these points travel from inlet1 to outlet1 3. area of outlet2 how many streamline points same as inlet1, then these points travel from inlet1 to outlet2 then inlet1 outlet3 then inlet2 outlet1, inlet2 outlet2.... 

Tags 
openfoam, paraview, post processing 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Calculate Mass Flowrate and Mass Flow Averaged Total Pressure at inlet and outlet  coolcrasher  OpenFOAM PostProcessing  7  November 4, 2021 04:57 
Issues on the simulation of highspeed compressible flow within turbomachinery  dowlee  OpenFOAM Running, Solving & CFD  11  August 6, 2021 06:40 
Low Mixing time Problem  Mavier  CFX  5  April 29, 2013 00:00 
Discrete Phase & Mass Flow Rate  MagnusZeus  FLUENT  0  December 2, 2011 17:57 
how to calculate mass flow at pressure boundary  Hugo  FLUENT  2  October 11, 2007 15:22 