|
[Sponsors] |
April 3, 2014, 15:33 |
OpenFOAM basic integration
|
#1 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
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 |
|
April 9, 2014, 00:06 |
|
#2 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
Check this out:http://www.cfd-online.com/Forums/ope...-integral.html
By Christian Butcher's hint, I am gonna try Remberg method. You can find Remberg's code somewhere else. Best, |
|
April 9, 2014, 05:02 |
|
#3 |
Senior Member
Join Date: Jan 2012
Posts: 166
Rep Power: 14 |
hi,
thx, but I ve already used another library for basic numerical integration. I am not sure if I am allowed link it here (?). |
|
April 10, 2014, 09:21 |
Hi Maybee
|
#4 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
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 |
|
April 10, 2014, 20:15 |
|
#5 | |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
Quote:
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; } |
||
April 10, 2014, 23:59 |
Hi sharonyue
|
#6 |
Member
Manjunath Reddy
Join Date: Jun 2013
Posts: 47
Rep Power: 12 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[mesh manipulation] Basic Of MovingMesh - OpenFoam! | ali jafari | OpenFOAM Meshing & Mesh Conversion | 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 |