CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

CFX Post Velocity in Tubes in Shell-and-Tube-Heat-Exchanger

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

Like Tree2Likes
  • 1 Post By Gert-Jan
  • 1 Post By TimNum

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 19, 2019, 08:15
Default CFX Post Velocity in Tubes in Shell-and-Tube-Heat-Exchanger
  #1
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Hey guys,


I am trying to figure out the (areaAveraged) average tube velocity in a shell and tube heat exchanger in each tube. As you can see in the attachments I have a contour plot showing the velocities graphically, but I want these as a number for each tube. How can I achieve this?


In ANSYS Meshing each whole tube is a named selection. So somehow splitting the contour plot into each plane would be an option. Or finding the intersecton between the 50mm plane from the picture below and the tube. Problem is, I don't know how to do this Can anyone tell me how to find the intersection between two locations?



Does anyone have an idea how to get the average velocity in each tube considering these aren't sepeate bodies (the tube bundle is 1 body with a named selection for each tube volume).
Attached Images
File Type: png TubeAverageLocation.PNG (66.2 KB, 11 views)
File Type: jpg CFX2.jpg (131.8 KB, 11 views)
TimNum is offline   Reply With Quote

Old   March 19, 2019, 08:52
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,285
Rep Power: 25
Opaque will become famous soon enough
Very likely the meshing software created a set of faces for each independent tube.

In CFD-Post, open the "Mesh Regions" folder and see if you can identify a tube by name. If you can identify them, try to compute the calculation using such names.
Opaque is offline   Reply With Quote

Old   March 19, 2019, 09:02
Default
  #3
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
You are right, I could use these but whenever I change the mesh those names change as well and I need to throw my postprocessing away.


Are there any suggestens for a more systematical approach?
TimNum is offline   Reply With Quote

Old   March 19, 2019, 11:38
Default
  #4
Senior Member
 
Join Date: Jun 2009
Posts: 1,285
Rep Power: 25
Opaque will become famous soon enough
Are the named selections in the meshing software listed under "Mesh Regions"?

Those should not change under mesh changes, correct? they should only change under geometric model changes, i.e. more tubes/less tubes
Opaque is offline   Reply With Quote

Old   March 19, 2019, 17:50
Default
  #5
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
I would

1) define plane by a point and a normal. Set the point in the center of the tube that you want to investigate. Set the normal to 0 0 1
2) limit the plane using a circle. Make sure it is just a little larger than the diameter of the tube.
3) go to the calculator and use this plane to determine the areaAve(Velocity)

You can increase the limit to capture multiple tubes. You can also use a rectangular limit to take a row of tubes.

Good luck, GertJan
Gert-Jan is offline   Reply With Quote

Old   March 20, 2019, 04:24
Default
  #6
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Are the named selections in the meshing software listed under "Mesh Regions"?

Those should not change under mesh changes, correct? they should only change under geometric model changes, i.e. more tubes/less tubes

Well I have my named selection "tubeID" in the named selections, as you can see below. But this is the whole tube, I can use volumeAve(Velocity)@tube1 for example to get the average velocity over the whole tube.


What I want is the average velocity at a plane (e.g. 50 mm downstream of tube inlet) for ALL 1200 tubes.


I basically want to be able to this:

areaAve(Velocity)@Plane50mmTube1
areaAve(Velocity)@Plane50mmTube2
areaAve(Velocity)@Plane50mmTube3 etc.


I don't have this plane Plane50mmTube1 yet. Doing these manually is not an option because of scale and I want to be able to use the same postprocessing for different exchangers without producing 1200 planes manually every time. I need some kind of script / semi-automatic method.
Attached Images
File Type: png TubesMeshregion.PNG (6.4 KB, 3 views)
TimNum is offline   Reply With Quote

Old   March 20, 2019, 04:26
Default
  #7
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
I would

1) define plane by a point and a normal. Set the point in the center of the tube that you want to investigate. Set the normal to 0 0 1
2) limit the plane using a circle. Make sure it is just a little larger than the diameter of the tube.
3) go to the calculator and use this plane to determine the areaAve(Velocity)

You can increase the limit to capture multiple tubes. You can also use a rectangular limit to take a row of tubes.

Good luck, GertJan

I did this for a single plane manually but for 1200 tubes this is by far too much effort. And when I am switching to a different heat exchanger I would need to do it all over again. There has to be a smarter way
Attached Images
File Type: png SingleTubePlane.PNG (21.5 KB, 4 views)
TimNum is offline   Reply With Quote

Old   March 20, 2019, 04:45
Default
  #8
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
I don't get it.
Is each tube a unique volume? And you want the average velocity in each volume?
Or (given your expression: areaAve(Velocity)@Plane50mmTube1) do you want to know the velocity in each tube where it intersects Plane 50 mm?

And, aren't the answers (more or less) the same?
Gert-Jan is offline   Reply With Quote

Old   March 20, 2019, 05:15
Default
  #9
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
If your tubes are separate volumes, then you could set up a table. In cell 1, you set the expression volumeAve(Velocity)@tube0001

