CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Finding field value near boundary (

som December 28, 2011 14:57

Finding field value near boundary
Hello. I have some scalar field and need to find its value for all cells near some boundary. I need to have array or something like that with values on every timestep. How can i do it? I use some modification of pimpleDyMFoam solver.

nimasam December 29, 2011 13:32

your question is vague, however maybe you can use scalarField type to save your data in it

som December 29, 2011 16:21

Thanks for reply.

I'm asking not about type where i can save my data. Actualy I need to printf value of scalar field near the specified boundary.

nimasam December 29, 2011 17:08

you can show it in terminal with Info
but if you want to save it in file you show use

som December 29, 2011 17:24

yep, i understand that. But the question is how to find cells which are near the specific boundary.

What I have
1) Boundary
2) Field in space

I need to know (i.e. print it to console) field value in the boundary layer.

doubtsincfd December 30, 2011 03:17

const fvPatchList& patches = mesh.boundary();
const fvPatch& currPatch = patches[patchi];

Let me know if this works
patchInternalField() gives you the values at cell centers of cells near the boundary

som December 30, 2011 11:21


Thanks for your response. It seems you've shown me right direction.

som December 30, 2011 17:35

It works. One more stupid question. How can i take the maximum the value of a patch?

doubtsincfd December 30, 2011 17:47

there is an in-built function max(fieldName). I havent used it but it should be pretty straightforward.

link might help

som December 30, 2011 18:12

It works.Thank you!

All times are GMT -4. The time now is 00:34.