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

volumeIntegrate

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 5, 2015, 01:37
Default volumeIntegrate
  #1
kcn
Member
 
Join Date: May 2014
Posts: 31
Rep Power: 11
kcn is on a distinguished road
Can someone please tell me how to use volumeIntegrate function belonging to fvc in an OpenFOAM code.

I'm working on a solver including a chemical process and I need to get a volume integral of a reaction rate. I tried following code:

#include "fvcVolumeIntegrate.H"

volScalarField rc
(
"rc",
expression for reaction rate
);

volScalarField Vrc
(
"Vrc",
fvc::volumeIntegrate(rc)
);

But this did not work.

I got the following error while compiling,

no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField(const char [8], Foam::tmp<Foam::Field<double> >)’

indicating to the line I used fvc::volumeIntegrate(rc).

Can some one please help?

Thanks
kcn
kcn is offline   Reply With Quote

Old   May 5, 2015, 04:07
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

The error just says: "I can not construct volScalarField from string and scalarField". If you take a look at volumeIntegrate documentation [1], you find that the function returns Field<Type>, or in your case it is scalarField.

Now, if you look at the list of volScalarField constructors [2], there is really no constructor, which takes string and Field as arguments. You can try to use constructor [3], which takes IOobject (where the field should be saved), Mesh, dimensionSet (dimensions of the Field argument), Field (the result of volumeIntegrate), and list of boundary condition objects. Alternatively, you can use constructor [4] to create empty volScalarField and then assign result of the volumeIntegrate to internalField of the object created.

Or even more alternatively, you can clarify the reason for creation of the volScalarField from volumeIntegrate result. Maybe there is a way to do this without volScalarField.

1. http://foam.sourceforge.net/docs/cpp...8525fad4c79edf

2. http://foam.sourceforge.net/docs/cpp/a00911.html

3. http://foam.sourceforge.net/docs/cpp...bb5c374222054a

4. http://foam.sourceforge.net/docs/cpp...0d8f8a5fec0dc8
alexeym is offline   Reply With Quote

Old   May 5, 2015, 23:55
Default volumeIntegrate
  #3
kcn
Member
 
Join Date: May 2014
Posts: 31
Rep Power: 11
kcn is on a distinguished road
Dear alexeym

Thanks a lot for the reply, I managed to get the integral over the entire geometry using domainIntegrate function in OpenFOAM.

kcn
kcn 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
volumeIntegrate ? T.D. OpenFOAM 5 September 5, 2011 06:27


All times are GMT -4. The time now is 04:28.