# Split Mesh

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

 September 13, 2010, 11:42 Split Mesh #1 Member   Join Date: Mar 2010 Posts: 42 Rep Power: 7 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

September 13, 2010, 13:31
#2
Senior Member

Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
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
 holdupCalculator.tar.gz (2.3 KB, 6 views)
__________________
Laurence R. McGlashan :: Website

 September 14, 2010, 05:58 #3 Member   Join Date: Mar 2010 Posts: 42 Rep Power: 7 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

September 14, 2010, 06:18
#4
Senior Member

Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
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
 holdupCalculator.tar.gz (2.3 KB, 12 views)
__________________
Laurence R. McGlashan :: Website

 September 14, 2010, 07:40 #5 Member   Join Date: Mar 2010 Posts: 42 Rep Power: 7 Now it worked perfectly! You did a great job with this code. Thank you a lot Laurence. Guilherme

 September 14, 2010, 08:01 #6 Senior Member   Laurence R. McGlashan Join Date: Mar 2009 Posts: 370 Rep Power: 14 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

 Tags blockmesh split average

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post aeroslacker Open Source Meshers: Gmsh, Netgen, CGNS, ... 12 January 19, 2012 04:52 [ICEM] Split wall hexa mesh Anorky ANSYS Meshing & Geometry 2 March 21, 2010 11:33 Remy Main CFD Forum 1 December 22, 2008 05:49 SSL FLUENT 2 January 26, 2008 12:55 arya CFX 4 June 19, 2007 12:21

All times are GMT -4. The time now is 13:38.