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

Possible bug in OpenFoam Interpolation class

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 5, 2014, 07:35
Default Possible bug in OpenFoam Interpolation class
  #1
New Member
 
Matteo
Join Date: Sep 2013
Location: Milan, Italy
Posts: 9
Rep Power: 3
MMC15 is on a distinguished road
Hello everybody,

I'm currrently using the class interpolationCellPoint, but I experienced a strange behaviour in its usage.

I'm using this class in two different ways:
- the first, I declare an object Uinter of class interpolationCellPoint in the header file of my custom class:
Code:
#include "interpolationCellPoint.H" // need by Uinter
namespace Foam {
class myClass {
public:
...some objects...
interpolationCellPoint<vector> Uinter;
vector velInterp(point &iVelPoint,label &iVelCell);
private: 
...
   }
}
and I define it in constructor:
Code:
#include "myClass.h"
namespace Foam {
defineTypeNameAndDebug(myClass, 1);
// Default Constructor
myClass::myClass(const volVectorField& U):
    ...some definitions...
    // Set the pointer to the velocity field
    U_(U),
    // Uinter construction
    Uinter(U),
...other definitions...
{}
}
where const volVectorField& U comes from my custom solver based on simpleFoam. Then in velInterp I call the interpolate member function of Uinter:
Code:
#include "myClass.h"
namespace Foam {
vector myClass::velInterp(point &iVelPoint,label &iVelCell)
    {
V=Uinter.interpolate(iVelPoint, iVelCell);
return(V);
}
}
That works correctly and gives me a vector output as expected.

- the second, I declare and define the variable Uinter of class intersectioCellPoint directly inside the velInterp function, so it is no more a myClass public member, but it borns and dies directly inside the function:
Code:
#include "myClass.h"
namespace Foam {
vector myClass::velInterp(point &iVelPoint,label &iVelCell)
    {
interpolationCellPoint<vector> Uinter(U_);
V=Uinter.interpolate(iVelPoint, iVelCell);
return(V);
}
}
I obviously expect that these two methods are equivalent, but I noticed that the vectors V are different.

I can't figure out the reason for this discrepancy in the results.
Is it my fault or have I found a bug?

Last edited by MMC15; March 5, 2014 at 10:50.
MMC15 is offline   Reply With Quote

Old   March 6, 2014, 06:08
Default
  #2
New Member
 
Matteo
Join Date: Sep 2013
Location: Milan, Italy
Posts: 9
Rep Power: 3
MMC15 is on a distinguished road
I forgot to mention that I'm using openfoam 2.2.2.
MMC15 is offline   Reply With Quote

Old   March 23, 2014, 13:55
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,488
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Matteo,

Without a complete test case (case + application source code) for easily+quickly testing this, it's very hard for anyone to be able to answer to your question(s), without taking several hours to set-up an identical code structure and test case.

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM class to represent initial boundary conditions sanatan OpenFOAM Programming & Development 1 March 20, 2011 10:16
bubbleFoam validation case balkrishna OpenFOAM Running, Solving & CFD 24 August 30, 2010 04:37
Surface interpolation schemes and parallelization jutta OpenFOAM Running, Solving & CFD 0 February 25, 2010 15:32
Cumulative patch for OpenFOAM 141 January 3rd 2007 msrinath80 OpenFOAM Bugs 6 January 4, 2008 11:12
OpenFOAM 14 stock version parallel bug msrinath80 OpenFOAM Bugs 2 May 30, 2007 14:47


All times are GMT -4. The time now is 15:49.