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

Interpolation from several volscalarfield named Y[i]

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Daniel_Khazaei
  • 1 Post By Daniel_Khazaei

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2020, 08:25
Default Interpolation from several volscalarfield named Y[i]
  #1
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear friends
I have defined several volScalarField as below;
Code:
label N = 2;
    PtrList<volScalarField> Y(N);
and now I want to interpolate them. As am example, we interpolate velocity U as below;
Code:
 UInterp_
    (
        interpolation<vector>::New
        (
            cloud.solution().interpolationSchemes(),
            cloud.U()
        )
    ),
How should I interpolate using PtrList?


Thanks,
Farzad
farzadmech is offline   Reply With Quote

Old   January 27, 2020, 09:58
Default
  #2
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
I think you can try and make a PtrList of your interpolators which can be recalled for each element by [] operator.
farzadmech likes this.
Daniel_Khazaei is offline   Reply With Quote

Old   January 27, 2020, 10:46
Default
  #3
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Thank you for your response dear Daniel. So what are you saying is this(could you please confirm that);

Code:
YiInterp_[1]
    (
        interpolation<scalar>::New              //scalarField
        (
            cloud.solution().interpolationSchemes(),
            cloud.Yi()
        )
    ),
And;

Code:
YiInterp_[2]
    (
        interpolation<scalar>::New              //scalarField
        (
            cloud.solution().interpolationSchemes(),
            cloud.Yi()
        )
    ),
So what should I do with Yi()?

Quote:
Originally Posted by Daniel_Khazaei View Post
I think you can try and make a PtrList of your interpolators which can be recalled for each element by [] operator.
farzadmech is offline   Reply With Quote

Old   January 27, 2020, 11:32
Default
  #4
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
Well I'm writing this on the fly without knowing what your trying to do exactly, it seems that you are trying to implement this at constructor level:

1- You can create a PtrList without knowing its size and elements by using the null constructor provided by class PtrList.

step #1

Initialize your list with null constructor at initializer list level as follow:

Code:
YiInterp_()
if you already know the size:
Code:
YiInterp_(list_size_here)
step #2

Now inside the constructor body just loop over the element, but if you have used the null constructor you need to set a size before starting to access elements:

Code:
YiInterp_.setSize(list_size_here); // skip this if you have set the size before
forAll(YiInterp_, i)
{
    YiInterp_.set
    (
        i,
        interpolation<scalar>::New
        (
            cloud.solution().interpolationSchemes(),
            cloud.Yi()[i]
        )
    );
}
NOTE: here I assumed that Yi is a PtrList itself, otherwise I don't see any point to create a list of interpolators.
farzadmech likes this.

Last edited by Daniel_Khazaei; January 27, 2020 at 13:03.
Daniel_Khazaei is offline   Reply With Quote

Old   January 27, 2020, 12:37
Default
  #5
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Thanks Daniel. I will try the way you suggested and let you know.


Farzad
farzadmech is offline   Reply With Quote

Old   January 27, 2020, 13:05
Default
  #6
Senior Member
 
Daniel
Join Date: Mar 2013
Location: Noshahr, Iran
Posts: 348
Rep Power: 21
Daniel_Khazaei will become famous soon enough
Quote:
Originally Posted by farzadmech View Post
Thanks Daniel. I will try the way you suggested and let you know.
Farzad
I have just updated my previous post with the correct syntax.
Daniel_Khazaei is offline   Reply With Quote

Reply

Tags
ptrlist, volscalarfield list


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
y+ and u+ values with low-Re RANS turbulence models: utility + testcase florian_krause OpenFOAM 114 August 23, 2023 06:37
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
[OpenFOAM] Native ParaView Reader Bugs tj22 ParaView 270 January 4, 2016 12:39
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 07:16
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


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