CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

A question in understanding icoLagrangeFoam by Gschaider

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2008, 18:32
Default Hi all, I am newcomer to Open
  #1
Member
 
Heng Xiao
Join Date: Mar 2009
Location: Zurich, Switzerland
Posts: 58
Rep Power: 17
xiao is on a distinguished road
Hi all,
I am newcomer to OpenFoam and I am trying to do Lagrangian particle tracking. Gschaider's icoLagrangeFoam is a good starting point. There are a few issues not clear to me. It would be greatly appreciated if anyone could answer my questions or give me a pointer.

1. When in the main program is the Lagrangian field (as well as the Eulerian field) written to the files? Is it the following statement:

runTime.wrtie();

runTime is a "Time" object. Does it have the reference to all the fileds in the program and output them according to write control parameters?
In addition, the position/mass/density/velocity of the "IncompressibleCloud" do not seem to be a "field".

2. The construction of particles. It seems that the particles can only be generated by "injection". If we want to read in a particle list (position/velocity/index/ etc.), how would that be done?

3. When the IncompressibleCloud object is created with: (in createParticles.H)

InCompressibleCloud cloud(vpi, U)

there is no particle in the object, right?

5. (OF in general) In createParticles.H, there is a statement:

pointMesh pMesh(mesh)

What points are stored in the pointMesh object pMesh?

Thanks very much.

xiao
xiao is offline   Reply With Quote

Old   April 2, 2008, 19:31
Default Welcome! 1) correct: runTi
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Welcome!

1) correct: runTime is a database of all objects that need writing and it will make them all write themselves into files.

2) Make a new injector which reads the file and introduces particles into the simulation based on file data. Sounds a bit agricultural - maybe you can find a better way of generating particles, eg. doing a calculation. It all depends, of course, on where the file comes from...

3) a cloud is a collection of particles

4) there's no 4!

5) pointMesh is just wrapping around polyMesh/fvMesh to make it easier to support point-based fields. It stores no data and refers to the same points (vertices) of the original mesh.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 3, 2008, 00:50
Default Thanks very much for the reply
  #3
Member
 
Heng Xiao
Join Date: Mar 2009
Location: Zurich, Switzerland
Posts: 58
Rep Power: 17
xiao is on a distinguished road
Thanks very much for the reply from Hrv.
It has been very helpful. Here are a few follow-ups:

1) There are many objects in a program, and only a few of them would write into files (p, U, T). How do they make the "requests" or "sign-up" so that runTime knows who will be written to files? That is necessary to know when I want to control what to output. and I am curious in general about how this is done.

2). That is a smart idea. I think the essential difficulty for me was that I am not familiar with the idea of IO in OpenFoam in general, as I asked in my earlier post. The IO features seems be hidden very deep (either in IOoject, or regObject ?), which are then inherited by many classes, and I had difficulty of following all these.

3) & 5): I understand that Cloud needs to have a mesh and a collection of particles, but I am not clear why the construction of a Cloud object need three following steps:
1. Construct pointMesh from a fvMesh:
pointMesh pMesh(mesh)
2. construct an interpolatino object:
volPointInterpolation vpi(mesh, pMesh)
3. the cloude itself:
IncompressibleCloud cloud(vpi, U)

Intuitively, I would think a Lagrangian field (say, diameter or velocity of the particles) and a fvMesh would be enough. Why construct pointMesh and volPointInterpolation when fvMesh all the information (including the vertex and volume centers and much more)

Finally a general comment. I am trying to start coding ASAP, but when trying to understand the code I feel overwhelmed by the details above. I think OpenFoam is very well written, powerful, and with very clear and dedicated hierarchy, taking advantage of almost all features of C++. My question is: Am I having the wrong learning approach and too concerned with the details or is the learning curve is supposed to be this steep? I mean, did others have the same initial difficulty as well?

Anyway, I have been using OpenFoam and digging up the source code for about 2 weeks, and I think OF is a miracle! The code is both scientific work and art work! It has been very enjoyable to read it and try to understand it. The only pity is that there is no document explaining the designing idea behind it. The user guide explained the usage and programming guide explained the objective-oriented design of "field" and "mesh", but the IO, interpolation, and many other features are still not explained. To understand, I had to navigate through the Doxygen document and the source code.

Any comments and hint are appreciated.

Xiao
xiao is offline   Reply With Quote

Old   April 3, 2008, 06:52
Default Hi Xiao! @3&5: the interpol
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Xiao!

@3&5: the interpolation stuff is needed for the particles to "see" the velocity of the fluid at their present location (for drag force calculation and stuff)

