CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Writing Integral with Bessel Function (https://www.cfd-online.com/Forums/openfoam-programming-development/226546-writing-integral-bessel-function.html)

Madeinspace April 30, 2020 10:49

Writing Integral with Bessel Function
 
1 Attachment(s)
Hi,


Bessel function seem to have been implemented in OpenFOAM library. As mentioned in the programmer's guide, Type 1 Bessel function of zeroth order in OF is j0(S) and first order is j1(S). Then how do I write to calculate this bessel function. Can someone please help?


All the notations are known but I don't know how to write it in OF.


Thanks in advance!












CFD_10 April 30, 2020 12:10

Try the following:


Code:

Foam::jn(0, s)
Foam::jn(1, s)

// or
Foam::j0(s)
Foam::j1(s)


Madeinspace May 4, 2020 13:36

Hi CFD_10,


Thanks. Do you know what is lambda in the equation? All the other notations are process parameters but lambda must come from Bessel function. It is not mentioned in the literature what is lambda. I am completely new to this equation.



Thanks again!

CFD_10 May 4, 2020 15:30

Quote:

Originally Posted by Madeinspace (Post 768656)
Hi CFD_10,


Thanks. Do you know what is lambda in the equation? All the other notations are process parameters but lambda must come from Bessel function. It is not mentioned in the literature what is lambda. I am completely new to this equation.



Thanks again!


What is the reference of that equation?

Madeinspace May 4, 2020 16:25

Initially developed by the authors in reference
https://link.springer.com/content/pd...BF02815302.pdf


It has since been used by several authors like
Eq. 32 in https://www.sciencedirect.com/scienc...17931019319295
Eq. 3a in https://www.researchgate.net/publica...ng_arc_welding


Regards,

CFD_10 May 5, 2020 07:16

Quote:

Originally Posted by Madeinspace (Post 768686)
Initially developed by the authors in reference
https://link.springer.com/content/pd...BF02815302.pdf


It has since been used by several authors like
Eq. 32 in https://www.sciencedirect.com/scienc...17931019319295
Eq. 3a in https://www.researchgate.net/publica...ng_arc_welding


Regards,


My guess is that \lambda is an eigenvalue of the Laplacian operator. In this case, it looks like it has dimension of 1/length.


But I think you don't have to care about it since it is just an integration variable.

Madeinspace May 5, 2020 10:06

Quote:

Originally Posted by CFD_10 (Post 768787)
My guess is that \lambda is an eigenvalue of the Laplacian operator. In this case, it looks like it has dimension of 1/length.


But I think you don't have to care about it since it is just an integration variable.


Hi CFD_10,
Appereciate your help. Yes, It should have the dimension of 1/length so that the exponential term is dimensionless. So I defined a dimensionedScalar variable named lambda and gave it value of one with dimension (1/length). It compiles and runs however the computed values are way off. How do I compute the integration from 0 to infinity. Does Foam::J0 take care of that part?



Code:

volScalarField Jz = I_A/(2*pi)*lambda*Foam::j0(lambda*r_local)*Foam::exp(-Foam::sqr(lambda*SigmaQ)/2)*(Foam::sinh(lambda*(L0-cellCentre.component(vector::Y))))/(Foam::sinh(lambda*L0));

regards,

CFD_10 May 5, 2020 14:09

You can use your favorite numerical integration method to compute that integral (Simpson, Romberg, Gauss quadratures, etc.).


You have:

J_{ze} = \int_0^\infty{f\left(\lambda; \cdots\right) \mathrm d\lambda}

You can change the limits of the integral to make it easy (over a finite interval):



\lambda = {t\over 1-t}
J_{ze}  = \int_0^1{f\left({t\over 1-t}; \cdots\right){1\over (1-t)^2} \mathrm dt}


I think you can declare Jze as volScalarField and loop over all the cells, and compute the integral for each cell.


That's my opinion take it with a grain of salt.

Madeinspace June 24, 2020 12:32

Thank You CFD_10. I was able to do it by computing the integral using Trapezoid rule and looping over the entire cell in the domain.


Regards,

Schmidtgen May 4, 2022 05:37

help
 
Quote:

Originally Posted by Madeinspace (Post 775874)
Thank You CFD_10. I was able to do it by computing the integral using Trapezoid rule and looping over the entire cell in the domain.


Regards,


How many intervals did you use to integrate with the Trapezoid rule?


All times are GMT -4. The time now is 11:34.