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

compiling error(s) in a modified twoPhaseEulerFoam solver

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

Like Tree4Likes
  • 1 Post By Cyp
  • 3 Post By Cyp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 29, 2012, 16:39
Default compiling error(s) in a modified twoPhaseEulerFoam solver
  #1
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Hi

I am trying to compile a modified version of the solver twoPhaseEulerFoam. The errors that arise are the following:


Making dependency list for source file twoPhaseEulerFoam.C
SOURCE=twoPhaseEulerFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I../bubbleFoam -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IphaseModel/lnInclude -Iaveraging -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseEulerFoam.o
In file included from twoPhaseEulerFoam.C:77:
UEqns.H: In function ‘int main(int, char**)’:
UEqns.H:8: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to non-scalar type ‘Foam::volScalarField’ requested
UEqns.H:9: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘Foam::scalar’ in initialization
UEqns.H:10: error: cannot convert ‘Foam::dimensionedScalar’ to ‘Foam::scalar’ in initialization
UEqns.H:19: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:31: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
UEqns.H:51: error: ‘nutb’ was not declared in this scope
UEqns.H:59: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:71: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
readPPProperties.H:15: warning: unused variable ‘preAlphaExp’
readPPProperties.H:20: warning: unused variable ‘alphaMax’
readPPProperties.H:25: warning: unused variable ‘expMax’
make: *** [Make/linux64GccDPOpt/twoPhaseEulerFoam.o] Error 1


I am especially interested if someone could tell me how to go around the error i get in UEqns on line 8. In the UEqns.H file on line 8, the following is written:

volScalarField Umix = (rhoa*alpha*Ua + rhob * beta * Ub) / (rhoa * alpha + rhob * beta);

By inspection of the UEqns.H file, Umix is included in more places downwards in the code. I hence have a sense of that this is the reason for the rest of the errors in the UEqns.H file.


Could someone please help me with these compiling problems ?

Any help is deeply appreciated

Alex
foamer is offline   Reply With Quote

Old   February 29, 2012, 16:48
Default
  #2
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Try volVectorField instead of volScalarField, it should works !

Regards,
Cyp
elham usefi likes this.
Cyp is offline   Reply With Quote

Old   February 29, 2012, 17:07
Default
  #3
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Thanks very much Cyp!

That actually did work.

However, after i recompiled the solver, i still have som errors:


Making dependency list for source file twoPhaseEulerFoam.C
SOURCE=twoPhaseEulerFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I../bubbleFoam -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IphaseModel/lnInclude -Iaveraging -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseEulerFoam.o
In file included from twoPhaseEulerFoam.C:77:
UEqns.H: In function ‘int main(int, char**)’:
UEqns.H:10: error: cannot convert ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to ‘Foam::scalar’ in initialization
UEqns.H:11: error: cannot convert ‘Foam::dimensionedScalar’ to ‘Foam::scalar’ in initialization
UEqns.H:20: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:32: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
UEqns.H:52: error: ‘nutb’ was not declared in this scope
UEqns.H:60: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:72: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
readPPProperties.H:15: warning: unused variable ‘preAlphaExp’
readPPProperties.H:20: warning: unused variable ‘alphaMax’
readPPProperties.H:25: warning: unused variable ‘expMax’
make: *** [Make/linux64GccDPOpt/twoPhaseEulerFoam.o] Error 1


Do you know how to go around any of these ?


Alex
foamer is offline   Reply With Quote

Old   February 29, 2012, 17:13
Default
  #4
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
What is it on UEqn.H line 10 ??
Cyp is offline   Reply With Quote

Old   February 29, 2012, 17:15
Default
  #5
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
It is:

scalar nutb = ct * Umix * pipeDia;


Alex
foamer is offline   Reply With Quote

Old   March 1, 2012, 04:09
Default
  #6
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
You have to keep in mind that in OpenFOAM, the variable are a specific object :

when you declare a scalar field, for example nut as volScalarField, this means that nut is :
- a table defined over the mesh,
- with boundary conditions,
- a name ("nut"),
- a dimensionSet

