How to write IOField variable particle position
Hello,
I am using the solid particle library and have looked at solidParticleFoam. I saw 'positions', 'd' and 'U' in the directory of 'lagragian/defaultCloud' in the tutorial case. I am dealing with thousands of particles, just wondering how could I generate the 'positions' file for the particles? I think the particle position belongs to IOField<vector>, but how can I determine the positions and write them into a file using OpenFOAM? Any suggestions would be really appreciated. Thanks a lot in advance. Best Wishes, Sophie |
Hello,
To the question above, I defined Quote:
Quote:
Here is the file header I generated. On the 3rd to 6th line, '\\' is supposed to be the right format, however only '\' is generated. On the line 'location 0;', "" is not allowed to be in the output. Quote:
|
Hi Sophie,
I'm stuck at the same problem too.As a quick workaround, I'm planning to use excel to generate a csv file of positions and copy-paste it onto the existing positions file.Not sure if it will work but hope it helps! Arun |
Hi Arun,
I think it should work. But I am thinking to take this practice as the first step to dig into the code. I think it is worth trying to work out the values of the position vector and use Cloud<solidParticle> to call the standard write function. However, I'm in a mess doing this. Have you got some ideas on this? best, Sophie |
Hi Sophie,
This is going to be my next thing to do, after I get the csv file import working. I see you've got a head start in this. May be you have checked this thread http://www.cfd-online.com/Forums/openfoam-post-processing/66619-output-file-openfoam-header.html . ? |
Hi Arun,
I just looked at it and it's pretty useful to me. Thank you! Actually I've thought to modify IOobjectWriteHeader.C, but just being afraid it will have global impact on all the others. Another concern is that in the file 'positions', we have to write both the position vector and the corresponding cell number on the same line. |
Hi Sophie,
I would do something along the following lines. Also note that I have chosen vectorField instead of List<vector>: Code:
label n = 100; Kind regards Niels |
Hi Niels,
Thanks a lot! The code snippet works well. However, the file 'positions' is supposed to be of the format below Quote:
Thank you in advance, Sophie |
Good morning Sophie,
I see the problem. I do not have a "correct" solution right now, however the following utility, which I wrote some time ago might be helpful: http://sourceforge.net/p/openfoam-ex...veParameters.C Especially the part where the header is written, since I also needed to do everything by hand: Code:
// Write the OF banner Code:
os << initPositions.size() << nl << "(" << endl; Niels |
Hi Niels,
It works perfectly! Thanks! Sophie |
Particle tracking
Hello everyone,
I have been stuck to a problem with particle tracking. In openfoam, all the solvers are designed to inject particles from a certain location for all time steps. But I want to inject particles form different cells, at each time step. Lets say we have a temperature field calculated at each time step. I want to inject particles at each time step from cells with certain temperature (e.g. T=200K). Can anyone help me with this. Thanks in advance. |
Hello Foamer
I am using OF2.2.x I have similar problem when reading file lagrangian/sprayCloud/positions, because this file contains position vector, cell id and having header class "Cloud<basicSprayParcel>" Example: Quote:
Quote:
Posible solution: 1. Is there any way to read the file 'lagrangian/sprayCloud/positions' when cell id is also present there ? 2. Is there any way to create the separate file that contains only particle position ? Please suggest any of the possible solution. Thanks in advance. |
Quote:
Dear wadekar, Have you found any solution to this problem you proposed? I am also very interested in this question. How can we index the particles to the cells they are in? |
All times are GMT -4. The time now is 17:38. |