How to calculate grid width in control volume
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
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
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?
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:)
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();
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?
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
PD.: If you need the reference, I could send you this information.
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:
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().
|All times are GMT -4. The time now is 19:40.|