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

Possible bug in OpenFoam Interpolation class

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 5, 2014, 06:35
Default Possible bug in OpenFoam Interpolation class
  #1
New Member
 
Matteo
Join Date: Sep 2013
Location: Milan, Italy
Posts: 9
Rep Power: 12
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 09:50.
MMC15 is offline   Reply With Quote

Old   March 6, 2014, 05:08
Default
  #2
New Member
 
Matteo
Join Date: Sep 2013
Location: Milan, Italy
Posts: 9
Rep Power: 12
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, 12:55
Default
  #3
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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 Search this Thread
Search this Thread:

Advanced Search
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 Off
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 09: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 14:32
Cumulative patch for OpenFOAM 141 January 3rd 2007 msrinath80 OpenFOAM Bugs 6 January 4, 2008 10: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 08:49.