Quote:
#include"OFstream.H" //declare a object and out the variable you want. file.dat is the name of the //file you need. OFstream os("file.dat"); forAll(mesh.C(), i) { os<<mesh.C()[i] <<" " <<u[i]<<endl; } |
Hi SU
thank you very much for all of your helps. I would appreciate if you could answer my question. I have calculated Umean by introducing a function at system/controlDict of my case and I can see its contour with paraFoam. how I could export it (UMean) to a .dat file, similar to my last question about U ? |
Quote:
|
Quote:
I would appreciate if you could help me. |
Quote:
If you want to do it using a program, Just write a small tool for post processing. Read the file and write the internalField to a file OFstream os("file.dat"); forAll(UMean.C(), i) { os<<mesh.C()[i] <<" " <<UMean[i]<<endl; } |
Quote:
I wrote the code that you sent for me in applications/solvers/incompressible/pisoFoam/pisoFoam.C but when I compiled it, an error would be reported: write.H:55: error: ‘UMean’ was not declared in this scope I cant understand what is the problem, plz give me help! |
I am sorry. that was my silly reply. I know what you mean now. thanks for your reply.:o
|
problems with mesh.cellCells()
Quote:
I'm just working on a possibility to refine locally on a selection of the mesh (blockMesh with refinementIterator). Since I have higher refinement levels I need to lay some buffer-layers around the selection. For this purpose I use the cellCells() function in multiple iterations. My problem is that cellCells() does not recognize all neighbours of already refined cells (The refinement history I have implemented works fine and has no bugs) . I'll give a little example: - 8 cells (= refinement level 3) on the west side of a simple refined cell (= 2 cells f.e. cell A and B). - this should give cell A as eastern neighbour for four of the tripple refined cells and cell B for the other four cells - instead of this cellCells returns only cell A as eastern neighbour for all eight cells!! And now the really big problem: This bug is not reproduceable, since the correct recognition of all neighbours works fine in the mesh of forwardStep (tutorials/compressible/rhoCentralFo...), but not in the mesh of counterFlow2D (tutorials/combustion/reactingFoam...) :mad: |
Quote:
Is it possible describe it more for me? Where should be written this code and how should it be compiled? |
just write it in the time cycle. os declaration can be written in creatFields. H
You can write it like the following code if(runTime.outputTime()) //only write at outputTime point { forAll(mesh.C(), i) { os<<mesh.C()[i] <<" " <<u[i]<<endl; } } |
Quote:
I am getting the following error when I use this: Code:
transientSimpleFoam.C: In function ‘int main(int, char**)’: Thank you. |
I think something is wrong with my formatting:
const point& location = (x,y,z); //your coordinates label labelOfClosestCell=mesh.findCell(location); Can you post your code? Thanks! Kathrin |
Kathrin,
Thanks for your reply. It was indeed the problem with the way I specified my location. I got it working. Thank you. |
Hi, Junwei
I am trying to access the neighbour cells with parallel computing but it seems the cell which is placed adjacent to the interface between sub-domains does not recognize all neighbour cells. I followed the same as you mentioned which is briefly (I am using OF-2.1.x), mesh.cellCells()[cellI] So I am wondering that you have a similar experience and is there any possible solution on this? I also posted the question on this issue but I haven't got respose so far. http://www.cfd-online.com/Forums/ope...computing.html Thanks in advance. Yusik |
Quote:
Could the p be a face in the internal field. If it could be, how can I define it? Many thanks! Wei |
X, Y and Z of each cell
hey, does anyone know how can I get the x, y and z of each cell?
|
Hi Junwei
As I see, the cellCells gives the list of index, my question is how could distinguish them? thanks Wei Quote:
|
The return value is a list of index of neighbor cells. cells can be distinguished from another from cell index, cell center, etc.
|
I'm confused about how to access a specific cell using cellCells. For example, how can I use cellCells to access the NORTH cell of each cell in my domain?
Here's an example of what I would like to do... I know that the code may not compile, I'm just trying to explain what I'm doing. Code:
V=value; //V is a boundary field ('value' is calculated and varies across the domain) |
Quote:
Greeting Su Is it possible to detail your hint more clearly? I guess that the meshSearch.H should be added to the main code for instance reactingFoam.C . But what about Code:
meshSearch ms(mesh); Thanks for your hints. Best, Bobi |
All times are GMT -4. The time now is 18:33. |