Then go to the table in the report in the tree on the left hand side, use your RMB, and select Edit in Command Editor. You will find the code for the table as text.
Import the command for the contents of your first cell in to Excel.
Then copy and modify this 1200 times, or as many tube as you have. I assume you are smart enough to do this ;-)

Then:
- paste the text from Excel in the Command editor of the table.
- save the state file to something like state.cst
- Close Post (I would not recommend to open the table. Not sure if it can hadle 1200 cells)
- Open a command editor through the CFX-launcher
- type cfx5post -report -res filename -t state.cst

It will create a table in html format with all your numbers.

Uncertainties:
- I don't know it there is a limit for the number of rows of the table in Post. So I would first try it with a limited number of rows.
- Alternatively, put the numbers in the other columns.
- I don't know how long it will take for Post to calculate all 1200 tubes. Again, do a test with smaller numbers.
Gert-Jan is offline   Reply With Quote

Old   March 20, 2019, 05:24
Default
  #10
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
I don't get it.
Is each tube a unique volume? And you want the average velocity in each volume? (method 1)
Or (given your expression: areaAve(Velocity)@Plane50mmTube1) do you want to know the velocity in each tube where it intersects Plane 50 mm? (method 2)

And, aren't the answers (more or less) the same?

I want both. But for the volume I already have the answer. But for a variety of reasons I would prefer to use method 2



And yes, the answers are more or less the same. For the tube I showed you above I have volumeAverage of 0.64 m/s (method 1) and for the areaAve at 50mm 0.663 m/s (method 2).



Method 1 is just a workaround to roughly get the same numbers. Method 2 is sth. I am generally interested in for other problems where the difference is bigger as well as this one here.
TimNum is offline   Reply With Quote

Old   March 20, 2019, 05:30
Default
  #11
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
If your tubes are separate volumes, then you could set up a table. In cell 1, you set the expression volumeAve(Velocity)@tube0001

Then go to the table in the report in the tree on the left hand side, use your RMB, and select Edit in Command Editor. You will find the code for the table as text.
Import the command for the contents of your first cell in to Excel.
Then copy and modify this 1200 times, or as many tube as you have. I assume you are smart enough to do this ;-)

Then:
- paste the text from Excel in the Command editor of the table.
- save the state file to something like state.cst
- Close Post (I would not recommend to open the table. Not sure if it can hadle 1200 cells)
- Open a command editor through the CFX-launcher
- type cfx5post -report -res filename -t state.cst

It will create a table in html format with all your numbers.

Uncertainties:
- I don't know it there is a limit for the number of rows of the table in Post. So I would first try it with a limited number of rows.
- Alternatively, put the numbers in the other columns.
- I don't know how long it will take for Post to calculate all 1200 tubes. Again, do a test with smaller numbers.

For method 1 I am using Power Syntax and CFX-5Post in Batchmode, somewhat similar to what you described but without using tables.


Code:
COMMAND FILE:
  CFX Post Version = 19.0
END

LIBRARY:
CEL:
EXPRESSIONS:
    Tubevelocity1 = volumeAve(Velocity)@Tube1
    Tubevelocity2 = volumeAve(Velocity)@Tube2
    Tubevelocity3 = volumeAve(Velocity)@Tube3
END
END
END

!#Evaluate to Perl for variable output to file
!my $filename = 'D:\User\Tim\03_Postprocessing\20190311_Reference\Output.txt';
!open(FH, '>', $filename) or die $!; 
!for ($i = 1; $i < 300; $i += 1) {
!#print FH "test\n";
!     $tubeVelo = volumeAve("Velocity", "Tube$i");
!    print FH "$i;$tubeVelo\n";
!}
!close(FH);

300 tubes to date are just a test to limit the model
TimNum is offline   Reply With Quote

Old   March 20, 2019, 06:11
Default
  #12
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
You can code something similar for a plane inside the tube with a circular limit. Just reposition the plane in a loop. What you need as input are the xy coordinates of each tube.
Gert-Jan is offline   Reply With Quote

Old   March 20, 2019, 08:06
Default
  #13
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
You can code something similar for a plane inside the tube with a circular limit. Just reposition the plane in a loop. What you need as input are the xy coordinates of each tube.

Okay, the problem is I need to figure the center (x,y) coordinate of each tube out by hand in my CAD model, which als sucks


My colleagues working with other programs have 0 problems doing this, so I hoped that CFX-Post can do this as well without programming as much as I am already doing
TimNum is offline   Reply With Quote

Old   March 20, 2019, 08:22
Default
  #14
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
Per row, the tubes have a constant mutual distance. So, that should not be too difficult to program in Power Syntax.....
TimNum likes this.
Gert-Jan is offline   Reply With Quote

Old   March 20, 2019, 09:13
Default
  #15
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
Per row, the tubes have a constant mutual distance. So, that should not be too difficult to program in Power Syntax.....

Right, you already had me convinced in your last post. I will give it a try in Power Syntax and post the results. I just wanted to avoid programming overall if not necessary
TimNum is offline   Reply With Quote

