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

Operation of Modified Bessel Function on a ScalarField

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 19, 2020, 06:35
Default Operation of Modified Bessel Function on a ScalarField
  #1
New Member
 
Saumava Dey
Join Date: Sep 2020
Posts: 29
Rep Power: 5
saumavadey is on a distinguished road
Hello Foamers!

I am using Modified Bessel Functions 'cyl_bessel_k' from the boost C++ library in my OpenFOAM program.

I need to get the Modified Bessel Function values for all the values of a scalarField. Do I need to run a loop for that? I seek suggestions in this regard.
saumavadey is offline   Reply With Quote

Old   September 22, 2020, 14:06
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Something like this?
Code:
scalarField  fld =... ;  // some field

for (scalar& val : fld)
{
    val = your_func(val);
}
olesen is offline   Reply With Quote

Old   September 23, 2020, 09:23
Default
  #3
New Member
 
Saumava Dey
Join Date: Sep 2020
Posts: 29
Rep Power: 5
saumavadey is on a distinguished road
The functional value of a field should be another field. But in the above example, the value of the function has been defined as a scalar only.

Is it correctly done?
saumavadey is offline   Reply With Quote

Old   September 24, 2020, 18:58
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,685
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by saumavadey View Post
The functional value of a field should be another field. But in the above example, the value of the function has been defined as a scalar only.

Is it correctly done?
Wasn't clear from your question, but I don't see that the problem is OpenFOAM-specific, but looks much like any C++ solution. For example,
Code:
scalarField input =.... ;

scalarField output(input.size());
auto iter = output.begin();

for (const scalar val : input) 
{
    *iter = my_func(val);
    ++iter;
}
Can also use anything from the standard <algorithm> header too. I don't see where the problem is.
olesen is offline   Reply With Quote

Old   September 28, 2020, 03:30
Default
  #5
Senior Member
 
Domenico Lahaye
Join Date: Dec 2013
Posts: 723
Blog Entries: 1
Rep Power: 17
dlahaye is on a distinguished road
You can create the output scalarField by extending the file createField.H as AndreaCFD shows in his thread "Linearized Navier Stokes Solver". Once the solver has terminated, you should be able to see the file with the computed output scalar field. This file can visualized using ParaView.

Can you please provide more details on what exactly your intention is? What does it mean to apply the modified Bessel function to a scalarField in your case?
dlahaye is online now   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
loading issue libraries:libsimpleFunctionObjects.so libsimpleSwakFunctionObjects.so immortality OpenFOAM Pre-Processing 15 April 7, 2024 12:35
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 06:47
Incompatible dimensions for operation ruben23 OpenFOAM Running, Solving & CFD 2 June 12, 2015 04:14
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 01:27


All times are GMT -4. The time now is 05:12.