When you perform mathematical operation (+, - ,*, / ...) with such variables, you add (in the case of the addition) the table value (internalField), the boundary value, the dimensions..

In the line you present me, you try to define a scalar (just a number) from a volVectorField (a table of vector defined all over the mesh), and two other terms... it is absolutly not coherent !!!

just think of what you want to do !

I may found many informations in this doc : powerlab.fsb.hr/ped/kturbo/openfoam/docs/foam.pdf

Regards,
Cyp
Pirlu, panachristos and Fschi like this.
Cyp is offline   Reply With Quote

Old   March 1, 2012, 04:32
Default
  #7
Member
 
Laurens Van Dyck
Join Date: Jul 2011
Location: Netherlands/Germany
Posts: 34
Rep Power: 14
laurensvd is on a distinguished road
Cyp is correct, in the last formula you try to compute a scalar by using other scalars (ct, pipeDia) and a vector (Umix). Think of what is actually meant in the formula. Do you need the longitudonal velocity (extract the component of U in that direction), do you need the magnutide of the velocity (use mag(Umix) instead of Umix) or do you need something else?

On top of that, as Cyp mentioned, your vector Umix is defined in every cell whereas you want to compute a global value. Think if it really is a global value or if it is a value that is different throughout the field. If it is the latter initialise nutb as a volScalarField instead of a scalar.
laurensvd is offline   Reply With Quote

Old   March 1, 2012, 06:57
Default
  #8
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Quote:
Originally Posted by Cyp View Post
You have to keep in mind that in OpenFOAM, the variable are a specific object :

when you declare a scalar field, for example nut as volScalarField, this means that nut is :
- a table defined over the mesh,
- with boundary conditions,
- a name ("nut"),
- a dimensionSet

When you perform mathematical operation (+, - ,*, / ...) with such variables, you add (in the case of the addition) the table value (internalField), the boundary value, the dimensions..

In the line you present me, you try to define a scalar (just a number) from a volVectorField (a table of vector defined all over the mesh), and two other terms... it is absolutly not coherent !!!

just think of what you want to do !

I may found many informations in this doc : powerlab.fsb.hr/ped/kturbo/openfoam/docs/foam.pdf

Regards,
Cyp

Yes you are right. Actually, in the expression on line 10: scalar nutb = Ct * Umix * pipeDia, i put the scalar in front since without it, i got teh error message :

UEqns.H:10: error: ‘nutb’ was not declared in this scope

So i am not sure how to deal with it. But thanks for the link, i will definetely have a look into it.

Alex
foamer is offline   Reply With Quote

Old   March 1, 2012, 07:22
Default
  #9
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Quote:
Originally Posted by laurensvd View Post
Cyp is correct, in the last formula you try to compute a scalar by using other scalars (ct, pipeDia) and a vector (Umix). Think of what is actually meant in the formula. Do you need the longitudonal velocity (extract the component of U in that direction), do you need the magnutide of the velocity (use mag(Umix) instead of Umix) or do you need something else?

On top of that, as Cyp mentioned, your vector Umix is defined in every cell whereas you want to compute a global value. Think if it really is a global value or if it is a value that is different throughout the field. If it is the latter initialise nutb as a volScalarField instead of a scalar.
Thank you for your reply.

I think that the velocity Umix is supposed to be a constant value through the whole pipe. So i guess that it should be constant in each cell then...

If i use mag(Umix) i get the error message that Umix was not declared in this scope..

If i initialise nutb as a volScalarField instead of a scalar i get the error mesage:

UEqns.H:10: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to non-scalar type ‘Foam::volScalarField’ requested


Alex
foamer is offline   Reply With Quote

Old   March 1, 2012, 07:34
Default
  #10
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Btw, my whole UEqns.H file look like the following:


