CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Boundary point values (https://www.cfd-online.com/Forums/openfoam-solving/59828-boundary-point-values.html)

dmoroian February 9, 2007 18:35

Is this the right way to compa
 
Is this the right way to compare two strings?
if(cPatch.name() == patchName)
I've just checked doxygen online and I did not see any defined operator "==" for word or string class.
If that's the case, then you compare two pointers, and I am surprised that it enters through that branch at all.

Dragos

lr103476 February 10, 2007 03:41

Mmm, I dont know if this is al
 
Mmm, I dont know if this is allowed. It works though :-S Off course, this should be improved if necessary.

What really bothers me is the following:
1) p, Ux, Uy, Uz are not the values in the points.
2) 'strange' point ordering

Regards, Frank

philippose February 10, 2007 05:37

Hi Frank, I was looking thr
 
Hi Frank,
I was looking through your code, and I think I might know what might be wrong... anyway... before going into that...

In your case... you have a list of patch names... in the particular example.. only one patch "inlet". Instead of iterating over all the patches in the mesh trying to find the one you need, you can use:


label patchIndex = mesh.boundaryMesh().findPatchID(patchName);

That directly gives you the index to the patch you want. A general case where there is more than one patch in the list, you can do something similar to:

const wordList patchNames(patchDict.lookup("patchNames"))

forAll(patchNames,patchI)
{
label patchIndex = mesh.boundaryMesh().findPatchID(patchNames[patchI]);
..
..
..
..
}

Now for the anomaly you are noticing in the "U" and "p" values for the points on the patch....

I dont think you can directly obtain the values of these variables on points, because pressure "p" is solved on a per cell basis, which means, the value of "p" is calculated at the centre of each cell.

The "U" variable is solved on a per face basis... so the velocity is calculated at the centre of each face.

If I am not mistaken, if you want the exact value of these variables on node points, you will have to interpolate from the cell centre and face centre values.

The other option is to say that the mesh is fine enough to enable you to assume that the pressure value for the point is the same as the pressure value at the centre of the cell the point belongs to, and velocity at the node is the same as that at the centre of the face it belongs to.

I would be interested to know how you solve the problem, because I write small postprocessing routines in which I access pressure and face areas to calculate forces, etc...

Have a nice weekend!

Philippose

philippose February 12, 2007 13:48

Hi Frank, A Good day to you
 
Hi Frank,
A Good day to you!

I dont think the connectivity problem has anything to do with the code you have written. OpenFOAM uses a very clear method for handling the mesh as such. You can find detailed information regarding this in:

UserGuide.pdf

in your "OpenFOAM-1.3/doc/Guides-A4/" directory in chapter 6 section 1.

In theory... the labels of points in the mesh, and the connectivity order are dependent on the mesh itself and the utility used to convert your original mesh to the openFOAM mesh format.

If the geometry is simple, maybe you can try creating the mesh entirely yourself using "blockMesh". If the geometry is complicated, I dont think there is any method to dictate the mesh labeling you want to openFOAM.

Anyway.... if I find something, shall let you know.

Have a nice day!

Philippose


All times are GMT -4. The time now is 22:32.