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

Split Mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 13, 2010, 12:42
Default Split Mesh
  #1
Member
 
Join Date: Mar 2010
Posts: 42
Rep Power: 16
lindner is on a distinguished road
Hi,
I need to get the weighted average value of a variable in two different zones. How can i split the mesh like zone1 (upper part) and zone2 (lower part) to get these results?

The actual code that im using is:
scalar averageT = T.weightedAverage(mesh.V()).value();

but as you can see it gets the whole mesh values.

Is it possible to specify like mesh.V(zone1) and mesh.V(zone2) ?
If its possible how can i divide the mesh? im using blockMesh with several blocks.

Any other suggestion on how to collect these results?

Thanks,
Guilherme
lindner is offline   Reply With Quote

Old   September 13, 2010, 14:31
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
You could look at using cellSet and something like boxToCell. I had to do something similar recently to calculate the weighted average of a variable within a certain area of the mesh.

I've attached the files if you're interested.
Attached Files
File Type: gz holdupCalculator.tar.gz (2.3 KB, 8 views)
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 14, 2010, 06:58
Default
  #3
Member
 
Join Date: Mar 2010
Posts: 42
Rep Power: 16
lindner is on a distinguished road
Hi Laurence!
Thank you for the fast answer and the calculator!
I compiled it and it seems to be working, but my output is like this:

Code:
Create time

Create mesh for time = 0

Time = 0
Reading holdupCalculationDict
Time = 500
Reading holdupCalculationDict
Time = 1000
Reading holdupCalculationDict

ExecutionTime = 9.08 s  ClockTime = 10 s

End
Nothing is generated or changed. Should I do some preparation on my mesh before or just the holdupCalculation file in the /system is enough?

Thanks,
Guilherme
lindner is offline   Reply With Quote

Old   September 14, 2010, 07:18
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
I've quickly made it more general to average any variable (see attached).

You'll have to change the name of the variable in holdupCalculation and the dimensions of the box you're averaging the variable in. The variable must be in the time folders for anything to be output.

If you want a shape other than a box you'll have to alter the code slightly.
Attached Files
File Type: gz holdupCalculator.tar.gz (2.3 KB, 14 views)
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 14, 2010, 08:40
Default
  #5
Member
 
Join Date: Mar 2010
Posts: 42
Rep Power: 16
lindner is on a distinguished road
Now it worked perfectly! You did a great job with this code.
Thank you a lot Laurence.

Guilherme
lindner is offline   Reply With Quote

Old   September 14, 2010, 09:01
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
No problem, be careful with it. It's a good idea to work out a rough estimate for the average to make sure it's calculating it correctly.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Reply

Tags
blockmesh split 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
[Gmsh] 2D Mesh Generation Tutorial for GMSH aeroslacker OpenFOAM Meshing & Mesh Conversion 12 January 19, 2012 04:52
[ICEM] Split wall hexa mesh Anorky ANSYS Meshing & Geometry 2 March 21, 2010 11:33
2d irregular grid Remy Main CFD Forum 1 December 22, 2008 05:49
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
basic of mesh refinement arya CFX 4 June 19, 2007 13:21


All times are GMT -4. The time now is 01:33.