fvVectorMatrix UaEqn(Ua, Ua.dimensions()*dimVol/dimTime);
fvVectorMatrix UbEqn(Ub, Ub.dimensions()*dimVol/dimTime);
// scalar nutb = 1.0 ; // Use new var. name : NOS
// scalar nuEffa, nuEffb ; // Use new var. name : NOS
{
{
volTensorField gradUaT = fvc::grad(Ua)().T();
//volScalarField Umix = (rhoa * alpha * Ua + rhob * beta * Ub) / (rhoa *alpha + rhob * beta);
volVectorField Umix = (rhoa * alpha * Ua + rhob * beta * Ub) / (rhoa * alpha + rhob * beta);
volScalarField nutb = Ct * Umix * pipeDia; // Mixing length
scalar nuEffa = nutb + nua;

volTensorField Rca
(
"Rca",
((2.0/3.0)*I)*(nuEffa*tr(gradUaT)) - nuEffa*gradUaT // Turbulent kinetic energy combined with pressure
);

surfaceScalarField phiRa =
-fvc::interpolate(nuEffa)*mesh.magSf()*fvc::snGrad( alpha)
/fvc::interpolate(alpha + scalar(0.001));

UaEqn =
(
scalar(1)*
(
fvm::ddt(Ua)
+ fvm::div(phia, Ua, "div(phia,Ua)")
- fvm::Sp(fvc::div(phia), Ua)
)

- fvm::laplacian(nuEffa, Ua)
+ fvc::div(Rca)

+ fvm::div(phiRa, Ua, "div(phia,Ua)")
- fvm::Sp(fvc::div(phiRa), Ua)
+ (fvc::grad(alpha)/(fvc::average(alpha) + scalar(0.001)) & Rca)
==

// g // Buoyancy term transfered to p-equation
- fvm::Sp(KWalla, Ua) // Wall friction
- fvm::Sp(KInta, Ua) // Interface drag
//+ KIa*Ub/rhoa // Explicit interface drag transfered to p-equation

);

UaEqn.relax();
}

{
volTensorField gradUbT = fvc::grad(Ub)().T();
scalar nuEffb = nutb + nub;
volTensorField Rcb
(
"Rcb",
((2.0/3.0)*I)*(nuEffb*tr(gradUbT)) - nuEffb*gradUbT
);

surfaceScalarField phiRb =
-fvc::interpolate(nuEffb)*mesh.magSf()*fvc::snGrad( beta)
/fvc::interpolate(beta + scalar(0.001));

UbEqn =
(
scalar(1)*
(
fvm::ddt(Ub)
+ fvm::div(phib, Ub, "div(phib,Ub)")
- fvm::Sp(fvc::div(phib), Ub)
)

- fvm::laplacian(nuEffb, Ub)
+ fvc::div(Rcb)

+ fvm::div(phiRb, Ub, "div(phib,Ub)")
- fvm::Sp(fvc::div(phiRb), Ub)

+ (fvc::grad(beta)/(fvc::average(beta) + scalar(0.001)) & Rcb)
==

// g // Buoyancy term transfered to p-equation
- fvm::Sp(KWallb, Ub) // Wall friction phaseb
- fvm::Sp(KIntb, Ub) // Interfacial drag
//+ KIa*Ua/rhob // Explicit interface drag transfered to p-equation
);

UbEqn.relax();
}
}


I get the following compiling error message :


