
[Sponsors] 
November 15, 2010, 13:03 
How to calculate grid width in control volume

#1 
Member
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 33
Rep Power: 7 
Dear Foamer's
I would like to know is there any class to calculate the cell width of all grid? I need this distance to calculate a step function while the solver is running. This help me to calculate a properties weighted in this distance. Somebody can help me? Thanks in advance Respectfully Javier Basurco 

November 16, 2010, 06:26 

#2 
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8 
Dear Javier,
if you are using cubical cells it is really easy : you need to grab the mesh and then you can go pow(mesh.V().1/3) which gives you the cell width. If you don't have those values, you might need to get the distance between the cell center (mesh.C()) and the centers of the cell's faces(mesh.Cf()). Than you might estimate the cell width. Or you can go to the edges directly if you have access to the primitiveMesh myMesh.cells()[i].cellEdges() gives you a labelList ( j, k, l, m, n, o, p, ...) of the edges of the cell i. Then you need to check out the edges from myMesh.edges()[j] (just for example) and then you can acces the length of the edge by myEdge.mag() Hope this helps Kathrin PS: How to get the mesh: It depends on the environment. Can you give us a litte snapshot from the code you want to implement your function? 

November 16, 2010, 09:08 

#3 
Member
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 33
Rep Power: 7 
Dear Kathrin,
I did my mesh in icemcfd ANSYS 12.1. I exported the mesh to fluent and then convert to openfoam, for now is not problem. The solver that I am working is level set method, for two phase flow. Maybe do you hear some thing. The level set method is used to reconstruct the interface between two fluids. In OpenFOAM is there another method similar VOF method. The level set method obtain a distance that will be stored in the nodes of a cell and from the difference of level set distance to the normal edge are calculated values of density and viscosity are used in the equation of conservation of momentum. I think that I am not a cubical cell maybe hexahedral trying to converve a structural mesh. Could you explain me better how can go to the edges directly if I have access to the primitiveMesh. Thanks in advance I look a forward to hearing from you Respectfully Javier Basurco 

November 16, 2010, 13:02 

#4 
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 8 
Hi Javier,
ok I know about the LevelSet Method. What you want to do is implement the HeavysideFunction. Okay let my try to code without compiling.... mesh is defined as fvMesh or primitiveMesh or ... edgeList edg = mesh.edges(); forAll(edg, edgeI) { scalar width = edg[edgeI].mag(); } Where the scalar width gives you the length of the edge. I don't know in which context you need it. Whether as value or field or whatever... Can you give me a little more information? Best Kathrin 

November 16, 2010, 13:58 

#5 
Member
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 33
Rep Power: 7 
Dear kathrin,
In the first instance thanks for your help. I am trying to implemented the Heaviside function. The Hfunction is used to smooth the density and the viscosity at the interface over a width of delta_n. In several reference, defined this delta_n like a thickness of the interface (Sussman et al, 1998). The delta_n is 1.5 of of grid with (Shu et al, 2007) was implemented in OpenFOAM. I think that this function is a value to do a weighted medium between the densities of two fluids to obtained a rho that was used in ddt(rho, U) and rho == rho2 + (rho1  rho2)H. My first question is have been a possibility to obtain the minimum distance between all edge from volume control. My second question, what is the meaning of edgeI it is related to axis "y" maybe? is there another edgeII o edgeIII? My deep regards Once again thanks for your help Respectfully Javier Basurco PD.: If you need the reference, I could send you this information. 

November 24, 2010, 13:40 

#6 
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12 
Since what you really want is the effective cell size in the surface normal direction and your mesh is unstructured, your best approach is probably something along the lines of what can be found here:
$FOAM_SRC/turbulenceModels/incompressible/LES/SpalartAllmarasIDDES/IDDESDelta.C You want to take the dot product of the celltofacecentre vectors with the level set surface normal direction and I would suggest you use some form of projected area weighting to get separate averages of all the positive and negative dot products. Then sum the absolute value of the negative and positive averages instead of just using 2x the maximum. What you are looking for is the average thickness of the cell in the direction of the levelset surface. Assuming the faces are flat, the above method will give you something close to the exact answer. If you want the maximum extent of the cell, then just do the same with the cellcentretovertex vectors, but sum the maximum of the positive and abs(negative) dot products. To access cellPoint addressing: mesh.cellPoints(). 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
how to calculate flow properties along the first grid point near to the wall  kiran  OpenFOAM PostProcessing  2  September 12, 2010 12:59 
BlockMesh FOAM warning  gaottino  OpenFOAM Native Meshers: blockMesh  7  July 19, 2010 14:11 
[ICEM] Exporting Grid Volumes/Areas from ICEM to Calculate Discretization Error  Josh  ANSYS Meshing & Geometry  4  May 20, 2010 13:40 
air bubble is disappear increasing time using vof  xujjun  CFX  9  June 9, 2009 07:59 
Boundary Grid next to volume  Gernot  FLUENT  0  August 26, 2005 13:21 