|
[Sponsors] |
[swak4Foam] Mass flow rate through faceSet using swak4foam |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Member
Cedric Van Holsbeke
Join Date: Dec 2009
Location: Belgium
Posts: 81
Rep Power: 16 ![]() |
It is not possible to calculate the mass flow rate through a faceSet in standard OpenFOAM. This is because the normal vectors of the faces have a random position, giving a result close to 0. Even after converting the set to cyclic patches using createBaffles, this problems persists as the normal vectors of the created patches do not have the same direction, unlike normal boundary patches.
However, I have read that swak4foam can help by using the flip() function: Code:
flow_pipe { type swakExpression; valueType faceSet; setName pipe_plane_faces; expression "phi*flip()"; accumulations ( sum ); verbose true; autoInterpolate true; } My workflow is:
Code:
cellSet pipe_plane_facesSlaveCells new faceToCell pipe_plane_faces all Code:
--> FOAM FATAL ERROR: One of owner or neighbour of internal face 108712 should be in cellSet pipe_plane_facesSlaveCells to be able to determine orientation. Face:108712 own:38634 OwnInCellSet:1 nei:39797 NeiInCellSet:1 From function scalarField *FaceSetValueExpressionDriver::makeFaceFlipField() in file FaceSetValueExpressionDriver.C at line 233. Is my workflow correct or is there a much better workflow to correctly measure the mass flow rate through a faceSet/faceZone? If my workflow is correct, how can I manage to make the case run and get correct results? |
|
![]() |
![]() |
![]() |
![]() |
#2 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
An example: assume that your faceSet is the Bruxelles city-limit and you want to calculate the flow of phi out of Bruxelles. For the reason you gave above just summing up won't do it. Then for instance you could define whole Bruxelles as the slaveCells (the name is EXTREMLY unfortunate here). It is only important that each face in the set has ONE cell that is in the slaveCells. That way it knows which is the direction "to town" and calculates the flip() accordingly. Not every slaveCell has to be at the city-limits Quote:
Just one possibility (this might be computationally more expensive and it involves interpolation so you might have a small error): the sampled surfaces in OpenFOAM have one type sampledTriSurfaceMesh which is defined by an STL (which you have). And swak can calculate on sampledSurfaces. Of course you can't use phi (surfaceFields can't be interpolated) but you'll have to calculate the equivalent from U and the area (possibly rho if you're compressible) |
|||
![]() |
![]() |
![]() |
![]() |
#3 | |
Member
Cedric Van Holsbeke
Join Date: Dec 2009
Location: Belgium
Posts: 81
Rep Power: 16 ![]() |
Quote:
|
||
![]() |
![]() |
![]() |
![]() |
#4 |
Member
Cedric Van Holsbeke
Join Date: Dec 2009
Location: Belgium
Posts: 81
Rep Power: 16 ![]() |
I did not manage to get a correct mass flow rate through the faceSet using the flip() function. I'm going to visualise my problem using images.
The first attachment (faceSet_pipe.png) shows the system. At the right side there is an inlet that is connected through a pipe to a faceSet. This faceSet includes one layer of faces, thus sum(phi) inlet should be equal to sum(phi) faceSet. However, this is not the case: Code:
Expression flow_inlet : sum=-2.94504858156e-07 Expression flow_faceSet_noFlip : sum=-2.07518040304e-07 The next step is to use the flip() function of swak4foam to correct this problem. In order calculate the flipMap, a slaveCellSet should be defined. This cellSet should be on one side of the faceSet en should include these faces. In the second image (faceSet.jpg), you see a detailed view of the the faceSet, in the third image (faceSetSlaveCellSet.jpg) you see the faceSet and the slaveCellSet. The total system is now given in the fourth image (faceSetSlaveCellSet.png). If I now calculate the mass flow through this faceSet using the flip() function, I get: Code:
Expression flow_inlet : sum=-2.94504858156e-07 Expression flow_faceSet_noFlip : sum=-2.07518040304e-07 Expression flow_faceSet_flip : sum=-5.78237927163e-08 Is there something that I missed? |
|
![]() |
![]() |
![]() |
![]() |
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
BTW: sum(phi + phi*flip()) can't be equal to the inflow as you're summing up f*phi with f either being 0 or 2 (depending on the flip value) Currently I have no idea what could be the problem. What I usually recommend is testing your method with a very simple blockMesh-channel because there it is easier to see what the matter is BTW2: I assume that you're doing a steady simulation. Because for a transient simulation the mass-flows at a point in time do not necessarily have to be equal (in average they are). But even that would not explain the huge diffeence you have |
||
![]() |
![]() |
![]() |
![]() |
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 ![]() ![]() |
Quote:
In the File Libraries/swak4FoamParsers/FaceSetValueExpressionDriver.C look for the line SortableList<label> faceLabels(faceSet_->toc()); and replace it with List<label> faceLabels(faceSet_->toc()); The fix has also been pushed to the mercurial-repository. BTW: took me some time to find this posting again. That's why I appreciate it very much if people report such problems on the Mantis. Because that way I'm sure those interested get notified once I fixed it |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mass flow rate boundary condition with negative values | hebe2u. | CFX | 1 | December 27, 2016 03:53 |
Pressure Outlet Targeted Mass Flow Rate | LuckyTran | FLUENT | 1 | November 23, 2016 10:40 |
Mass Flow rate in DPM model | tohidtkz | FLUENT | 0 | November 7, 2015 04:13 |
Mass flow rate boundary condition with negative values | ashtonJ | CFX | 3 | November 26, 2014 05:21 |
Mass flow rate | sepidecent | CFX | 0 | August 9, 2011 00:15 |