|
[Sponsors] |
January 19, 2016, 18:56 |
Calculate flux across surface
|
#1 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Dear all,
I have got the simulation results for the velocity field along time. Now I need to compute the integral of U over a plane (that is not a patch) defined by its basePoint and normalVector. I have exhausted all the possibilities I could imagine using execFlowFunctionObjects and swak4Foam. Could you please shed some light on how to do it? Thanks, Thomas |
|
January 20, 2016, 06:16 |
|
#2 |
Senior Member
|
I think this should it be possible with ParaView?
|
|
January 20, 2016, 08:04 |
|
#3 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
||
January 20, 2016, 09:05 |
|
#4 |
Senior Member
|
Maybe sample could work, probably still requires ParaView, but this may reduce the workload:
Use sample to generate vtk file for each time step only with U variable > Optionally use the foamSequenceVTKFiles script to rename the files in sequenced order > start ParaView > Open the sequenced files > integrateVariables > save Data (all time steps). This may need some additional work to get everything in one file. I do not know about current OpenFOAM tools that do this right now. If anyone does, feel free to comment. Regards, Tom |
|
January 20, 2016, 12:44 |
|
#5 | |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Quote:
Code:
functions { flux { type faceSource; functionObjectLibs ("libfieldFunctionObjects.so"); enabled true; outputControl outputTime; surfaceFormat off; // Output to log&file (true) or to file only log true; // Output field values as well valueOutput true; // Type of source: patch/faceZone/sampledSurface source sampledSurface; //// if sampledSurface: dictionary with a sampledSurface //// Note: will not sample surface fields. sampledSurfaceDict { type plane; basePoint (8.1e-4 0 0); normalVector (1 0 0); interpolate false; } operation areaNormalIntegrate; fields ( U ); } } Use it executing: Code:
execFlowFunctionObjects -dict system/integrateOnSurfaceDict -noFlow I tried also using cuttingPlane instead of plane, and interpolate true, and got slightly different results. If I put the plane over a patch, the usage of plane and interpolate false gave the same result as running Code:
patchIntegrate U <patchName> Thomas |
||
January 20, 2016, 12:46 |
|
#6 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
||
January 21, 2016, 04:23 |
|
#7 |
Senior Member
|
Thank you for pointing out the sampledSurface option, was not aware of that. I thought only patches and faceZones were possible.
|
|
October 1, 2016, 10:14 |
|
#8 | |
Senior Member
A. Min
Join Date: Mar 2015
Posts: 308
Rep Power: 12 |
Quote:
I want to calculate the heat flux over a plane. I have computed gradT before that. Is your code appropriate for my goal? What about calculation of flux over a cylinder perimeter? Thanks |
||
June 27, 2018, 07:13 |
|
#9 | |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Quote:
Code:
functions { flux { functionObjectLibs ("libfieldFunctionObjects.so"); type surfaceFieldValue; enabled true; writeControl outputTime; writeInterval 1; writeFields false; name myName; // regionType: patch/faceZone/sampledSurface regionType sampledSurface; sampledSurfaceDict { type plane; planeType pointAndNormal; pointAndNormalDict { point (0.1 0 0); normal (1 0 0); }; interpolate false; } // Operation: areaAverage/sum/weightedAverage/... operation areaNormalIntegrate; fields ( U ); } } Code:
postProcess -fields "(U)" -dict system/integrateOnSurfaceDict Thomas |
||
July 18, 2018, 15:49 |
|
#10 |
New Member
Clint
Join Date: Sep 2015
Posts: 10
Rep Power: 11 |
There is no 'flux' function in my installation. I checked the other versions and it's not there either. Is that something that you made?
When I run it I get a warning that that function 'flux' doesn't exist. EDIT: Really sorry this worked great. I messed up copying your functionObject text. Last edited by cdunn6754; July 18, 2018 at 15:55. Reason: Original comment is erroneous. |
|
November 8, 2018, 09:55 |
OpenFoam
|
#11 |
New Member
Manaf Muhammed
Join Date: Oct 2018
Posts: 21
Rep Power: 8 |
when iam running the script iam getting error
[2] --> FOAM FATAL IO ERROR: [2] keyword sourceName is undefined in dictionary "IOstream.functions.flux" [2] [2] file: IOstream.functions.flux[13] [13] [13] --> FOAM FATAL IO ERROR: from line 0 to line 0. [2] [2] From function dictionary::lookupEntry(const word&, bool, bool) const [2] in file db/dictionary/dictionary.C at line 442. [2] FOAM parallel run exiting [2] [6] [6] [8] [8] [8] --> FOAM FATAL IO ERROR: [8] keyword sourceName is undefined in dictionary "IOstream.functions.flux" [8] [8] file: IOstream.functions.flux from line 0 to line 0. please help |
|
November 8, 2018, 10:03 |
|
#12 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
No 'sourceName' was required when I ran it. Did you try providing a sourceName? The syntax for it is similarly to how 'name' is provided.
|
|
November 19, 2018, 04:24 |
|
#13 |
New Member
Martin Rønnov Andersen
Join Date: Oct 2018
Location: Aalborg, Denmark
Posts: 10
Rep Power: 8 |
What if one is to find the flux for each cell, at a specific plane? I did get this to work but the output i get is the flux for the entire plane.
|
|
November 19, 2018, 06:48 |
|
#14 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Dear Martin,
I looked for "areaNormalIntegrate" in OF source code and found the file .src/functionObjects/field/fieldValues/surfaceFieldValue/surfaceFieldValue.C. This may give you a clue on how to do it. I would first try to replace "operation areaNormalIntegrate;" with operation none;" to see what I get. From the source code, it seems that this operation would write the field. Kind regards, Thomas |
|
November 19, 2018, 08:04 |
|
#15 |
New Member
Martin Rønnov Andersen
Join Date: Oct 2018
Location: Aalborg, Denmark
Posts: 10
Rep Power: 8 |
Hey Thomas,
I tried the following code. By doing it this way, i can specify which cells, in the y-direction, i want to extract information from. Code:
const volVectorField& C = mesh.C(); forAll(U, celli) { const vector& Ci = C[celli]; if (mag(Ci.x() - 0.35) <= 0.003) { } } The only thing i´m able to extract is the velocities. What i need is either the flux or area of each cell - It is a 2D simulation so i would get the area in length. Can you give me a pointer of how to extract this? I tried mesh.magSf().boundaryField() but it didn´t work. /Martin |
|
November 19, 2018, 09:41 |
|
#16 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Are these faces internal or external? mesh.magSf().boundaryField() gives access to external faces.
|
|
November 20, 2018, 05:31 |
|
#17 |
New Member
Martin Rønnov Andersen
Join Date: Oct 2018
Location: Aalborg, Denmark
Posts: 10
Rep Power: 8 |
It is internal, so that would explain why the mesh.magSf().boundaryField() doesn´t work.
I got it working to some extend. I am able to extract the volume and velocity for each cell, at position x. Now i also want to know the mean velocity at this plane, is there a way to get that? |
|
November 20, 2018, 06:17 |
|
#18 |
Senior Member
Thomas Oliveira
Join Date: Apr 2015
Posts: 114
Rep Power: 12 |
Dear Martin,
It is important to use the forum in a way to make it also helpful for other users that look for a question in the future. For this, it is better if: - one starts a new question ("how do I get the flux on each cell on a plane") if this is different from the original one ("Calculate flux across surface"); - one reports what they got/found out. Did you try "operation none;"? What what the result? What did you use for internal faces instead of "mesh.magSf().boundaryField() ". As for your question, isn't the mean velocity equal to the flux over the area? |
|
November 20, 2018, 06:45 |
|
#19 |
New Member
Martin Rønnov Andersen
Join Date: Oct 2018
Location: Aalborg, Denmark
Posts: 10
Rep Power: 8 |
Hey Thomas,
I actually did open a new thread, but no one responded to it so that is why I asked in this thread. Also, I got the code(posted before the previous) to work, simply by asking for the variable that i want (U[celli], V[celli] ect.) No, velocity would be the flux multiplied by the area, since flux is velocity over area. I believe i know where you are going with this, but the main problem is how to extract it. |
|
May 24, 2019, 12:01 |
For the Latest Time
|
#20 | |
New Member
Diego Menezes Pamplona
Join Date: Apr 2019
Posts: 3
Rep Power: 7 |
Quote:
|
||
Tags |
flux calculation, integrate |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to specify surface flux of a species? | ked | FLUENT | 18 | February 15, 2022 16:03 |
Total heat transf. rate vs Total surface heat flux | Renato Sousa | FLUENT | 1 | April 14, 2020 04:27 |
Symmetry and total surface heat flux | CCHunter | FLUENT | 2 | November 8, 2017 05:47 |
how to Calculate heat flux??? | sandip | Main CFD Forum | 0 | December 4, 2009 05:58 |
Total Heat Transfer Rate & Total Surface Heat Flux Mismatch | icaro | FLUENT | 0 | November 24, 2009 08:01 |