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

OpenFOAM basic integration

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

Like Tree1Likes
  • 1 Post By manju819

Reply
 
LinkBack Thread Tools Display Modes
Old   April 3, 2014, 15:33
Default OpenFOAM basic integration
  #1
Senior Member
 
Join Date: Jan 2012
Posts: 159
Rep Power: 4
maybee is on a distinguished road
Hi,

does OpenFOAM provide basic integral methods?

If I provide a mathematical function and the lower and upper limits of integration is there a OpenFOAM method to calculate the integral or do I have to use third party code?

greetings
maybee
maybee is offline   Reply With Quote

Old   April 9, 2014, 00:06
Default
  #2
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 507
Rep Power: 6
sharonyue is on a distinguished road
Check this out:can OpenFOAM calculate definite integral?

By Christian Butcher's hint, I am gonna try Remberg method. You can find Remberg's code somewhere else.

Best,
sharonyue is offline   Reply With Quote

Old   April 9, 2014, 05:02
Default
  #3
Senior Member
 
Join Date: Jan 2012
Posts: 159
Rep Power: 4
maybee is on a distinguished road
hi,

thx, but I ve already used another library for basic numerical integration. I am not sure if I am allowed link it here (?).
maybee is offline   Reply With Quote

Old   April 10, 2014, 09:21
Default Hi Maybee
  #4
New Member
 
Manjunath Reddy
Join Date: Jun 2013
Posts: 26
Rep Power: 3
manju819 is on a distinguished road
Its availble in OpenFOAM no need of third party soft

In the "/opt/openfoam222/applications/test/dataEntry" in the dataEntry.C you can find about the integration with the upper and lower limits. You can make that dataEntry.C by copying it to run folder.

Regards,
Manjunath
manju819 is offline   Reply With Quote

Old   April 10, 2014, 20:15
Default
  #5
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 507
Rep Power: 6
sharonyue is on a distinguished road
Quote:
Originally Posted by manju819 View Post
Its availble in OpenFOAM no need of third party soft

In the "/opt/openfoam222/applications/test/dataEntry" in the dataEntry.C you can find about the integration with the upper and lower limits. You can make that dataEntry.C by copying it to run folder.

Regards,
Manjunath
Thanks bro, This Test-DataEntry.C can calculate integration. But when I run this Test-DateEntry.C it failed. So I just make it very simple:

Code:
#include "fvCFD.H"
#include "DataEntry.H"
#include "IOdictionary.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#   include "setRootCase.H"
#   include "createTime.H"
#   include "createMesh.H"

    IOdictionary dataEntryProperties
    (
        IOobject
        (
            "dataEntryProperties",
            runTime.constant(),
            mesh,
            IOobject::MUST_READ_IF_MODIFIED,
            IOobject::NO_WRITE
        )
    );

    autoPtr<DataEntry<scalar> > dataEntry
    (
        DataEntry<scalar>::New
        (
            "dataEntry",
            dataEntryProperties
        )
    );

    scalar x0 = readScalar(dataEntryProperties.lookup("x0"));
    scalar x1 = readScalar(dataEntryProperties.lookup("x1"));

    Info<< "Integration" << nl
        << "    int(f(x)) lim(x0->x1) = " << dataEntry().integrate(x0, x1) << nl
        << endl;

    return 0;
}
While right now Im confused that where can I input my f(x), do you know? Thanks.
sharonyue is offline   Reply With Quote

Old   April 10, 2014, 23:59
Default Hi sharonyue
  #6
New Member
 
Manjunath Reddy
Join Date: Jun 2013
Posts: 26
Rep Power: 3
manju819 is on a distinguished road
Firstly it works like if we give x and y data, it interpolates linearly(default) or it uses cubic spline. So then by giving lower limit and upper limit it integrates over the limits and gives the data. This is how it works kk

Now coming to dataEntry....

you can see in dataEntryProperties


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.2 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object dataEntryProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

x0 0.5;//lower limit
x1 1;//Upper limit


dataEntry table (
(0 0)//(x1,y1) point
(10 1));(x2,y2) point


// ************************************************** *********************** //


dataEntry().integrate(x0, x1) //This is area under the region

Iterpolates this data and gives the stright line and on integration gives area under the region....

Post your error i will look into that....

Regards
Manjunath
sharonyue likes this.
manju819 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
Basic Of MovingMesh - OpenFoam! ali jafari OpenFOAM Native Meshers: blockMesh 0 December 20, 2012 04:31
OpenFOAM Foundation Releases OpenFOAMŪ Version 2.1.1 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 May 31, 2012 09:07
OpenFOAM 1.6.x, 1.7.0 and 1.7.x are not fully prepared to work with gcc-4.5.x wyldckat OpenFOAM Bugs 18 October 21, 2010 05:51
Cross-compiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 7 January 19, 2010 15:39
Adventure of fisrst openfoam installation on Ubuntu 710 jussi OpenFOAM Installation 0 April 24, 2008 14:25


All times are GMT -4. The time now is 01:38.