SOURCE=twoPhaseEulerFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/applications/solvers/multiphase/bubbleFoam -I/opt/openfoam171/src/finiteVolume/lnInclude -I/opt/openfoam171/src/transportModels/incompressible/lnInclude -IphaseModel/lnInclude -Iaveraging -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/twoPhaseEulerFoam.o
In file included from twoPhaseEulerFoam.C:77:
UEqns.H: In function ‘int main(int, char**)’:
UEqns.H:10: error: conversion from ‘Foam::tmp<Foam::GeometricField<Foam::Vector<doubl e>, Foam::fvPatchField, Foam::volMesh> >’ to non-scalar type ‘Foam::volScalarField’ requested
UEqns.H:11: error: cannot convert ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >’ to ‘Foam::scalar’ in initialization
UEqns.H:20: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:32: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
UEqns.H:52: error: ‘nutb’ was not declared in this scope
UEqns.H:60: error: no matching function for call to ‘interpolate(Foam::scalar&)’
UEqns.H:72: error: no matching function for call to ‘laplacian(Foam::scalar&, Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:8: warning: unused variable ‘momentumPredictor’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:11: warning: unused variable ‘transonic’
/opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:14: warning: unused variable ‘nOuterCorr’
readPPProperties.H:15: warning: unused variable ‘preAlphaExp’
readPPProperties.H:20: warning: unused variable ‘alphaMax’
readPPProperties.H:25: warning: unused variable ‘expMax’
make: *** [Make/linux64GccDPOpt/twoPhaseEulerFoam.o] Error 1


Alex
foamer is offline   Reply With Quote

Old   March 1, 2012, 07:37
Default
  #11
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
And btw have you read what we explain to you ?

Code:
volScalarField nutb = Ct * mag(Umix) * pipeDia;
should works (If Umix is a volVectorField, then mag(Umix) is a volScalarField defined on every cells of your mesh, it is not a constant !). But once again, it depends on the way you declare Ct and pipeDia...
Cyp is offline   Reply With Quote

Old   March 9, 2012, 11:14
Default
  #12
Member
 
Alexander
Join Date: Jul 2011
Posts: 38
Rep Power: 14
foamer is on a distinguished road
Quote:
Originally Posted by Cyp View Post
And btw have you read what we explain to you ?

Code:
volScalarField nutb = Ct * mag(Umix) * pipeDia;
should works (If Umix is a volVectorField, then mag(Umix) is a volScalarField defined on every cells of your mesh, it is not a constant !). But once again, it depends on the way you declare Ct and pipeDia...

You are right.

I was a little tired of not getting it to work.

However, now it compiled fine

Thank you very much for your help.
foamer is offline   Reply With Quote

Old   March 9, 2012, 11:32
Default
  #13
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 299
Rep Power: 18
Cyp is on a distinguished road
Quote:
Originally Posted by foamer View Post
You are right.

I was a little tired of not getting it to work.

However, now it compiled fine

Thank you very much for your help.

you're welcome
Cyp is offline   Reply With Quote

Old   June 20, 2014, 01:33
Default
  #14
New Member
 
Pirlu Jing
Join Date: Aug 2013
Posts: 6
Rep Power: 12
Pirlu is on a distinguished road
Hi Cyp,

your answers also help me. May i ask one more simple question?

How can i convert volScalarField to a scalar, or just get the 'value' from the volScalarField variable?

I tried scalar vf (voidfraction); but the complier complains that it is not allowed in initialisation.

Thanks in advance,
Jing
Pirlu is offline   Reply With Quote

Old   June 20, 2014, 09:51
Default
  #15
New Member
 
Pirlu Jing
Join Date: Aug 2013
Posts: 6
Rep Power: 12
Pirlu is on a distinguished road
Quote:
Originally Posted by Pirlu View Post
Hi Cyp,

your answers also help me. May i ask one more simple question?

How can i convert volScalarField to a scalar, or just get the 'value' from the volScalarField variable?

I tried scalar vf (voidfraction); but the complier complains that it is not allowed in initialisation.

Thanks in advance,
Jing
Thank to this link: http://www.cfd-online.com/Forums/ope...dimension.html

I think i found the simple solution.
Pirlu 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
wmake compiling new solver mksca OpenFOAM Programming & Development 14 June 22, 2018 07:29
c++ libraries and solver compiling vaina74 OpenFOAM Installation 13 February 3, 2012 18:43
error compiling solver in OpenFOAM 1.6-ext: pimpleDymFoam tupe OpenFOAM 0 October 3, 2011 06:55
Various errors: Floating point, UDF compiling, etc SEMC FLUENT 1 September 6, 2011 10:08
Setting a B.C using UserFortran in 4.3 tokai CFX 10 July 17, 2001 17:25


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