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

How to execute the numerical integration in OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2022, 07:52
Default How to execute the numerical integration in OpenFOAM
  #1
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 349
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello Foamers,
I need to execute the following integrations in OpenFOAM as member functions.
Quote:
H2Ox = @(EA) -H2O*(-8/(48000^8)).*(((EA)-E0).^7).*FE_H2O(EA).*A_PVM(EA);
H2Oz = integral(H2Ox, E0, Inf);

CO2x = @(EA) -CO2*(-4/(78000^4)).*(((EA)-E0).^3).*FE_CO2(EA).*A_PVM(EA);
CO2z = integral(CO2x, E0, Inf);
The above functions was executed in MATLAB. I don't know how to implement in OpenFOAM.
Kindly someone share your thoughts.
Thank you
Kummi is offline   Reply With Quote

Old   August 7, 2022, 00:36
Question
  #2
Senior Member
 
Kumaresh
Join Date: Oct 2016
Posts: 349
Rep Power: 11
Kummi is on a distinguished road
Send a message via Yahoo to Kummi
Hello all,
As per the following link,
can OpenFOAM calculate definite integral?
I tried this way using for-loop ~~
Quote:
template<class thermo>inline Foam::scalar Foam::constSolidTransport<thermo>::C2H6(const scalar T) const
{
if (T>=623)
{
scalar dx = 1E-7, C2H6y =0, C2H6z = 0;

for (double x = 183000; x <= 1E100; x = x +dx)
{
if (*mC2H6_int < mC2H6_)
{
C2H6z = (SMALL + (-mC2H6_* ((x/x)*(-4/(VSMALL+SMALL+(Foam:ow(61000,4))))) * (Foam:ow((x-E0_),3)) * (Foam::exp(-(Foam:ow(((x-E0_)/61000),4)))) * ((1-(Foam::exp(-1.3E13*deltime_*Foam::exp(-x/(8.3144*T))))))));
*mC2H6_int += C2H6z * dx;
C2H6y = mC2H6_ - *mC2H6_int;
}
break;
}
std::cout<<"integral_out_C2H6 = " << C2H6y << std::endl;
return (C2H6y);
}
else { return mC2H6_;}
}
But that's not working properly..
Any thoughts Foamers ?
Thank you
Kummi 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
Getting Started with OpenFOAM wyldckat OpenFOAM 25 August 14, 2022 13:55
[OpenFOAM.org] A Mac OS X of23x Development Environment Using Docker rt08 OpenFOAM Installation 1 February 28, 2016 19:00
OpenFOAM UML bidirectional integration chandramurthy OpenFOAM Programming & Development 2 January 16, 2015 03:30
3d numerical integration over a control volume hitmre Main CFD Forum 1 July 30, 2012 00:55
Any numerical triple integration program is available in Fortran? Radhakrishnan Main CFD Forum 3 March 4, 1999 01:03


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