CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > 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 Search this Thread Display Modes
Old   June 19, 2013, 05:44
Default Troubles when create a new volScalarField in my own library
  #1
Member
 
X Meng
Join Date: Jun 2012
Location: Scotland
Posts: 89
Rep Power: 13
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, 05:50
Default
  #2
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
fail? your question is too vague, atleast post your error line
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   June 19, 2013, 06:18
Default
  #3
Member
 
X Meng
Join Date: Jun 2012
Location: Scotland
Posts: 89
Rep Power: 13
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, 09:10
Default
  #4
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,266
Blog Entries: 1
Rep Power: 24
nimasam is on a distinguished road
would you mind!, add your pieces of code here too
__________________
My Personal Website (http://nimasamkhaniani.ir/)
Telegram channel (https://t.me/cfd_foam)
nimasam is offline   Reply With Quote

Old   June 19, 2013, 11:48
Default
  #5
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
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, 13:26
Default
  #6
Member
 
X Meng
Join Date: Jun 2012
Location: Scotland
Posts: 89
Rep Power: 13
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, 03:42
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
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 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
using fieldAverage library to average postprocessing eelcovv OpenFOAM Programming & Development 32 May 17, 2022 10:55
[ICEM] How can I create prism mesh for a 3D domain surrounded by a torus? lzgwhy ANSYS Meshing & Geometry 5 May 18, 2017 18:10
How to call FORTRAN files as UDF? Ehsan-F Fluent UDF and Scheme Programming 6 September 11, 2012 12:03
Actuator disk model audrich FLUENT 0 September 21, 2009 08:06
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 02:07


All times are GMT -4. The time now is 08:10.