CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Dimensioned%2360Type new class delaration (https://www.cfd-online.com/Forums/openfoam-solving/59386-dimensioned-2360type-new-class-delaration.html)

diegon February 18, 2007 12:47

Hi everybody, I am working
 
Hi everybody,

I am working to the definition of a new class for RTE solvers, but I have problems with dimensioned<type>, if I declare a dimensionedScalar as a RTE member, while compling I am obtaining the following message:

RTEModel/RTEModel.C:76: error: no matching function for call to 'Foam::dimension ed<double>::dimensioned()'....

In order to build my new class I have taken a look to forum, doxygen and turbulunceModel.H and .C.

In .H I have called the declareRunTimeSelectionTable constructor in this way:

declareRunTimeSelectionTable
(
autoPtr,
RTEModel,
dictionary,
(
const volScalarField& T,
const volScalarField& Kabs
),
(T, Kabs)
);

And the autoptr to New:

static autoPtr<rtemodel> New
(
const volScalarField& T,
const volScalarField& Kabs

);

I also used:
defineTypeNameAndDebug(RTEModel, 0);
defineRunTimeSelectionTable(RTEModel, dictionary);

I have built the RTE::RTE function in this way:

RTEModel::RTEModel
(
const word& type,
const volScalarField& T,
const volScalarField& Kabs

)
:
IOdictionary
(
IOobject
(
"RTEModelSettings",
T.time().constant(),
T.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),

runTime_(T.time()),
mesh_(T.mesh()),

T_(T),
Kabs_(Kabs),


RTE_(lookup("RTE")),
RTEModelSets_(subDict(type + "Sets"))

And following the same structure of turbulence model I reported in newRTEModel.C:

autoPtr<rtemodel> RTEModel::New
(
const volScalarField& T,
const volScalarField& Kabs

)
{
word RTEModelTypeName;

// Enclose the creation of the RTEsetsDict to ensure it is
// deleted before the RTEModel is created otherwise the dictionary
// is entered in the database twice
{
IOdictionary RTEModelSettingsDict
(
IOobject
(
"RTEModelSettings",
T.time().constant(),
T.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

RTEModelSettingsDict.lookup("RTEModel")
>> RTEModelTypeName;
}

Info<< "Selecting RTE model " << RTEModelTypeName << endl;

dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(RTEModelTypeName);

if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"RTEModel::New(const volScalarField& T, "
"const volScalarField& Kabs, const volScalarField& Emissivity"
")"
) << "Unknown RTEModel type " << RTEModelTypeName
<< endl << endl
<< "Valid RTEModel types are :" << endl
<<>toc()
<< exit(FatalError);
}

return autoPtr<rtemodel>
(
cstrIter() (T, Kabs)
);
}


I am sure to have followed the turbulunceModel declaration, but I also have to say that I have never used the RunTimeSelection utilities.

Thanks in advance.


Diego

diegon February 18, 2007 13:03

I have to correct part of my p
 
I have to correct part of my previous post.

The error I am obtaining is:

error: no matching function for call to 'Foam::dimensioned<double>::dimensioned()'note: candidates are: Foam::dimensioned<type>::dimensioned(Foam::Istream &) [with Type = double]...and the others suitable.

I am not obtaining an error with dimensioned<type> if I istantiate it in this way (letting my scalar be sigma): "sigma("sigma",dimensionSet(1,0,-3,-4,0),5.67040e-8).

While I am obtaining error if is use:
lookup("RTE") >> RTE_;
RTEModelSets_ = subDict(type() + "Sets");

if (found("sigma"))
{
lookup("sigma") >> sigma;
}

richpaj October 12, 2007 02:59

undefined reference to new the
 
undefined reference to new thermophysical class constructors

Hello,

I hope I chose a relevant thread regarding the creation of new classes.

Under OpenFOAM-1.3 on SUSE 10.1 using gcc 4.1.0 and where ld -v gives
2.16.91.0.5 20051219

I wonder if anyone has any ideas about the following:

I've encountered the following issue when trying to link
"libmyThermophysicalModels.so" (based on modifications to "basicThermo",
"hCombustionThermo" and "hMixtureThermo") with the main/top-level code:

Linux: undefined reference to constructor (in this case the constructor of
"myhMixtureThermo")

"collect2; ld returned 1 exit status"




Interestingly (or otherwise....) under OpenFOAM-1.3 on OSX (ver 10.4.10) using gcc
4.0.1 the various "dylib" libraries compile and link, however, at run-time I
get:

"dyld: lazy symbol binding failed: Symbol not found: ...."

This occurs when the following is attempted in "mynewhCombustionThermo.C"

return autoPtr<myhcombustionthermo> ( cstrIter()( myArgumentList ) );


I've preserved the overall structures of "basicThermo", "hCombustionThermo" and
"hMixtureThermo" and have merely added functions and altered constructor
argument lists. (Though I did comment out the 'ifdefNoReposiory ...'
conditional at the foot of myhMixtureThermo). The "thermotype" is correctly
read from the "thermophysicalProperties" dictionary and forms the correct "head"
(to use Mathematica terminology) of the function. The snag being that the resulting
constructor is not recognized.....

I've scoured the relevant openFOAM docs, message boards, and wiki site but the nearest
I've come to an answer was the suggestion made at

http://openfoamwiki.net/index.php/Ho...e_OpenFOAM_Mac

namely that the above trouble could be related to linker issues. For the Mac, other sites have recommended using
gcc 3.X (set by gcc_select ) to get around the lazy symbol problem for that platform. Tried the latter but resetting the
default compiler is currently proving troublesome.

However, I reckon my problem is self-inflicted by some erroneous coding.......

I'd be very grateful for any suggestions,

Many prospective thanks,

Richard Kenny.

richpaj October 12, 2007 13:51

Having just read http://ww
 
Having just read

http://www.sunsite.ualberta.ca/Documentation/Gnu/gcc-3.0.2/html_node/gcc_120.htm l#SEC120

I can now see that the linkage problems above relate to handling the various instantiations of the templates
contained within the thermophysical library. Perhaps it was hasty after all to comment
out the "NoRepository" conditional at the bottom of the myhMixtureThermo.H file.


All times are GMT -4. The time now is 09:55.