|
[Sponsors] |
August 14, 2009, 08:18 |
Can we have access to cells coordinates?
|
#1 |
New Member
andrianah scott
Join Date: Aug 2009
Posts: 8
Rep Power: 17 |
Hi there,
My first time to log on! I am a newbie at OF and I have got one question.Is it possible to have access to cells coordinates? things like cells (i,j,k) For this equation: volScalarField exsray = exp(-beta*y); beta is also volScalarField and y is the y-coordinate. Can somebody help me out please? Thanks in advance! BR |
|
August 14, 2009, 09:53 |
|
#2 |
Member
Ville Tossavainen
Join Date: Mar 2009
Posts: 60
Rep Power: 17 |
This may look a bit tricky, but you can get the y-coordinate (scalarField) at cell center like this:
mesh.C().component(vector::Y) or mesh.C().component(1) so use it in the place of "y" in your equation. Basically "mesh.C()" is a vector field of cell center coordinates. I'm sure after this it's easier to look for more examples. Ville |
|
August 14, 2009, 10:27 |
|
#3 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi Adrianah,
take a look in the primitiveMesh, fvMesh and polyMesh class. You can reach this information eather in the code or by using the doxygen. (Just use the search function) There you will find a lot of useful functions. For more Information try to search for the paper primitiveMesh, polyMesh, fvMesh - The OpenFOAM mesh hierarchy by Alberto Passalacqua and Jaswinder Pal Singh. It must be out there. Regards Kathi |
|
August 14, 2009, 11:56 |
|
#4 |
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18 |
Hi guys, look at here: http://www.tfd.chalmers.se/~hani/kurser/OS_CFD_2008/primitiveMeshDraftVersion.pdf.
However, I ever tried to find out all vertex coodinates of some cell or face from constant/PolyMesh but not the central position of a cell. |
|
August 15, 2009, 05:16 |
|
#5 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi Sandy,
maybe I my answer was a bit unclear. I didn't mean you should read each cell centre from constant/polyMesh. It is not possible. constant/polyMesh just stores the cell vertices, their connection to the faces and the connectivity (its in owner and neighbors). In earlier versions there was also the connection to the cells stored, but this was removed some time ago. Apart from all that, you don't want to read it from files, do you? To access all other values apart from that, you must apply some macros in code. For example: (in fvMesh class) cellVolumes mesh.V() cellCentres mesh.C() faceCentres mesh.Cf() fvMesh class is located in src/finiteVolume/fvMesh mesh is usually declared as fvMesh& mesh = yourDesiredVariable.mesh() yourDesiredVariable may be everything like U, pd, gamma,... defined with a mesh structure lying in the background. Best regards, Kathi |
|
August 15, 2009, 06:54 |
|
#6 |
New Member
andrianah scott
Join Date: Aug 2009
Posts: 8
Rep Power: 17 |
Hi guys!
Thank you so much answering,so grateful to you!! I will take a look at the primitiveMesh,as I'm downloading the document you're proposing me I guess I'll have more understanding about it. I'll keep you aware. Best Regards, |
|
August 18, 2009, 04:31 |
|
#7 |
New Member
andrianah scott
Join Date: Aug 2009
Posts: 8
Rep Power: 17 |
Hi guys,
I tried to use this "mesh.C().component(vector::Y)" as you advised and it works well but I think I'm gonna take a look at the documents you recomended to gain more understanding Thank you so much,nice of you!!! Best Regards, |
|
August 18, 2009, 06:59 |
|
#8 |
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18 |
Hi Kathi, if that, I also can defined some scalars with a mesh structure, for example the driving pressure gradient (gradP) et al., right? Whether or not it means I actually creat a field for this scalar gradP and can use a probe of it in ControlDict of some case? Thanks.
|
|
August 18, 2009, 07:11 |
|
#9 | |
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18 |
Nikos suggest to create a "field" for a scalar as follows:
http://www.cfd-online.com/Forums/ope...neloodles.html #12 Quote:
|
||
August 18, 2009, 08:06 |
|
#10 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi sandy,
what are you actually trying? Do you want to declare any volScalarField with mesh structure? Than go with Nikos way. What I explained to Ariannah is how to get the mesh structure back from a volVectorField/volScalarField/volTensorField... This is what Adriannah needed for reaching the cellCentres. You need the mesh structure. Its two totally different things to do. If you can explain to me what your exact problem is, I can try to help you. Best regards Kathi |
|
August 18, 2009, 21:33 |
|
#11 |
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18 |
Hi Kathi, please don't mind me to offset away from this topic. I ever declared a volScalarField in createFields.H of my case as similar as Nikons:
volScalarField FieldOnes ( IOobject ( "FieldOnes", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh,gradP/gradP ); But, its values could not been exported in the directory. I don't know why. I guess I missed somthing. Maybe I should firstly define it in some basic class? So, when your posts refered to the fvMesh to define any "yourDesiredVariable", I misunderstand I can get any Field definition and declaration by this way. Sorry... However, do you know how to create and export a scalar Field totally defined by yourself? |
|
August 20, 2009, 06:42 |
|
#12 |
Senior Member
Sandy Lee
Join Date: Mar 2009
Posts: 213
Rep Power: 18 |
Hi Kathi, I can also get some point sources quickly from the Probe Location (Filters<Alphabetical<Probe Location<point source) in paraFoam. However, do you know the coordinate in it is the cell central position or vertex value? Thanks.
|
|
August 20, 2009, 09:38 |
|
#13 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
Hi Sandy,
sorry for the delay. The createFields.H is called by a solver, right? Try volScalarField FieldOnes ( IOobject ( "FieldOnes", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), gradP/gradP ); for any calculation. forget about the second mesh before the operation gradP/gradP. If you jsut want to have a volScalarField filled with 1 try volScalarField FieldOnes ( IOobject ( "FieldOnes", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimsionedScalar("one", dimless, 1) ); The probes are cellCentres I think, but I'm not sure about that. Regards Kathi |
|
November 19, 2012, 13:29 |
|
#14 | |
Member
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 54
Rep Power: 13 |
Dear all
I need to creat a temperature field file along with cell centre information(x,y,z) in every time step. I have tried different options to do that but failed. Following are the line from createFields.H to create T Quote:
Regards Jamal |
||
November 19, 2012, 15:05 |
|
#15 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
You can use the writeCellCentres tool to obtain the coordinates of each cell. This way you get four files giving you coordinates (ccx, ccy, ccz) and T-field (T).
|
|
November 20, 2012, 06:44 |
|
#16 |
Member
Jamal
Join Date: May 2012
Location: Freiburg
Posts: 54
Rep Power: 13 |
Dear
thanks for your response and now i am able to get cell coordinate files. I am not sure wheather temperature values are arranged in the same sequence as the coordinate files. Do you? As i need to have the temperature profile according to the cell location. Regards |
|
November 20, 2012, 07:06 |
|
#17 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
They are arranged in exactly the same way. So if you would combine the four files into one you would get (x,y,z,T) data
From that point on its up to you how to process the data. If you have Matlab at your disposal, one of the options you have is using triScatteredInterp to obtain an interpolating function. Check out http://www.mathworks.nl/help/matlab/...redinterp.html for more information on this. |
|
February 17, 2013, 18:09 |
|
#18 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
dear Lieven is it possible to obtain pressure,velocity and temperature at a specific cell center(that is neighbor of a boundary patch) with "writeCellCentres"?how?is it possible without need to programming?
|
|
February 19, 2013, 06:53 |
|
#19 |
Senior Member
Lieven
Join Date: Dec 2011
Location: Leuven, Belgium
Posts: 299
Rep Power: 23 |
Hi Immortality,
Did you consider using the sample-tool? Either as post-processing tool or as functionObject during simulation... Cheers, L |
|
February 19, 2013, 15:02 |
|
#20 |
Senior Member
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 27 |
as post-processing
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to get node coordinates for free surface cells | fred | FLUENT | 1 | August 15, 2014 02:52 |
[Netgen] Import netgen mesh to OpenFOAM | hsieh | OpenFOAM Meshing & Mesh Conversion | 32 | September 13, 2011 06:50 |
Access to the derivatives of quantities at cells | Parsa Zamankhan | FLUENT | 0 | September 18, 2007 20:30 |
Center coordinates of all the cells in a cellset | lizhihua | Siemens | 0 | August 21, 2006 04:59 |
physical boundary error!! | kris | Siemens | 2 | August 3, 2005 01:32 |