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

can OpenFOAM calculate definite integral?

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

Like Tree2Likes
  • 1 Post By chrisb2244
  • 1 Post By sharonyue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 7, 2014, 23:05
Default can OpenFOAM calculate definite integral?
  #1
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
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)
       ==
	  ????
    );
\frac{{\partial \left( {{\rho _d}{N_d}} \right)}}{{\partial t}} + \nabla  \cdot \left( {{\rho _d}{u_d}{N_d}} \right) = \int\limits_{0.5}^1 {f\left( \varepsilon  \right)d\varepsilon }
sharonyue is offline   Reply With Quote

Old   April 7, 2014, 23:15
Default
  #2
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
What sort of object is f(e)?

I mean, for example, if phi is a surfaceScalarField and U is a volVectorField etc.
chrisb2244 is offline   Reply With Quote

Old   April 7, 2014, 23:21
Default
  #3
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by chrisb2244 View Post
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

f\left( \xi  \right) = {\xi ^{0.55}} \cdot {e^{\left( {surfacetension \bullet rho \bullet epsilon \bullet \xi } \right)}}

So I think its volScalarField. rite?
sharonyue is offline   Reply With Quote

Old   April 8, 2014, 00:03
Default
  #4
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
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 \xi 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.
chrisb2244 is offline   Reply With Quote

Old   April 8, 2014, 00:05
Default
  #5
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
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 \rho \epsilon \sigma
randolph likes this.
chrisb2244 is offline   Reply With Quote

Old   April 8, 2014, 00:17
Default
  #6
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by chrisb2244 View Post
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 \rho \epsilon \sigma
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.
Kummi likes this.
sharonyue is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate aerodynamic coefficients with openfoam using only opensource programs Xwang OpenFOAM 20 May 20, 2016 12:26
OpenFOAM Foundation releases OpenFOAM 2.2.2 opencfd OpenFOAM Announcements from ESI-OpenCFD 0 October 14, 2013 08:18
ESI-OpenCFD Releases OpenFOAM v2.2.0 opencfd OpenFOAM Announcements from ESI-OpenCFD 13 March 30, 2013 17:52
[Gmsh] gmsh 2.6.0 conversion to OpenFoam 160 rosswin OpenFOAM Meshing & Mesh Conversion 0 March 5, 2013 08:34
calculate integral in UDF ypchen FLUENT 4 January 4, 2012 08:53


All times are GMT -4. The time now is 08:22.