CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   Error compiling OpenFoam 1.6.x with intel compiler icc (https://www.cfd-online.com/Forums/openfoam-installation/73040-error-compiling-openfoam-1-6-x-intel-compiler-icc.html)

mak_04 February 25, 2010 04:16

Error compiling OpenFoam 1.6.x with intel compiler icc
 
I have checked out the latest version from the repository "OpenFoam 1.6.x"

And I get the following error compiling it with icc (11.0):

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C(4 5): error: member "Foam::NamedEnum<Enum, nEnum>::names [with Enum=Foam::compressible::turbulentHeatFluxTemperat ureFvPatchScalarField::heatSourceType, nEnum=2]" cannot be specialized in the current scope
names[] =
^

The is in the file:
src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C

g++ does not give this error. It seems that the partially specialized template in this file is not allowed by icc while gcc seems to be ignoring it.

icc version: 11.0

Any idea what can be done?

Thanks,

wyldckat February 25, 2010 05:59

Greetings Mak,

I knew I saw something recently about icc... According to this post, OpenFOAM 1.6.x is prepared to work with icc 11.1. Prior to that version, it doesn't work all that well.

I personally have very little experience with icc, but my advice is to get the latest free version of icc for Linux, and compare the two versions. Or read the release notes for the latest version and see what's the difference!

In case you had already seen that post, you could have let us know ;)

Best regards,
Bruno

joris February 25, 2010 06:04

I have the same problem. I think this link describes the problem and some solutions:
http://stackoverflow.com/questions/1470654

joris February 25, 2010 06:52

Quote:

Originally Posted by joris (Post 247347)
I have the same problem. I think this link describes the problem and some solutions:
http://stackoverflow.com/questions/1470654

I followed the instructions in this link and now it compiles fine with icc/icpc

1) comment out the template specialization at the top of the file:

/*
template<>
const char*
NamedEnum<turbulentHeatFluxTemperatureFvPatchScala rField::heatSourceType, 2>::
names[] =
{
"power",
"flux"
};
*/

2) add the following to the bottom of the file (outside the namespaces!):

template<>
const char*
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
names[] =
{
"power",
"flux"
};

pbohorquez April 7, 2010 18:45

Please, could you fix the blank space in the word F lux?

Foam::NamedEnum<Foam::compressible::turbulentHeatF lux

Thanks, now it works for me.

achim October 28, 2011 07:06

OpenFOAM with Intel compiler (OF 1.7.1)
 
Quote:

Originally Posted by joris (Post 247360)
I followed the instructions in this link and now it compiles fine with icc/icpc

1) comment out the template specialization at the top of the file:

/*
template<>
const char*
NamedEnum<turbulentHeatFluxTemperatureFvPatchScala rField::heatSourceType, 2>::
names[] =
{
"power",
"flux"
};
*/

2) add the following to the bottom of the file (outside the namespaces!):

template<>
const char*
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
names[] =
{
"power",
"flux"
};


---------------------------------------------------------------------
I tried to follow this way, but my compilation fails:

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C(2 40): error: namespace "Foam::compressible" has no member "turbulentHeatF"
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
^

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C(2 40): error: name followed by "::" must be a class or namespace name
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
^

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C(2 40): error: too few arguments for class template "Foam::NamedEnum"
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
^

derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C(2 40): error: expected a ";"
Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
^
Here's my source:

...
34 namespace Foam
35 {
36 namespace compressible
37 {
38
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
40
41 /*
42 (http://www.cfd-online.com/Forums/ope...tml#post247360)
43 template<>
44 const char*
45 NamedEnum<turbulentHeatFluxTemperatureFvPatchScala rField::heatSourceType, 2>::
46 names[] =
47 {
48 "power",
49 "flux"
50 };
51 */
52
53 const
54 NamedEnum<turbulentHeatFluxTemperatureFvPatchScala rField::heatSourceType, 2>
55 turbulentHeatFluxTemperatureFvPatchScalarField::he atSourceTypeNames_;
56
57
...

233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234
235 } // End namespace compressible
236 } // End namespace Foam
237
238 template<>
239 const char*
240 Foam::NamedEnum<Foam::compressible::turbulentHeatF luxTemperatureFvPatchScalarField::heatSourceType, 2>::
241 names[] =
242 {
243 "power",
244 "flux"
245 };
246
247 //
************************************************** *********************** //
248

my icpc is
Version 12.0.2



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