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

How to calculate grid width in control volume

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By kathrin_kissling

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 15, 2010, 13:03
Post How to calculate grid width in control volume
  #1
Member
 
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 32
Rep Power: 16
Ingenierias2003 is on a distinguished road
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
Attached Images
File Type: jpg control volume.jpg (16.6 KB, 20 views)
Ingenierias2003 is offline   Reply With Quote

Old   November 16, 2010, 06:26
Default
  #2
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17
kathrin_kissling is on a distinguished road
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?
kathrin_kissling is offline   Reply With Quote

Old   November 16, 2010, 09:08
Default
  #3
Member
 
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 32
Rep Power: 16
Ingenierias2003 is on a distinguished road
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
Attached Images
File Type: jpg duto2metros.jpg (96.8 KB, 66 views)
Attached Files
File Type: pdf Level set.pdf (52.2 KB, 44 views)
Ingenierias2003 is offline   Reply With Quote

Old   November 16, 2010, 13:02
Default
  #4
Senior Member
 
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17
kathrin_kissling is on a distinguished road
Hi Javier,

ok I know about the Level-Set Method.

What you want to do is implement the Heavyside-Function.

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
kathrin_kissling is offline   Reply With Quote

Old   November 16, 2010, 13:58
Default
  #5
Member
 
Javier Basurco
Join Date: Jan 2010
Location: Rio de Janeiro, Brazil
Posts: 32
Rep Power: 16
Ingenierias2003 is on a distinguished road
Dear kathrin,

In the first instance thanks for your help. I am trying to implemented the Heaviside function. The H-function 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.
Ingenierias2003 is offline   Reply With Quote

Old   November 24, 2010, 13:40
Default
  #6
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
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 cell-to-face-centre 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 level-set 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 cell-centre-to-vertex vectors, but sum the maximum of the positive and abs(negative) dot products. To access cellPoint addressing: mesh.cellPoints().
eugene 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
how to calculate flow properties along the first grid point near to the wall kiran OpenFOAM Post-Processing 2 September 12, 2010 13:59
[blockMesh] BlockMesh FOAM warning gaottino OpenFOAM Meshing & Mesh Conversion 7 July 19, 2010 15:11
[ICEM] Exporting Grid Volumes/Areas from ICEM to Calculate Discretization Error Josh ANSYS Meshing & Geometry 4 May 20, 2010 14:40
air bubble is disappear increasing time using vof xujjun CFX 9 June 9, 2009 08:59
Boundary Grid next to volume Gernot FLUENT 0 August 26, 2005 14:21


All times are GMT -4. The time now is 14:02.