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

Troubles when create a new volScalarField in my own library

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 19, 2013, 04:44
Default Troubles when create a new volScalarField in my own library
  #1
Member
 
Xiangyin Meng
Join Date: Jun 2012
Location: London
Posts: 69
Rep Power: 5
mxylondon is on a distinguished road
Dear all,

I'm struggling to create a new volScalarField variable in my own function before compiling my own source code, the exactly same thing like pressure, density, viscosity, etc.
But failed again and again, any suggestion please?
mxylondon is offline   Reply With Quote

Old   June 19, 2013, 04:50
Default
  #2
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
fail? your question is too vague, atleast post your error line
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   June 19, 2013, 05:18
Default
  #3
Member
 
Xiangyin Meng
Join Date: Jun 2012
Location: London
Posts: 69
Rep Power: 5
mxylondon is on a distinguished road
error: no matching function for call to ‘Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricField()’
mxylondon is offline   Reply With Quote

Old   June 19, 2013, 08:10
Default
  #4
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
would you mind!, add your pieces of code here too
__________________
Training Course on OpenFOAM at (http://www.isme.ir/)
My Weblog (http://openfoam.blogfa.com/)
nimasam is offline   Reply With Quote

Old   June 19, 2013, 10:48
Default
  #5
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 12
Bernhard is on a distinguished road
Quote:
Originally Posted by mxylondon View Post
But failed again and again, any suggestion please?
Suggestion: copy existing code from a solver and rename the variables.
Bernhard is offline   Reply With Quote

Old   June 19, 2013, 12:26
Default
  #6
Member
 
Xiangyin Meng
Join Date: Jun 2012
Location: London
Posts: 69
Rep Power: 5
mxylondon is on a distinguished road
Quote:
Originally Posted by nimasam View Post
would you mind!, add your pieces of code here too
A very simple test, the header file (XXX.H) is:

#include "fvCFD.H"
#include "IOstream.H"
#include "messageStream.H"

namespace Foam
{
namespace Test
{
class Try
{
public:
volScalarField value1,value2;
static volScalarField newField( );
};
}
}

The implement file (XXX.C) is:

#include "XXX.H"

namespace Foam
{
namespace Test
{
volScalarField value1;
volScalarField Try::newField( );
volScalarField value2;
value2=value1;
return (value2);
}
}


To generate a new library, I have tried with some 'int' type functions and variables in this way, they can be compiled and work well to be called in a main program.
But when the variable type is 'volScalarField', did I miss something? Like other header files to include?
mxylondon is offline   Reply With Quote

Old   June 20, 2013, 02:42
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 12
Bernhard is on a distinguished road
As far as I can see, you are trying to call a volScalarField constructor without any arguments. There is no such constructor, see: http://foam.sourceforge.net/docs/cpp/a00776.html , to construct a volScalarField, you need at least a mesh somewhere.
Bernhard 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
using fieldAverage library to average postprocessing eelcovv OpenFOAM Programming & Development 26 January 29, 2014 16:40
[ICEM] How can I create prism mesh for a 3D domain surrounded by a torus? lzgwhy ANSYS Meshing & Geometry 3 September 18, 2012 21:04
How to call FORTRAN files as UDF? Ehsan-F Fluent UDF and Scheme Programming 6 September 11, 2012 11:03
Actuator disk model audrich FLUENT 0 September 21, 2009 07:06
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 01:07


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