I know the cell ID, how do I find the cell coordinates?
I have a complex case that seems to be crashing because of a single cell. Unluckily I cant identify it with the sets generated by checkMesh (allGeo allTopo). But I checked values immediately before the crash, so I think I know its ID (its nr 94495 in the list).
How do I find out where it is located? E.g. I need to find it's cell centre point or the vertices defining the cell (their coordinates).
So I know where inside my mesh the crash magic takes place.
Isn't there a cell list similiar to the face list in 0/polyMesh ?
My intention is to change meshing parameters in a way that this cell becomes normal.
Any help is highly appreciated! These crashes drive me absolutely crazy (as they happen after 5-20 hours of computation time and then its mesh-problem-hunt :eek:)
Greetings and thanks in advance,
Not sure if it is helpful but here is my checkMesh output (it's about tank filling).
For cell center, you should be able to do mesh[cellI].x() to get the x-coordinate of the cell center. You can do a similar operation for y and z.
Good day and happy new year!
I have been trying to find the maximum value of the coordinates, say (max(y)) in order to calculate a hydrostatic pressure as:
hydrostatic pressure = rho * (g & (max(y) - mesh.C())),
where rho is the density of water and g is the gravitational acceleration.
I am having a problem, either in getting the maximum value of "y" from my computational domain ( which is the depth of the water level in principle, b/c I have air and water body in the domain) or the equation I am using is wrong. I have been trying to modify the postprocessing uttility (ptot), which calculates the total pressure (static + dynamic) in order to include the hydrostatic pressure but is giving me errors during compiliation. I have used a constant number say max(y) = 1, and still the solver is not compiling.
I have been thinking of finding max (y) when the density of the fluid is 1000 in the cell, which is the water density, in this way, I will be able to track the free surface dynamics and its corresponding height (max (y)). But this seems to be very difficult for the time being, for me at least. So I was thinking just to do in the simplest way by using constant value of the water depth though I couldn't do this one either.
I would appreciate if you can lend me a hand on how to access the maximum value of the coordinates and if the minus sign used in the above equation is correct in the programming point of view.
Thank you for your time and help.
I think your problem is that you are mixing up types and operators. You are trying to subtract a single constant scalar value (max(y)) from a vector field (mesh.C()). I think you can agree this doesn't make sense. You may have to do the calculation cell by cell to extract the y value. Either change max(y) to a vector (create a temporary one that is just (0,1,0)*max(y)), and the subtraction and then dot product should work. As long as g is oriented in the y direction this should give you the answer you want.
Thank you Marco for your prompt reply.
You rightly pointed out my problem, it appears that it was mixing of types and operators. Now, the solver is working great with a temporary vector of the form "Foam::vector(0,1,0)". I will try the cell by cell method b/c that could help me to figure out the free surface dynamics by searching the cells with the maximum density.
Is it possible to extract the coordinates of the vertices belonging to one face in openbfoam? Assume the face is triangular, then the coordinates of the three vertices? Thank you.
Accessing coordinates in BC face by face
your advice is pretty pretty close to what I needed recently.
I'm trying to assign a scalar value to my boundaryField depending on each face's x- and z-value.
So since I'm doing it face by face in my 0/T-file figuratively I'm being handed a cell, I don't care about it's index, I just want to access THIS face's coordinates.
Is there something similar to Xcoord=mesh.x() I can use?
Here's my code with some placeholders
|All times are GMT -4. The time now is 19:11.|