CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Export patch profile

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 17, 2008, 05:50
Default How can I export a variable pr
  #1
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
How can I export a variable profile on a boundary patch ?
johndeas is offline   Reply With Quote

Old   January 22, 2008, 08:45
Default More precisely, how can I expo
  #2
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
More precisely, how can I export the content of a fvPatchField (either <double> or vector<double>) to a file ?
johndeas is offline   Reply With Quote

Old   January 23, 2008, 07:54
Default To better understand how class
  #3
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
To better understand how classes work, I tried to play a little. What I do not understand is why this code :

List<scalar> a(10);
a=2;
List<scalar> b(10);
b=3;
List<scalar> c=a+b;

Info << "c(1) = " << c[1] << endl;

gives the result c(1) = 5

since in the member functions of List I can not find the operator +
johndeas is offline   Reply With Quote

Old   January 23, 2008, 08:30
Default Not sure what else you have ex
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Not sure what else you have expected: 2 + 3 = 5.

Here, you created 2 lists of size 10, then assigned all elements of first list to 2 and all elements of the second list to 3 and summed them up.

The actual operator+(...) you are using is:


template<class>
tmp<field<typename>::type> >
operator Op(const UList<type1>& f1, const UList<type2>& f2);


in

/home/hjasak/OpenFOAM/OpenFOAM-1.4.1-dev/src/OpenFOAM/fields/Fields/Field/FieldF unctions.H

Beware of the macros...

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

Old   January 25, 2008, 05:17
Default Why are some operators impleme
  #5
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
Why are some operators implemented via member functions and others via macros ? It seems to me that macros are harder to find in the documentation ?
johndeas is offline   Reply With Quote

Old   January 25, 2008, 05:27
Default Because of code re-use and con
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Because of code re-use and consistency. Templates, (of course, you mean templates! rather than member functions) are preferred whenever possible - in fact you will see that the macro I've showed you actually defines a template.

Other possible question you may be asking is why is eg. operator+= a member and operator+ a friend. There are VERY good reasons for it, to do with automatic type conversion on the rhs argument. A good C++ book will tell you why.

Enjoy,

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

Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP NEEDED HOW TO MAP VALUES FROM PATCH OF ONE MESH TO PATCH OF ANOTHER MESH mkraposhin OpenFOAM Running, Solving & CFD 3 September 4, 2011 10:42
SampleDict patch export surface size amp orientation axel OpenFOAM Post-Processing 1 September 29, 2008 14:42
Patch mesh export ariorus OpenFOAM 3 March 7, 2006 06:41
about patch ZQX FLUENT 1 October 14, 2005 05:54
Boundary profile export each iteration Jiri Novak FLUENT 2 July 27, 2005 04:19


All times are GMT -4. The time now is 18:33.