Old   March 20, 2019, 17:31
Default
  #16
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 16,472
Rep Power: 128
ghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the roughghorrocks is a jewel in the rough
If you don't like perl (I don't for instance ) you can just write it out longhand in a big CEL text file. And the big CEL text file can be generated by anything which writes text files, such as python, VB or anything.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   March 27, 2019, 07:20
Default
  #17
New Member
 
Tim Dorau
Join Date: Mar 2019
Posts: 10
Rep Power: 3
TimNum is on a distinguished road
Quote:
Originally Posted by Gert-Jan View Post
Per row, the tubes have a constant mutual distance. So, that should not be too difficult to program in Power Syntax.....
I created a plane by using the point and normal method and move it along the row.

The file I read in at the start contains the center x/y-coordinates and the number of tubes per row. Variable names and Comments in German I basically iterate through each row and move the measurement plane along and calculate my velocity on that plane. While doing that I write results to another file.

Code:
COMMAND FILE:
  CFX Post Version = 19.0
END

!my $OUTfilename = 'D:\Benutzer\Tubevelocities.txt';
!my $infilename = 'D:\Benutzer\0001_PostPlanes.txt';

# Abstand der Tubes zueinander in einer Reihe
!$tubeAbstand = 0.0449;

## Inputfile und OUTputfile oeffnen
!open(OUT, '>', $OUTfilename) or die $!; 
!open my $in, "<:encoding(utf8)", $infilename or die "$infilename: $!";

#Inputfile Zeile für Zeile lesen
! $aktuelleReihe = 1;                    # Bei welcher Reihe ist die Iteration aktuell?
!while (my $line = <$in>) {
    !chomp $line;                        # Einzelne Zeile betrachten
    !my @fields = split /;/, $line;     # String am ; spalten und in Arry speichern
    !my $planeX = $fields[0];            # x-Koordinate des Rohrs am Rand
    !my $planeY = $fields[1];            # y-Koordinate des Rohrs am Rand
    !my $tubesPerRow = $fields[2];        # Anzahl der Tubes pro Reihe 
    !my $planeZ = 6.928;                # z-Koordinate: Haendisch festgelegter Ort der Ebene
    
    !for ($i = 1; $i < $tubesPerRow + 1; $i += 1) {
        PLANE:RohrEbene
          Apply Instancing Transform = On
          Apply Texture = Off
          Blend Texture = On
          Bound Radius = 10 [mm]
          Colour = 0.75, 0.75, 0.75
          Colour Map = Default Colour Map
          Colour Mode = Constant
          Colour Scale = Linear
          Colour Variable = Pressure
          Colour Variable Boundary Values = Hybrid
          Culling Mode = No Culling
          Direction 1 Bound = 1.0 [m]
          Direction 1 Orientation = 0 [degree]
          Direction 1 Points = 20
          Direction 2 Bound = 1.0 [m]
          Direction 2 Points = 30
          Domain List = /DOMAIN GROUP:All Domains
          Draw Faces = Off
          Draw Lines = Off
          Instancing Transform = /DEFAULT INSTANCE TRANSFORM:Default Transform
          Invert Plane Bound = Off
          Lighting = On
          Line Colour = 0, 0, 0
          Line Colour Mode = Default
          Line Width = 1
          Max = 0.0 [Pa]
          Min = 0.0 [Pa]
          Normal = 0 , 0 , 1
          Option = Point and Normal
          Plane Bound = Circular
          Plane Type = Sample
          Point = $planeX [m], $planeY [m], $planeZ [m]
          Point 1 = 0 [m], 0 [m], 0 [m]
          Point 2 = 1 [m], 0 [m], 0 [m]
          Point 3 = 0 [m], 1 [m], 0 [m]
          Range = Global
        END
        !$planeX = $planeX - $tubeAbstand;
        !$tubeVelo = massFlowAve("Velocity", "RohrEbene");
        !print OUT "$aktuelleReihe;$i;$tubeVelo;$planeX;$planeY\n";
    !}
    
    !$aktuelleReihe = $aktuelleReihe + 1;    # Die Reihe um eins Hochsetzen
!}
!close $in;
!close(OUT);

Thanks. This solution is really important
Gert-Jan likes this.
TimNum is offline   Reply With Quote

Old   March 27, 2019, 07:32
Default
  #18
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,226
Rep Power: 20
Gert-Jan will become famous soon enough
Vielen Dank für das Teilen dieses Codes
Gert-Jan is offline   Reply With Quote

Reply

Tags
cfxpost, heatexchanger, postprocessing

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
Shell & Tube Heat Exchanger Ansys CfX (FYP) eyeNa07 CFD Freelancers 2 May 28, 2016 07:18
How to carry out 3D shell and Tube Heat Exchanger analysis in fluent medogalal FLUENT 3 December 30, 2015 05:28
Error in CFX Solution for Shell and Tube Heat Exchanger Shomaz ul Haq CFX 3 October 13, 2015 11:49
shell and tube heat exchanger... ganesh chakravarthi CFX 3 July 6, 2015 19:44
Analysis of shell and tube heat exchanger in Ansys Dena FLUENT 0 June 12, 2015 14:39


All times are GMT -4. The time now is 02:37.