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

Error while compiling a solver in OF5.0

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

Like Tree2Likes
  • 2 Post By MakisH

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 31, 2017, 21:01
Post Error while compiling a solver in OF5.0
  #1
New Member
 
R.B.
Join Date: Aug 2017
Posts: 7
Rep Power: 8
rbabhi is on a distinguished road
Dear all,
I am new to OpenFOAM. I have downloaded a solver (SbmFoam) that was created around 2012 (exact OF version is unknown or I have not found it yet).

While compiling in the OF5, I have found several issues while compiling. The first modification I made was to include the following lines to Make/options file:

Code:
    -I$(LIB_SRC)/meshTools/lnInclude
Following that I have deleted

Code:
#   include "readPISOControls.H"
from Ln69 of SbmFoam.C and added

Code:
#   include "pisoControl.H"
on Ln 46. However now when I run
Code:
wmake
I get the following errors:

Code:
.......5.0/run/SbmFoam$ wmake

Making dependency list for source file SbmFoam.C
g++ -std=c++11 -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam5/src/finiteVolume/lnInclude -I/opt/openfoam5/src/meshTools/lnInclude     -IlnInclude -I. -I/opt/openfoam5/src/OpenFOAM/lnInclude -I/opt/openfoam5/src/OSspecific/POSIX/lnInclude   -fPIC -c SbmFoam.C -o Make/linux64GccDPInt32Opt/SbmFoam.o
SbmFoam.C: In function ‘int main(int, char**)’:
SbmFoam.C:105:31: error: ‘nCorr’ was not declared in this scope
         for (int corr=0; corr<nCorr; corr++)
                               ^
SbmFoam.C:118:26: error: passing ‘const Foam::fvMatrix<Foam::Vector<double> >’ as ‘this’ argument discards qualifiers [-fpermissive]
             UEqn().relax();
                          ^
In file included from /opt/openfoam5/src/finiteVolume/lnInclude/fvMatrix.H:1061:0,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/ddtScheme.C:29,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/ddtScheme.H:342,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvcDdt.C:28,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvcDdt.H:205,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvc.H:44,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from SbmFoam.C:45:
/opt/openfoam5/src/finiteVolume/lnInclude/fvMatrix.C:674:6: note:   in call to ‘void Foam::fvMatrix<Type>::relax() [with Type = Foam::Vector<double>]’
 void Foam::fvMatrix<Type>::relax()
      ^
SbmFoam.C:122:44: error: passing ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::Boundary’ as ‘this’ argument discards qualifiers [-fpermissive]
             p.boundaryField().updateCoeffs();
                                            ^
In file included from /opt/openfoam5/src/OpenFOAM/lnInclude/GeometricField.C:1352:0,
                 from /opt/openfoam5/src/OpenFOAM/lnInclude/GeometricField.H:660,
                 from /opt/openfoam5/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                 from /opt/openfoam5/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/volFields.H:37,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:27,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:307,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvc.H:39,
                 from /opt/openfoam5/src/finiteVolume/lnInclude/fvCFD.H:8,
                 from SbmFoam.C:45:
/opt/openfoam5/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:399:6: note:   in call to ‘void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::updateCoeffs() [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]’
 void Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::
      ^
SbmFoam.C:133:42: error: ‘nNonOrthCorr’ was not declared in this scope
             for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
                                          ^
/opt/openfoam5/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt32Opt/SbmFoam.o' failed
make: *** [Make/linux64GccDPInt32Opt/SbmFoam.o] Error 1
I have just started learning about OF and I was wondering if anyone can guide towards the right direction to troubleshoot this issue with this code.

If it is any help, I am running guest Ubuntu 16.04 on a VirtualBox host Windows 10.

Many thanks.

Last edited by rbabhi; September 1, 2017 at 05:41. Reason: Correction
rbabhi is offline   Reply With Quote

Old   September 1, 2017, 13:02
Default
  #2
New Member
 
Join Date: May 2016
Posts: 28
Rep Power: 10
MakisH is on a distinguished road
There are mainly two problems here.

The first one is:
Code:
SbmFoam.C:105:31: error: ‘nCorr’ was not declared in this scope
         for (int corr=0; corr<nCorr; corr++)
                               ^
This means probably that nCorr was declared and defined in the readPISOControls.H file, which you needed to delete.

For this, I think that this commit message and this topic may help. As a first step, try replacing the

Code:
for (int corr=0; corr<nCorr; corr++)
with

Code:
while (piso.correct())
More errors may follow, I have not tried to compile it.

The second problem is:
Code:
SbmFoam.C:118:26: error: passing ‘const Foam::fvMatrix<Foam::Vector<double> >’ as ‘this’ argument discards qualifiers [-fpermissive]
             UEqn().relax();
                          ^
This means that you are trying to make changes on a constant object, which is not allowed. Keep in mind that in OpenFOAM v4.0, there were some changes in handling (const) references. See this topic and the release notes of v4.0 (see "Robust data handling") for more details.

I think you can just solve it if you replace

Code:
UEqn().relax()
with

Code:
UEqn.ref().relax()
(or maybe with UEqn().ref().relax(), I am not sure right now).
Kummi and hdotyao like this.
MakisH is offline   Reply With Quote

Old   September 2, 2017, 12:36
Default
  #3
New Member
 
R.B.
Join Date: Aug 2017
Posts: 7
Rep Power: 8
rbabhi is on a distinguished road
Many thanks for your reply. Even after trying your suggestions and fixing several errors, I was left with lists of other issues that I needed to solve. I just gave up at the end and installed OF 1.7.1 and the file compiles perfectly well.
rbabhi is offline   Reply With Quote

