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

const volVectorField& U = db().lookupObject<volVectorField>("U") gives runtime error

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 28, 2014, 18:26
Default const volVectorField& U = db().lookupObject<volVectorField>("U") gives runtime error
  #1
Senior Member
 
kumar
Join Date: Mar 2009
Posts: 112
Rep Power: 17
kumar2 is on a distinguished road
Hi All,

I am trying to access the points in the mesh inside the linearSpring class.
So inside the linearSpring.C , (under the restrain member function), I do the
following modifications,
////////////////Mods. to linearSpring.C//
const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U"); //Line2
const fvMesh & mesh = U.mesh(); //Line3
const pointField & pp = mesh.points(); //Line4
/////////////////////////////////////////

The libary compiles with out errors, but when I use this in a solver(waveDyMFoam), it gives the
following run time errors. I also found that if I comment out Lines 2 to 4 , the run time error
disappears.

///////RUN TIME ERROR////
waveDyMFoam: symbol lookup error: /share/gecko/krishnak/OpenFOAM/krishnak-2.1.0/
platforms/linux64GccDPOpt/lib/mylibforcesNEW.so: undefined symbol: _Z2dbv

Any suggestion is welcome

Thanks in advance

Kumar
kumar2 is offline   Reply With Quote

Old   July 29, 2014, 04:35
Default
  #2
New Member
 
Jacques F.
Join Date: Jul 2013
Location: Toulouse
Posts: 6
Rep Power: 13
Jacks is on a distinguished road
What is in your Make/files and Make/options ?
Jacks is offline   Reply With Quote

Old   July 29, 2014, 16:17
Default
  #3
Senior Member
 
kumar
Join Date: Mar 2009
Posts: 112
Rep Power: 17
kumar2 is on a distinguished road
Quote:
Originally Posted by Jacks View Post
What is in your Make/files and Make/options ?
Hi Jacks,

Thanks for your quick reply.

Make/options is :
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude

LIB_LIBS = \
-lincompressibleTransportModels \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools \
-lsampling
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
Make/files
////////////////////////////////
forces/forces.C
forces/forcesFunctionObject.C
forceCoeffs/forceCoeffs.C
forceCoeffs/forceCoeffsFunctionObject.C
sDoFRBM = pointPatchFields/derived/sixDoFRigidBodyMotion
$(sDoFRBM)/sixDoFRigidBodyMotion.C
$(sDoFRBM)/sixDoFRigidBodyMotionIO.C
$(sDoFRBM)/sixDoFRigidBodyMotionState.C
$(sDoFRBM)/sixDoFRigidBodyMotionStateIO.C
sDoFRBMR = $(sDoFRBM)/sixDoFRigidBodyMotionRestraint
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraintNew.C
$(sDoFRBMR)/linearAxialAngularSpring/linearAxialAngularSpring.C
$(sDoFRBMR)/linearSpring/linearSpring.C
$(sDoFRBMR)/sphericalAngularSpring/sphericalAngularSpring.C
$(sDoFRBMR)/tabulatedAxialAngularSpring/tabulatedAxialAngularSpring.C
sDoFRBMC = $(sDoFRBM)/sixDoFRigidBodyMotionConstraint

$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraintNew.C
$(sDoFRBMC)/fixedAxis/fixedAxis.C
$(sDoFRBMC)/fixedLine/fixedLine.C
$(sDoFRBMC)/fixedOrientation/fixedOrientation.C
$(sDoFRBMC)/fixedPlane/fixedPlane.C
$(sDoFRBMC)/fixedPoint/fixedPoint.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVect orField.C
LIB = $(FOAM_USER_LIBBIN)/mylibforcesNEW
//////////////////////////////////////////////////////////

What area your thoughts?

Thanks in advance

Kumar
kumar2 is offline   Reply With Quote

Old   July 30, 2014, 06:16
Default
  #4
New Member
 
Jacques F.
Join Date: Jul 2013
Location: Toulouse
Posts: 6
Rep Power: 13
Jacks is on a distinguished road
I thought it might be due to linking error while compiling waveDyMFoam, so in Make/options file of your waveDyMFoam solver not mentioning correctly your
mylibforcesNEW.so library.
Jacks is offline   Reply With Quote

Old   July 30, 2014, 23:55
Default
  #5
Senior Member
 
kumar
Join Date: Mar 2009
Posts: 112
Rep Power: 17
kumar2 is on a distinguished road
Hi Jacks,

I tried out your suggestion, i.e, I recompiled the waveDyMFoam with the library (instead of calling the library at real time in the controlDict of waveDyMFoam, as a dynamic linked library, which I did first) and I get this error.

// ERROR//
/share/gecko/krishnak/OpenFOAM/krishnak-2.1.0/platforms/linux64GccDPOpt/lib/libmylibforcesNEW.so: undefined reference to `db()
//////////////

I implemented the new code starting with, {const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U"); } .., inspired by this post http://www.cfd-online.com/Forums/ope...tml#post254642 , but reading more closely and going through fvPatchField.H, I found that db is already defined in that class and that may be the reason they are able to access it. However in the linearSpring class , no db ( or similar) is defined. Also no db is defined in the class above linearSpring ( sixDoFRigidBodyMotionRestraints ). At this point I am not sure how to proceed. Once again, If you can give any pointers on how to proceed, that would be great.

Thanks a lot

Kumar
kumar2 is offline   Reply With Quote

Old   March 6, 2020, 22:41
Default
  #6
New Member
 
tooran
Join Date: Nov 2016
Posts: 23
Rep Power: 10
tooran is on a distinguished road
Quote:
Originally Posted by kumar2 View Post
Hi All,

I am trying to access the points in the mesh inside the linearSpring class.
So inside the linearSpring.C , (under the restrain member function), I do the
following modifications,
////////////////Mods. to linearSpring.C//
const objectRegistry& db();
const volVectorField& U = db().lookupObject<volVectorField>("U"); //Line2
const fvMesh & mesh = U.mesh(); //Line3
const pointField & pp = mesh.points(); //Line4
/////////////////////////////////////////

The libary compiles with out errors, but when I use this in a solver(waveDyMFoam), it gives the
following run time errors. I also found that if I comment out Lines 2 to 4 , the run time error
disappears.

///////RUN TIME ERROR////
waveDyMFoam: symbol lookup error: /share/gecko/krishnak/OpenFOAM/krishnak-2.1.0/
platforms/linux64GccDPOpt/lib/mylibforcesNEW.so: undefined symbol: _Z2dbv

Any suggestion is welcome

Thanks in advance

Kumar

use this following line.



const fvMesh& mesh = U_.mesh();
tooran is offline   Reply With Quote

Old   March 9, 2020, 01:01
Default
  #7
Senior Member
 
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16
ybapat is on a distinguished road
You need to access db using function in mesh. Check functions in fvMesh for this.
ybapat is offline   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
error compiling modified applications yvyan OpenFOAM Programming & Development 21 March 1, 2016 05:53
RunTim Error for simpleFoam Djub OpenFOAM Running, Solving & CFD 2 April 12, 2013 12:51
how to change a volScalarField in bc? Katl OpenFOAM Programming & Development 20 February 2, 2012 07:10
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 03:32


All times are GMT -4. The time now is 04:07.