# can OpenFOAM calculate definite integral?

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

 April 7, 2014, 22:05 can OpenFOAM calculate definite integral? #1 Senior Member   Dongyue Li Join Date: Jun 2012 Location: Torino, Italy Posts: 757 Rep Power: 10 Hi guys, I wanna implant this equation into OpenFOAM. But I dont know how to deal with this definite integral. Any ideas? Code:  fvScalarMatrix nEqn ( fvm::ddt(n) + fvm::div(phi1,n) == ???? );

 April 7, 2014, 22:15 #2 Member   Christian Butcher Join Date: Jul 2013 Location: Japan Posts: 85 Rep Power: 6 What sort of object is f(e)? I mean, for example, if phi is a surfaceScalarField and U is a volVectorField etc.

April 7, 2014, 22:21
#3
Senior Member

Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 757
Rep Power: 10
Quote:
 Originally Posted by chrisb2244 What sort of object is f(e)? I mean, for example, if phi is a surfaceScalarField and U is a volVectorField etc.
Actually I made this very simple to make it clear. The complete edition is

So I think its volScalarField. rite?

 April 7, 2014, 23:03 #4 Member   Christian Butcher Join Date: Jul 2013 Location: Japan Posts: 85 Rep Power: 6 So I took a few swings at this but I think you're going to wind up with a Gamma function in your integrated quantity here. http://reference.wolfram.com/mathematica/ref/Gamma.html https://www.wolframalpha.com/input/?...8a%20x%29&lk=2 I'm not sure how you'd want to implement that in OpenFOAM :/ You can presumably get somewhere by just summing up over a set of values of but I don't know how horribly inaccurate that will become. You have all of the fields you're going to need reasonably easily accessible, but I'm not sure how to get a better answer than writing out some sort of for loop, or a functor - which would require you to write a class afaict.

 April 7, 2014, 23:05 #5 Member   Christian Butcher Join Date: Jul 2013 Location: Japan Posts: 85 Rep Power: 6 In terms of a for loop, what I mean is something conceptually like Code: for (double x = 0.5; x <= 1; x = x+0.01) { sum += ( pow(x, 0.55) * exp(a * x)); } where a is a volScalarField equal to the product of your

April 7, 2014, 23:17
#6
Senior Member

Dongyue Li
Join Date: Jun 2012
Location: Torino, Italy
Posts: 757
Rep Power: 10
Quote:
 Originally Posted by chrisb2244 In terms of a for loop, what I mean is something conceptually like Code: for (double x = 0.5; x <= 1; x = x+0.01) { sum += ( pow(x, 0.55) * exp(a * x)); } where a is a volScalarField equal to the product of your
This method is feasible. But I think if OpenFOAM can deal with definite integral directly, that would be perfect. And the Gamma function you'd mentioned Im not familar with that, maybe it will take me a while to dig into it.

Actually Im tring to implant PBM into Foam, the RHS of the equation is luo breakage kernel~. Right now Im stuck here. I will try your loop method and keep this thread update. However, I dont know if it would be accurate, but its a good start I think. Thanks very much.

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post Xwang OpenFOAM 20 May 20, 2016 11:26 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 07:18 opencfd OpenFOAM Announcements from ESI-OpenCFD 13 March 30, 2013 17:52 rosswin Open Source Meshers: Gmsh, Netgen, CGNS, ... 0 March 5, 2013 08:34 ypchen FLUENT 4 January 4, 2012 08:53

All times are GMT -4. The time now is 07:30.