# Massflow Conservation Error through faceSet using swakExpression

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 July 28, 2014, 14:30 Massflow Conservation Error through faceSet using swakExpression #1 New Member   Luke Weaver Join Date: Apr 2013 Posts: 4 Rep Power: 5 I'm trying to use an arbitrary "box" to calculate the flux around an actuator disc (reduced-order wind turbine model). However, the calculation for massflow over each surface is not being conserved. The domain is a rectangular box with axial flow over a plane. The solver is simpleFoam. The interior box is 80 x 160 x 160 m, and the surfaces are selected using the topoSet with slave cells and faceset as follows: Code: ```{ name north1SlaveCells; type cellSet; action new; source expressionToCell; sourceInfo { expression "(pos().x<=60 && pos().y>=20 && pos().y<=180 && pos().z>=20 && pos().z<=180)"; } } { name north1; type faceSet; action new; source expressionToFace; sourceInfo { expression "(pos().x<=60 && pos().y>=20 && pos().y<=180 && pos().z>=20 && pos().z<=180)"; } }``` This is done for all six sides (top, bottom,south,east,west). Here's three of the faceSets shown in paraView. faceSet.jpg Imagine the box fitting inside these three with the other three faceSets filling in the open space. In the controlDict, I calculate the massflow: Code: ```PhiNorth1 { type swakExpression; valueType faceSet; variables "direction=vector(0,1,0);dir=direction/mag(direction);"; setName north1; //expression "U & Sf()"; //expression "phi * flip()"; expression "(U & direction) * area()"; autoInterpolate true; accumulations ( sum min //just for reference max //just for reference ); outputControlMode timeStep; outputInterval 10; verbose true; }``` I used the swak tutorial angledDuctImplicitTransient files to build my topoSetDict and controlDict files. I calculated the mass flow on each faceSet, and summing them should give Phi_In - Phi_Out = 0. After summing up the phi values on all faceSets, the values were Phi_In = 203,860 and sumPhi_Out 206,270, for a total difference of -2410.7 kg/s. Any help/tips/explanations for this error? EDIT: For the upstream and downstream faces, I use the U & Sf(). The phi*flip() condition didn't seem to work.

July 28, 2014, 17:34
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
Quote:
 Originally Posted by lukeweaver I'm trying to use an arbitrary "box" to calculate the flux around an actuator disc (reduced-order wind turbine model). However, the calculation for massflow over each surface is not being conserved. The domain is a rectangular box with axial flow over a plane. The solver is simpleFoam. The interior box is 80 x 160 x 160 m, and the surfaces are selected using the topoSet with slave cells and faceset as follows: Code: ```{ name north1SlaveCells; type cellSet; action new; source expressionToCell; sourceInfo { expression "(pos().x<=60 && pos().y>=20 && pos().y<=180 && pos().z>=20 && pos().z<=180)"; } } { name north1; type faceSet; action new; source expressionToFace; sourceInfo { expression "(pos().x<=60 && pos().y>=20 && pos().y<=180 && pos().z>=20 && pos().z<=180)"; } }``` This is done for all six sides (top, bottom,south,east,west). Here's three of the faceSets shown in paraView. Attachment 32645 Imagine the box fitting inside these three with the other three faceSets filling in the open space. In the controlDict, I calculate the massflow: Code: ```PhiNorth1 { type swakExpression; valueType faceSet; variables "direction=vector(0,1,0);dir=direction/mag(direction);"; setName north1; //expression "U & Sf()"; //expression "phi * flip()"; expression "(U & direction) * area()"; autoInterpolate true; accumulations ( sum min //just for reference max //just for reference ); outputControlMode timeStep; outputInterval 10; verbose true; }``` I used the swak tutorial angledDuctImplicitTransient files to build my topoSetDict and controlDict files. I calculated the mass flow on each faceSet, and summing them should give Phi_In - Phi_Out = 0. After summing up the phi values on all faceSets, the values were Phi_In = 203,860 and sumPhi_Out 206,270, for a total difference of -2410.7 kg/s. Any help/tips/explanations for this error? EDIT: For the upstream and downstream faces, I use the U & Sf(). The phi*flip() condition didn't seem to work.
