To postprocess my data I would
To postprocess my data I would need help to do the following:
1) I want to write the following to separate text files:
i) The pressure data of each wall cell face of a specific boundary.
ii) The coordinates of the wall faces in that boundary.
iii) The area of each wall face.
2) I want to sum the wall pressure times face area of the specific boundary. How can I do this without using the text files created in (1)?
I'm a rookie using OpenFOAM. This means you can't be too clear when answering my questions. All answers, even if you answer only one of my questions, are very welcome.
Should be easy. - make an o
Should be easy.
- make an object of type OFstream, giving it the file name
- pick out the patch you want to write in (I will call its index patchID)
Before main(), add:
and at the point where you want to write:
of << p.boundaryField()[patchID] << endl;
of << mesh.C().boundaryField()[patchID] << endl;
of << mesh.Sf().boundaryField()[patchID] << endl;
If you want each into a separate file, make yourself multiple OFstream objects
For the sum, do:
vector sumForce = sum(p.boundaryField()[patchID]*mesh.Sf().boundaryField()[patchID]);
Could it be easier?
Thank you very much. First of
Thank you very much. First of all I wonder where am I supposed to learn about how to do the things you just taught me?
Now to some questions regarding your reply:
1) In which file am I supposed to insert the lines you suggested me?
2) Let's talk about writing the wall face pressure data, wall face coordinates and size. How is each value connected to a specific wall face? Is there a column next to the data value column saying face no 2 of cell no 21345? I mean, I need to be able to keep track of which face area that belongs to which face pressure. The values will of course be listed in the same order, but assume I want to pick a specific cell face by its number.
3) Why is the data type vector in "vector sumForce = sum(..."? The answer will be a real value. I haven't been using C++ before.
4) Assume instead I want to find data values of the cells of the boundary (not the faces). What command will I use then?
5) I've created a cut plane through my boundary where a do a contour plot. Now I simply want to step through my time steps and create an animation. How do you suggest me to do this? Should I save images and use some other software to create an animation (which?) or should I create an .mp2 animation right away? I want to run the animation on a Windows system.
...where am I supposed to lear
...where am I supposed to learn...
The obvious answer is to look for examples in OpenFOAM, because I or other people must have done something similar already. If you need to be better at this, you can attend some training, come to the Workshop or (especially if you are working in a company using OF for commercial work) get some OpenFOAM support to help you produce quality results on time. Feel free to send me an E-mail if you want to talk about this.
Anyway, the level of things you are looking for is still easy: so, play, try to guess, learn by example etc. It's not that hard, really.
How is each value connected...
In the example, I am writing the values for all boundary faces. Face centres, face areas and everything else will be ordered in the same manner. Thus the first pressure belongs to the first face and the first face centre - all the lists are ordered the same.
data type vector in "vector sumForce = sum(..."...
Physics, physics! Pressure is a scalar and it acts normal to the surface, right? Therefore, force is a vector because it depends on the orientation of the surface - you really *should* know this.
...find data values of the cells...
The cell values are in p.internalField(). If you ask the patch for faceCells(), it will give you a cell index next to each boundary face. You know the rest...
...and create an animation...
Create a series of images, and convert them into an animation using some package. I am using convert on Linux, which is a part of ImageMagick and make an mpeg video.
Enough for now I think...
I see. My first question conce
I see. My first question concerned writing pressure data, coordinates and area of specific boundary faces to a file. I was given the lines necessary to do this. Now, I'm wondering the following:
1) Assume I'm running simpleFoam. I want to find a steady-state solution. Will I then, using the lines I was given, write a file at every iteration or only after the final iteration? How can I control this to achieve both scenarios?
2) Assume I'm running turbFoam. I'm solving a transient case. Will I then, using the lines I was given, write a file at every time step or only after the final time step? How can I control this to achieve both scenarios?
You'll have to code it yoursel
You'll have to code it yourself.
Sorry the link didnt lead wher
Sorry the link didnt lead where I thought it would.
Here is a thread I saved from the forum:
Continuity Eq: div(U) = 0
and with source term: div(U) = S
Discretised momentum eq. A*U = H - grad(p)
U = H/A -(1/A)*grad(p) = Ustar - (1/A)*grad(p)
H/A is the momentum-predictor value of U, ie Ustar.
if we insert this in the continuity eq. it yields
div(U) = div(Ustar - (1/A)*grad(p)) = S
div(Ustar) - laplacian(1/A, p) = S
laplacian(1/A, p) = -S + div(phi)
where phi is Ustar evaluated on faces.
have a look at icoFoam and you will easily see where to insert S.
I'm running parallel and use p
I'm running parallel and use p.boundaryField()[patchID] to access the pressure of each wall cell face of a certain boundary. I write this data to a file. However, it ends up in all processor directories, being zero in the partitions not containing my boundary. How do you suggest me to make the code write this data only if the boundary of interest is in the current partition (processor directory)?
Just a guess (havn't looked at
Just a guess (havn't looked at the source). As far as I remember the probes-functionObject collects all the data on the first processor and writes it there. I guess that would be even more convenient for you. Have a look at that source, it might give you some hints.
hi all, i want to check that
i want to check that mass is conserved in my simulation?so i want to get the data for my inlet and outlet.can someone please help here.
Hi Davey Without trying it,
Without trying it, I believe something like this should work:
checkMass += sum(phi.boundaryField()[patchID]);
Info << "checkMass: " << checkMass << endl;
hi all, managed to fix it.sor
managed to fix it.sorry i was a bit impatient in scanning the forum!
|All times are GMT -4. The time now is 09:54.|