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

Boundary patch fields

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 1, 2006, 09:57
Default Hello. I'd like to have an
  #1
Member
 
Rosario Russo
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 56
Rep Power: 8
ariorus is on a distinguished road
Hello.

I'd like to have an utility which creates in output a selected field variable file for a given boundary of the domain.

It cannot be that hard, I know.

But I'm a novel c++ user, and it is not easy to find inside the code what you need...

For example for pressure field p (volScalarField) on the boundary "patchlabel" I'm supposed to have all the data in p.boundaryField()[patchLabel], but which function do I have to use to read actually the field values?

I hope in a good hint...

Thank you so much.
ariorus is offline   Reply With Quote

Old   February 1, 2006, 12:52
Default I'm not sure it's clean and co
  #2
Member
 
Rosario Russo
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 56
Rep Power: 8
ariorus is on a distinguished road
I'm not sure it's clean and correct:

scalarField pp = p.boundaryField()[patchLabel];

Then I can access the field values by
pp[i];

Anyway thank you for any other comment.
ariorus is offline   Reply With Quote

Old   February 1, 2006, 13:31
Default Close. Try: const scalarFi
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Close. Try:

const scalarField& pp = p.boundaryField()[patchLabel];

and pp[i] if you do NOT want to change the values.

If you do want to change them, use:

scalarField& pp = p.boundaryField()[patchLabel];

Please notice the extra "&" - in your code you've made a copy of the patch field, which is not a good idea.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 2, 2006, 06:08
Default Ok. Thank you very much. B
  #4
Member
 
Rosario Russo
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 56
Rep Power: 8
ariorus is on a distinguished road
Ok.
Thank you very much.

By the way, I hope not to well out of your kindness too much, how can I get the dimension of my scalar field, namely "the lenght" of pp?

I need to read all pp[i] and I think I can use something like:

for (int ic=0; ic<??; ic++)
{...pp[ic]... }

or in a more smart way

forall (..??.. ic)
{...pp[ic]...}

But I don't know what to put in ??...

Thanks again.
ariorus is offline   Reply With Quote

Old   February 2, 2006, 06:21
Default p.dimensions() should do it.
  #5
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 12
eugene is on a distinguished road
p.dimensions() should do it.
or do you mean size? p.size()

To loop through any list use the "forAll" macro:
forAll(pp, counter)
{
pp[counter]=...
}

Very useful, very neat.
eugene is offline   Reply With Quote

Old   February 2, 2006, 06:43
Default pp.size() (dimensions mean di
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
pp.size() (dimensions mean dimension set [mass length time etc] which is for geometric fields and dimensioned types).

So:

forAll (pp, ppI)
{
pp[ppI] = ...;
}
(thanks Eugene and sorry to butt in)

which expands to
(for label ppI = 0; ppI < pp.size(); ppI++)
{
etc
}

This is very basic stuff, I recommend some digging through the code and examples to help you with more programming.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 2, 2006, 07:23
Default Thanks Eugene, thanks Hrvoje.
  #7
Member
 
Rosario Russo
Join Date: Mar 2009
Location: Trieste, Italy
Posts: 56
Rep Power: 8
ariorus is on a distinguished road
Thanks Eugene, thanks Hrvoje.

My problem is just to find out where and in which way the basic operations are placed in the code..

I'm using Doxygen documentation but I often have problems to identify the member function I need.
In this example I tried also to access the source code of some macros such as "sum" or "forAll" which could help me to understand, I think. But I didn't manage to find them.

Do you think there are some examples or some parts of the code to have a look at in order to catch a little deeper the structure of OpenFoam programming? It would be very useful to me..
ariorus is offline   Reply With Quote

Old   July 7, 2006, 18:40
Default Hi I am solving a flow ins
  #8
New Member
 
Jeff Allen
Join Date: Mar 2009
Posts: 11
Rep Power: 8
jballen is on a distinguished road
Hi

I am solving a flow inside a domain consisting of a rectangular box. I would like to know how to determine the length width and height of this domain in a piece of code.
Thanks
Jeff
jballen is offline   Reply With Quote

Old   July 7, 2006, 19:02
Default Oh, I forgot. This portion goe
  #9
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
Oh, I forgot. This portion[1] goes between these lines:

const fvPatchList& patches = mesh.boundary();

forAll(patches, patchI)


[1]:
forAll(U.boundaryField(), patchI)
{
if (U.boundaryField()[patchI].fixesValue())
{
Uav += average(U.boundaryField()[patchI]);
}
}
msrinath80 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boundary Condition definition for Tensorial Fields and viscoelastic flow simulation titio OpenFOAM Running, Solving & CFD 1 February 4, 2009 10:14
Gamma field on boundary patch tom OpenFOAM Post-Processing 0 March 23, 2008 07:56
Only one boundary patch after gambitToFoam conversion bewuethr OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 3 August 22, 2007 10:30
How can we use the point patch fields given in OpenFOAM141srcfvMotionSolverpointPatchFieldsderived jaswi OpenFOAM Running, Solving & CFD 0 August 17, 2007 14:19
Fields as Boundary conditions? Martin CFX 1 October 15, 2003 19:02


All times are GMT -4. The time now is 05:43.