@1: That is controlled by the IOobject::AUTO_WRITE-stuff that you see during the construction of the fields

@2: I wouldn't look too close into these classes in the beginning. As a start it is sufficient to know "If I set AUTO_WRITE this stuff will get written at appropriate times"

Bernhard
__________________
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
gschaider is offline   Reply With Quote

Old   April 3, 2008, 12:20
Default Hi Bernhard, Thanks for the
  #5
Member
 
Heng Xiao
Join Date: Mar 2009
Location: Zurich, Switzerland
Posts: 58
Rep Power: 17
xiao is on a distinguished road
Hi Bernhard,

Thanks for the reply. I found the "Auto_WRITE" stuff in the "createField.H" function, which solved the question. But I did not find where you ask the output of lagrangian field of particle positions.

I found in your "IncompressibleCloudIO.C":

IOField<vector> U(fieldIOobject("U"), np);
U.write().

And the same for p and m.

However, in the "lagrangian" folder, the position was also written. Where did you output the position field?

2. Another question is about your particle generation. It seems to me that the current scheme of generating particle is rather restrictive for me in that:
1) There is no particle initially. The cloud is empty.
2) Particles are only generated by "injection"; Only one particle is generated per time step (between "tStart" and "tEnd" specified in the file "cloudProperties". Thus, the number of particles generated depends on the duration between tStart and tEnd, as well as the time step.
Is that correct?
For my current purpose, all the particles are there initially. I want to change the particle generating scheme to either generate by reading from a file, or equivalently, inject all particles before the actual simulation starts. Could you give me some hints on how to do that?

xiao
xiao is offline   Reply With Quote

Old   April 3, 2008, 15:18
Default Hi Xiao! Sorry. I can only
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Xiao!

Sorry. I can only do a lot of handwaving here as I currently don't have access to the source and I havn't worked on it for quite some time (as they say: "Uncommented code older than 3 months could have been written by anybody else")

@1: I didn't write the position field. The super-class (the particle-class you'll find in $FOAM_SRC/lagrangian/basic) does. And rightfully so, because the position belongs to it. Look out for a call to the equivalent method of the super-class

@2.1: Yeah. But they will be read in if some information is found in the 0/lagrangian
@2.2: The solver was only intended as a demonstration how to add lagrangian particles. I never bothered to write an injection method that would fit everone's needs. So you'll have to modify the injector to fit your needs. For a more complex example have a look at the injector-Submodels in the $FOAM_SRC/lagrangian/dieselSpray. For your purpose you could write an injector that inserts all the particles at the start (or create them during the construction of the cloud)

Bernhard
__________________
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
gschaider is offline   Reply With Quote

Old   April 4, 2008, 11:32
Default Thanks to Bernhard. The explan
  #7
Member
 
Heng Xiao
Join Date: Mar 2009
Location: Zurich, Switzerland
Posts: 58
Rep Power: 17
xiao is on a distinguished road
Thanks to Bernhard. The explanation is very helpful. I appreciate it. I will try the two approaches you mentioned: 1) write a function to inject all the particles initially; and 2) prepare files in 0/lagrangian (d, m, U) to initialize the langrangian field.
xiao is offline   Reply With Quote

Old   October 27, 2008, 02:17
Default Hi to everybody! I'm managing
  #8
Senior Member
 
Ivan Flaminio Cozza
Join Date: Mar 2009
Location: Torino, Piemonte, Italia
Posts: 210
Rep Power: 18
ivan_cozza is on a distinguished road
Send a message via MSN to ivan_cozza
Hi to everybody!
I'm managing to do some calculation in which a tracking of massles particles is involved. What should be a easy way to enter in the "cloud" world? So, what shold be an easy tutorial to understand how the lagrangian tracking in OF works?
I'm not interested in forces, interactions, etc, only in the tracking of massles particles that keep with them a reference to a certain list.
Thank you!
Ivan
ivan_cozza is offline   Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding dimensionedScalar jaswi OpenFOAM Running, Solving & CFD 7 December 4, 2014 12:55
Basic Understanding Abduri CFX 8 March 7, 2009 06:12
Understanding k from kepsilon markh83 OpenFOAM Post-Processing 3 December 5, 2008 03:42
Understanding ODE transFuncj0 david_flo1 OpenFOAM Running, Solving & CFD 1 March 8, 2008 12:30
LUSGS understanding Gustavo Main CFD Forum 0 February 14, 2007 10:12


All times are GMT -4. The time now is 05:07.