

How to find/call each individual cell in a computational domain
Hi, I have a test domain contains only 25 cells and this 25 cell geometry is only for test purpose. While running the simulation, the value of volume fraction I am getting is the volume fraction of the complete domain. But, I want to know the volume fraction of each cell (Cell 1, 2, 3....25) and that should be printed in my terminal. How to find/call each individual cell in a computational domain and to print it in the terminal ? A quick answer from any body would be highly helpful. Many thanks for your patience and time on this matter. Thank you, With regards, Saroj
OpenFOAM


Hi Saroj,
The terminal window is not for post-processing and to print results. You will have to use ParaView to analyze volume fraction. You may use the setFieldsDictdictionary to divide your domain according to initial volume fraction.
Regards
Viraj


Hi,
We analyze results using different vectors, glyphs, contours on ParaView. I think you are an excellent coder, please go ahead and write a code to print values of volume fraction. As far as I know, there is no printing of values in almost any of the CFD software.
Regards
Viraj
Hi,
No no, I am not a good coder. But, I am terribly facing some problem (how to assign/calculate any values for each cell and always it is possible to print the values in the terminal for test purpose) and want to have some solution asap. Yes, we can print values in FLUENT also and we did it in past using UDF. Sometimes printing of values are necessary from solver as those values should match with the hand calculated values. Hence, we can ensure that the solver is correct and working fine.
Many thanks on this matter.
With regards,
Saroj
No no, I am not a good coder. But, I am terribly facing some problem (how to assign/calculate any values for each cell and always it is possible to print the values in the terminal for test purpose) and want to have some solution asap. Yes, we can print values in FLUENT also and we did it in past using UDF. Sometimes printing of values are necessary from solver as those values should match with the hand calculated values. Hence, we can ensure that the solver is correct and working fine.
Many thanks on this matter.
With regards,
Saroj
Login to add comment


Hi Saroj,
Open your results in ParaView. Then File -> Save Data.
You will get point-wise data.
Is this what you need? You can open this saved file in the terminal if you like.
Hi,
The above problem was solved in a different way. Now, my doubt is in the continuity equation file which is in '0' folder. As we know, the continuity equation solved for each cell in a computational domain. I want to know the loop by which the continuity equation solved for each cell in one time step. Would you please tell the exact line/code (loop) in the continuity equation.
Many thanks on this matter.
With regards,
Saroj
The above problem was solved in a different way. Now, my doubt is in the continuity equation file which is in '0' folder. As we know, the continuity equation solved for each cell in a computational domain. I want to know the loop by which the continuity equation solved for each cell in one time step. Would you please tell the exact line/code (loop) in the continuity equation.
Many thanks on this matter.
With regards,
Saroj
Dear Saroj,
The issue at hand is that you want to program the solver to do certain things. This will not be possible in the case directory. What you need to do is to go into the OpenFOAM source code for the solver that you are using e.g icoFoam and change the values there.
You could start with this tutorial - https://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam, which is a very good introduction on how to program solvers in OpenFOAM. You can follow this tutorial and it will explain how the various variables are handled and how you can make changes.
It is important you understand the difference between the case directories and the source files of OpenFOAM. The only things you have control over in the case directory are runtime properties like initial conditions, boundary conditions, fluid properties, time-step etc. You can look at FunkySetFields from Swak4Foam on how to set initial condition based on coordinates etc. While the source code will let you handle the essential parts of the computation like variables, time stepping and error correction.
Let us know if you have any other doubts.
Regards,
Anmol
The issue at hand is that you want to program the solver to do certain things. This will not be possible in the case directory. What you need to do is to go into the OpenFOAM source code for the solver that you are using e.g icoFoam and change the values there.
You could start with this tutorial - https://openfoamwiki.net/index.php/How_to_add_temperature_to_icoFoam, which is a very good introduction on how to program solvers in OpenFOAM. You can follow this tutorial and it will explain how the various variables are handled and how you can make changes.
It is important you understand the difference between the case directories and the source files of OpenFOAM. The only things you have control over in the case directory are runtime properties like initial conditions, boundary conditions, fluid properties, time-step etc. You can look at FunkySetFields from Swak4Foam on how to set initial condition based on coordinates etc. While the source code will let you handle the essential parts of the computation like variables, time stepping and error correction.
Let us know if you have any other doubts.
Regards,
Anmol
Login to add comment


Many people believe all the good domain names are taken. This isn't true. While it's true that you aren't going to be able to pick up books.com or anything similar, there are still plenty of great domains available. summer nail colors


The number of elements in a computational domain is called the dimension. A computational domain has one element for each type of data that it contains but you need to check here our site to purchase best nail polish of any color. For example, if a domain contains strings of characters, it will have one element for each character. If a domain contains numbers, it will have one element for each number.
Yes, I know terminal is not for post-processing. But, some purpose, I want to print separately values (any value) for each cell. Suppose my volume fraction is named as volFrac. So, my terminal should print volFrac for 25 cells separately. For this, I need to write 4/5 line code (how to print volFrac), but I am not getting any way/solution. I want to have control over each cell rather control over main domain. Once I have control over each cell, I can define source term for each cell. That is my main goal (source term to each cell) once having control over each cell. 2-3 line code in this purpose would be a great help.
Thank you for your time and help.
With regards,
Saroj
09-03-17, 1:04 p.m. sarojdip
Login to add comment