Old   January 21, 2020, 02:51
Default
  #4
Member
 
Bidesh Sengupta
Join Date: Sep 2018
Location: Sngapore
Posts: 76
Rep Power: 7
BSengupta is on a distinguished road
Hi!
I apologies for hopping into a previous post. But I find this post relevant to my present problem. I am describing my problem:

I am trying to write some code by modifying densityBasedTurbo in foam extend 4. I am getting the following error:

************************************************** ************************************************** *************************
BSTurboFoam.C:127:25: error: passing ‘const surfaceVectorField {aka const Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>}’ as ‘this’ argument discards qualifiers [-fpermissive]
dbnsFlux.dotX() = mrfZones.faceU();

**************************************************
In BSTurboFoam.C : dbnsFlux.dotX() = mrfZones.faceU();

**************************************************

In numericFlux.H:

.....
const surfaceVectorField& dotX() const //virtual
{
return dotX_;
}

surfaceVectorField& dotX()
{
return dotX_;
}
....

**************************************************

In numericFlux.C:

template<class Flux, class Limiter>
Foam::numericFlux<Flux, Limiter>::numericFlux
(
const volScalarField& p,
const volVectorField& U,
const volScalarField& T,
basicThermo& thermo
)
:
numericFluxBase<Flux>(p.mesh()),
p_(p),
U_(U),
T_(T),
thermo_(thermo),
rhoFlux_
(
....
),
rhoUFlux_
(
...
),
rhoEFlux_
(
...
),
dotX_
(
IOobject
(
"dotX",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedVector("zero", dimVelocity, vector::zero)
)

{}

**************************************************

In MRFZone.C :
void Foam::MRFZone::faceU
(
surfaceVectorField& zoneFaceU
) const
{
...
}

**************************************************
In MRFZones.C :
Foam::tmp<Foam::surfaceVectorField> Foam::MRFZones::faceU() const
{
tmp<surfaceVectorField> tMRFZonesFaceU
(
new surfaceVectorField
(
...
)
);
surfaceVectorField& MRFZonesFaceU = tMRFZonesFaceU();

forAll(*this, i)
{
operator[](i).faceU(MRFZonesFaceU);
}

return tMRFZonesFaceU;
}


I shall be greatly helped if the error gets resolved and can proceed further. Thanks a lot for your time.


Bidesh
BSengupta is offline   Reply With Quote

Old   January 22, 2020, 03:35
Default
  #5
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 7
raumpolizei is on a distinguished road
Have you tried to just pass the return argument of faceU() to a field? Might be less efficient but lets try to understand the problem first.
Code:
{
surfaceVectorField faceU = mrfZones.faceU()
dbnsFlux.dotX() = faceU;
}
raumpolizei is offline   Reply With Quote

Old   January 22, 2020, 19:09
Default
  #6
Member
 
Bidesh Sengupta
Join Date: Sep 2018
Location: Sngapore
Posts: 76
Rep Power: 7
BSengupta is on a distinguished road
Quote:
Originally Posted by raumpolizei View Post
Have you tried to just pass the return argument of faceU() to a field? Might be less efficient but lets try to understand the problem first.
Code:
{
surfaceVectorField faceU = mrfZones.faceU()
dbnsFlux.dotX() = faceU;
}

Hi,


Thanks a lot for your reply and suggestion. I tried the method you suggested but getting the same error.


Code:
BSTurboFoam.C:129:19: error: passing ‘const surfaceVectorField {aka const Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>}’ as ‘this’ argument discards qualifiers [-fpermissive]
   dbnsFlux.dotX() = faceU;
Can it be due to the following part in
In numericFlux.C
Quote:
template<class Flux, class Limiter>
Foam::numericFlux<Flux, Limiter>::numericFlux
(
const volScalarField& p,
const volVectorField& U,
const volScalarField& T,
basicThermo& thermo
)
:
numericFluxBase<Flux>(p.mesh()),
p_(p),
U_(U),
T_(T),
thermo_(thermo),
rhoFlux_
(
IOobject
(
"phi",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
(linearInterpolate(thermo_.rho()*U_) & this->mesh().Sf())
),
rhoUFlux_
(
IOobject
(
"rhoUFlux",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
rhoFlux_*linearInterpolate(U_)
),
rhoEFlux_
(
IOobject
(
"rhoEFlux",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
rhoFlux_*linearInterpolate(thermo.Cv()*T_ + 0.5*magSqr(U_))
),
dotX_
(
IOobject
(
"dotX",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedVector("zero", dimVelocity, vector::zero)
)

{}
...
I think seeing this error, dotX is not properly defined as const function. I have defined dotX in numericFlux.H as:
Quote:
virtual const surfaceVectorField& dotX() const
{
return dotX_;
}
Thanks a lot for your time.

Last edited by BSengupta; January 23, 2020 at 00:12.
BSengupta is offline   Reply With Quote

Reply

Tags
cfd code, sbmfoam, wmake error, wmake problems, wmake warning

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
make: Clock skew detected. build may be incomplete. while compiling new solver. savee OpenFOAM Programming & Development 1 May 27, 2017 06:23
Hybrid discretisation - blend factor gcoopermax CFX 5 September 23, 2016 08:05
Compiling meltFoam solver mick223 OpenFOAM Programming & Development 12 July 31, 2015 10:33
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
Compiling new Solver with wmake lin123 OpenFOAM 3 April 13, 2010 14:18


All times are GMT -4. The time now is 16:24.