My guess is that you're counting flows that are not perpendicular to the boundary. If your north1 is the red faceSet in your picture then there is one large patch for which your approach would work but several small ones where for instance a velocity (1 0.1 0.5) would yield a contribution "0.1*area()" although either "1*area()" or "0.5*area()" (depending on the side) would be appropriate
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 July 29, 2014, 12:13 #3 New Member   Luke Weaver Join Date: Apr 2013 Posts: 4 Rep Power: 5 Bernard, thanks for the reply. It turned out that was the issue. I fixed it by using (U & dir) * (Sf() & dir), which gave the correct mass flow from each side (confirmed using Paraview calculators). Now for another question: can you think of a reason that phi * flip() doesn't work?

July 29, 2014, 17:28
#4
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
Quote:
 Originally Posted by lukeweaver Bernard, thanks for the reply. It turned out that was the issue. I fixed it by using (U & dir) * (Sf() & dir), which gave the correct mass flow from each side (confirmed using Paraview calculators). Now for another question: can you think of a reason that phi * flip() doesn't work?
No idea.

Check how many faces are flipped by evaluating "flip()" with accumulations "min", "max" and "average"
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 August 1, 2014, 15:01 #5 New Member   Luke Weaver Join Date: Apr 2013 Posts: 4 Rep Power: 5 I'm now running into issues with different mesh configurations. When the cell size is something like (4.0 2.0 2.0), the massflow conservation calculation is fine. However, when the cell size isn't an integer, like (4.1667 2.6667 2.6667) or something similar, I'm getting some weird results in the massflow and area calculations. The attached image shows the faceSets that have misplaced cell faces. error_faceset.jpg It seems that this is an issue of the faceSet boundaries that are defined in the topoSetDict not landing evenly on the cell boundaries. So, a) is there a way to change the topoSetDict so that the faceSet moves until it can read the faces evenly, and/or b) is there a way to manipulate the swakExpression so that the cell irregularities don't affect the massflow calculations?

August 4, 2014, 06:33
#6
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
Quote:
 Originally Posted by lukeweaver I'm now running into issues with different mesh configurations. When the cell size is something like (4.0 2.0 2.0), the massflow conservation calculation is fine. However, when the cell size isn't an integer, like (4.1667 2.6667 2.6667) or something similar, I'm getting some weird results in the massflow and area calculations. The attached image shows the faceSets that have misplaced cell faces. Attachment 32778 It seems that this is an issue of the faceSet boundaries that are defined in the topoSetDict not landing evenly on the cell boundaries. So, a) is there a way to change the topoSetDict so that the faceSet moves until it can read the faces evenly, and/or b) is there a way to manipulate the swakExpression so that the cell irregularities don't affect the massflow calculations?
No idea what exactly happens but your "Lego-mesh" looks like a problem with the numeric comparison (if a number "looks" like 60 it may be something slightly different and 60==60 will fail). And as a consequence (this is a speculation) your face-zone and the slave-cell-zone may be inconsistent.

One way to be sure that they are consistent is to first create the cell-zone and instead of duplicating the rather complicated logical expression use it to create the face-zone with the simple expression "set(mySlaveZone)" (set is true if a cell belongs to the cellSet)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 Tags faceset, massflow, swak, toposet

 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 Bando STAR-CCM+ 1 June 21, 2012 05:09 CedricVH OpenFOAM 5 May 4, 2012 07:57 eRzBeNgEl CFX 0 May 5, 2011 09:46 Wooster CFX 5 March 16, 2007 21:08

All times are GMT -4. The time now is 04:15.

 Contact Us - CFD Online - Top