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

Run Time Selection table pointer error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 18, 2016, 06:31
Default Using Run Time Selection : table pointer error at run time
  #1
jmf
Member
 
Jean-Michel FONTAINE
Join Date: Aug 2009
Location: Orleans - France
Posts: 55
Rep Power: 16
jmf is on a distinguished road
Hi

I attempt to write a custom solid body motion solver. The external force management is massively inspired from "sixDoFRigidBodyMotion" (many thanks to the author), and uses the Run Time Selection mechanism.

The problem is that the RTS table pointer is not found and throw an error at run time.

Here's the skeleton of my code and the run error message.

I've been struggling with that bug for days.
I probably miss something big, too big to be seen ?

Dear RTS specialists, I would appreciate your help so much

Jean-Michel

Code:
/* solver.C
 */
    Info<< "Create bodyMotion" << nl << endl;
    bodyMotion motion(mesh, bodyFluidDict);
Code:
/* bodyMotion.C
 */

// * * * * * * * * * * Constructors * * * * * * * * * 

Foam::bodyMotion::bodyMotion
(
    fvMesh& mesh,
    const dictionary& bodyFluidDict
)
{
    // Add all the external actions
    createAllExternActions(bodyFluidDict);
}

// * * * * * * * * * * Public * * * * * * * * * * * 

void Foam::bodyMotion::createAllExternActions
(
    const dictionary& bodyFluidDict
)
{
    if (bodyFluidDict.found("externalActions"))
    {
        const dictionary& actionsDict = bodyFluidDict.subDict("externalActions");
        label iAction = 0;
        externActionsPtrList_.setSize(actionsDict.size());

        // Loop for reading each sub-sub-dictionary of actionsDict
        forAllConstIter(IDLList<entry>, actionsDict, iter)
        {
            if (iter().isDict())
            {
                externActionsPtrList_.set
                (
                    iAction++,
                    bodyExternActions::New
                    (
                        iter().keyword(),
                        iter().dict()
                    )
                );
            }
        }
        externActionsPtrList_.setSize(iAction);
    }
}
Code:
/* bodyExternActionsNew.C
 * Copy from sixDoFRigidBodyMotionRestraint::New()
 */

Foam::autoPtr<Foam::bodyExternActions> Foam::bodyExternActions::New
(
    const word& customName,
    const dictionary& actionDict
)
{
    const word actionType
    (
        actionDict.lookup("externalAction")
    );

    if (!dictionaryConstructorTablePtr_)
    {
        FatalErrorIn
        (
            "bodyExternActions::New(customName, actionDict)"
        )
        << exit(FatalError);
///////////////////// FATAL ERROR /////////////////////////////////////////////
    }
}
Code:
/*  bodyExternActions.C
 *  Copy from sixDoFRigidBodyMotionRestraint.C
 */

#include "bodyExternActions.H"

namespace Foam
{
    defineTypeNameAndDebug(bodyExternActions, 0);
    defineRunTimeSelectionTable(bodyExternActions, dictionary);
}
Code:
/*  bodyExternActions.H:
 *  Copy from sixDoFRigidBodyMotionRestraint.H
 */

// Forward declaration of classes
class bodyMotion;

class bodyExternActions
{

public:
    //- Runtime type information
    TypeName("bodyExternActions");

    // Declare run-time constructor selection table
        declareRunTimeSelectionTable
        (
            autoPtr,
            bodyExternActions,
            dictionary,
            (const word& name, const dictionary& actionsDict),
            (name, actionsDict)
        );

    // Constructors
        //- Construct from the actionsDict dictionary
        bodyExternActions
        (
            const word& name,
            const dictionary& actionsDict
        );

        //- Construct and return a clone
        virtual autoPtr<bodyExternActions> clone() const = 0;

    // Selectors
        //- Select constructed from the actionsDict dictionary 
        static autoPtr<bodyExternActions> New
        (
            const word& name,
            const dictionary& actionsDict
        );
};
}
Code:
/* bodySpring.C
 * Copy from linearSpring.C
 */
 
#include "bodySpring.H"
#include "addToRunTimeSelectionTable.H"
#include "bodyMotion.H"

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace bodyExternActions
{
    defineTypeNameAndDebug(bodySpring, 0);

    addToRunTimeSelectionTable
    (
        bodyExternActions,
        bodySpring,
        dictionary
    );
}
}
Code:
/* bodyFluidDict
 */
externalActions
{
    spring1
    {
        externalAction      bodySpring;
        anchor              ( 0.0   -0.0     0.0);
        refAttachmentPt     (-0.0    0.0     0.0);
        stiffness           1000;
        damping             1000;
        restLength          0;
    }
}
The run error message :

Code:
Create bodyMotion

> Creates new bodyExternActions: 
spring1
{
    externalAction  bodySpring;
    anchor          ( 0 -0 0 );
    refAttachmentPt ( -0 0 0 );
    stiffness       1000;
    damping         1000;
    restLength      0;
}

#0  Foam::error::printStack(Foam::Ostream&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/OSspecific/POSIX/printStack.C:219
#1  Foam::sigSegv::sigHandler(int) at ~/OpenFOAM/OpenFOAM-2.4.0/src/OSspecific/POSIX/signals/sigSegv.C:56
#2  ? in "/lib64/libc.so.6"
#3  Foam::HashTable<Foam::autoPtr<Foam::bodyExternActions> (*)(Foam::word const&, Foam::dictionary const&), Foam::word, Foam::string::hash>::find(Foam::word const&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/OpenFOAM/lnInclude/HashTable.C:143
#4  Foam::bodyExternActions::New(Foam::word const&, Foam::dictionary const&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/bodyFluid/bodyMotion/bodyExternActionsNew.C:39
#5  Foam::bodyMotion::createAllExternActions(Foam::dictionary const&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/bodyFluid/bodyMotion/bodyMotion.C:258 (discriminator 1)
#6  Foam::bodyMotion::bodyMotion(Foam::fvMesh&, Foam::dictionary const&) at ~/OpenFOAM/OpenFOAM-2.4.0/src/bodyFluid/bodyMotion/bodyMotion.C:73
#7  ? at ~/OpenFOAM/OpenFOAM-2.4.0/applications/solvers/multiphase/bodyWaveFoam/bodyWaveFoam.C:47
#8  __libc_start_main in "/lib64/libc.so.6"
#9  ? at /home/abuild/rpmbuild/BUILD/glibc-2.18/csu/../sysdeps/x86_64/start.S:125

Last edited by jmf; November 19, 2016 at 09:35. Reason: More explicit title
jmf is offline   Reply With Quote

Reply

Tags
runtime selection


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
[Other] Contribution a new utility: refine wall layer mesh based on yPlus field lakeat OpenFOAM Community Contributions 58 December 23, 2021 02:36
Ansys Fluent 13.0 UDF compilation problem in Window XP (32 bit) Yogini Fluent UDF and Scheme Programming 7 October 3, 2012 07:24
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
[swak4Foam] groovyBC: problems compiling: "flex: not found" and "undefined reference to ..." sega OpenFOAM Community Contributions 12 February 17, 2010 09:30
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58


All times are GMT -4. The time now is 02:27.