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

[Thank you for help] How comes this modified lapalacianFoam can not be 'wmake'?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 5, 2011, 12:58
Default [Thank you for help] How comes this modified lapalacianFoam can not be 'wmake'?
  #1
New Member
 
Wei Ma
Join Date: Feb 2011
Posts: 14
Rep Power: 6
merlyn is on a distinguished road
Hi, guys
There is a case that I am trying to add a time dependent term in laplacianFoam solver, which is theoretically easy, but when I typed in "wmake" after modified create.H, write.H, and cureLaplacianFoam.C, error occurred w/o detail.

my code in cureLaplacianFoam.C, changing from the original laplacianFoam.C:

//add line here//
fvScalarMatrix alphadot
(
fvm:a1*exp(-d1/R/T)+a2*exp(-d2/R/T)*alpha^m)*(1-alpha)^n
);
alphadot.solve();
//addition end//
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
solve
(
fvm::ddt(T) - fvm::laplacian(KRhoC, T)- HC*alphadot
);
//add line here//
solve
(
fvm::ddt(alpha) - alphadot
);
//addition end//
}


"alpha" is an added field, to be calculated by linear integration from "alphadot", which is a function of temperature and the last values of "alpha" as you see it.

and when I compiled it with wmake, error occurred as (you can just see the highlight sentence in the end of this bunch):

Making dependency list for source file cureLaplacianFoam.C
SOURCE=cureLaplacianFoam.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam171/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam171/src/OpenFOAM/lnInclude -I/opt/openfoam171/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/cureLaplacianFoam.o
cureLaplacianFoam.C: In function ‘int main(int, char**)’:
cureLaplacianFoam.C:58: error: expected unqualified-id before ‘(’ token
In file included from /opt/openfoam171/src/OpenFOAM/lnInclude/doubleFloat.H:30,
from /opt/openfoam171/src/OpenFOAM/lnInclude/floatScalar.H:38,
from /opt/openfoam171/src/OpenFOAM/lnInclude/scalar.H:39,
from /opt/openfoam171/src/OpenFOAM/lnInclude/IOstream.H:49,
from /opt/openfoam171/src/OpenFOAM/lnInclude/Ostream.H:39,
from /opt/openfoam171/src/OpenFOAM/lnInclude/OSstream.H:40,
from /opt/openfoam171/src/OpenFOAM/lnInclude/messageStream.H:219,
from /opt/openfoam171/src/OpenFOAM/lnInclude/error.H:51,
from /opt/openfoam171/src/OpenFOAM/lnInclude/UListI.H:26,
from /opt/openfoam171/src/OpenFOAM/lnInclude/UList.H:349,
from /opt/openfoam171/src/OpenFOAM/lnInclude/List.H:43,
from /opt/openfoam171/src/OpenFOAM/lnInclude/labelList.H:36,
from /opt/openfoam171/src/OpenFOAM/lnInclude/Pstream.H:43,
from /opt/openfoam171/src/OpenFOAM/lnInclude/OPstream.H:35,
from /opt/openfoam171/src/OpenFOAM/lnInclude/parRun.H:35,
from /opt/openfoam171/src/finiteVolume/lnInclude/fvCFD.H:4,
from cureLaplacianFoam.C:32:
/opt/openfoam171/src/OpenFOAM/lnInclude/products.H: At global scope:
/opt/openfoam171/src/OpenFOAM/lnInclude/products.H: In instantiation of ‘Foam::crossProduct<double, double>’:
cureLaplacianFoam.C:58: instantiated from here
/opt/openfoam171/src/OpenFOAM/lnInclude/products.H:85: error: no type named ‘type’ in ‘class Foam::typeOfRank<double, -0x00000000000000001>’
cureLaplacianFoam.C: In function ‘int main(int, char**)’:
cureLaplacianFoam.C:58: error: no match for ‘operator^’ in ‘Foam:perator+(const Foam::tmp<Foam::GeometricField<TypeR, PatchField, GeoMesh> >&, const Foam::tmp<Foam::GeometricField<Type1, PatchField, GeoMesh> >&) [with Type1 = double, Type2 = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&)((const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >*)(& Foam:perator*(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&, const Foam::GeometricField<double, PatchField, GeoMesh>&) [with PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh](((const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&)((const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>*)(& alpha)))))))) ^ m’
/opt/openfoam171/src/OpenFOAM/lnInclude/dimensionSet.H:279: note: candidates are: Foam::dimensionSet Foam:perator^(const Foam::dimensionSet&, const Foam::dimensionSet&)
/usr/include/c++/4.4/bits/ios_base.h:170: note: std::_Ios_Iostate std:perator^(std::_Ios_Iostate, std::_Ios_Iostate)
/usr/include/c++/4.4/bits/ios_base.h:132: note: std::_Ios_Openmode std:perator^(std::_Ios_Openmode, std::_Ios_Openmode)
/usr/include/c++/4.4/bits/ios_base.h:92: note: std::_Ios_Fmtflags std:perator^(std::_Ios_Fmtflags, std::_Ios_Fmtflags)
cureLaplacianFoam.C:58: warning: suggest parentheses around arithmetic in operand of ‘^’
/opt/openfoam171/src/finiteVolume/lnInclude/readSIMPLEControls.H:6: warning: unused variable ‘momentumPredictor’
/opt/openfoam171/src/finiteVolume/lnInclude/readSIMPLEControls.H:9: warning: unused variable ‘transonic’
make: *** [Make/linuxGccDPOpt/cureLaplacianFoam.o] Error 1


I dont know what happened to .o file, wondering if there is any problem in the solver, cureLaplacianFoam.C .

Thank you for help, I really appreciate your time!

-Merlin-
merlyn is offline   Reply With Quote

Old   March 5, 2011, 15:17
Default
  #2
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 229
Rep Power: 9
Cyp is on a distinguished road
Hi Merlin!

Your code can't compile. Indeed, your first declaration is a non-sense: alphadot is not a matrix. In fact it is just a field that depends on the other variables.

Code:
volScalarField alphadot = (a1*exp(-d1/R/T)+a2*exp(-d2/R/T)*alpha^m)*(1-alpha)^n;

        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
        {
            solve
            (
                fvm::ddt(T) - fvm::laplacian(KRhoC, T)- HC*alphadot
            );

//add line here//            
            solve
            (
                fvm::ddt(alpha) - alphadot
            );
//addition end//
         }
This snippet should work..

You can even optimise the resolution using fvm::Sp() to deal with the source term of your last equation...

@++
Cyp
Cyp is offline   Reply With Quote

Old   March 6, 2011, 14:45
Default
  #3
New Member
 
Wei Ma
Join Date: Feb 2011
Posts: 14
Rep Power: 6
merlyn is on a distinguished road
Quote:
Originally Posted by Cyp View Post
Hi Merlin!

Your code can't compile. Indeed, your first declaration is a non-sense: alphadot is not a matrix. In fact it is just a field that depends on the other variables.

Code:
volScalarField alphadot = (a1*exp(-d1/R/T)+a2*exp(-d2/R/T)*alpha^m)*(1-alpha)^n;

        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
        {
            solve
            (
                fvm::ddt(T) - fvm::laplacian(KRhoC, T)- HC*alphadot
            );

//add line here//            
            solve
            (
                fvm::ddt(alpha) - alphadot
            );
//addition end//
         }
This snippet should work..

You can even optimise the resolution using fvm::Sp() to deal with the source term of your last equation...

@++
Cyp
Hi Cyp,
Appreciate your help pretty much. I think it makes a lot of sense to me.
But...
After changing my code to those you provide, the same error occurred.
I think I should paste createFields.H here:

Info<< "Reading field T\n" << endl;

volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field alpha\n" << endl;

volScalarField alpha
(
IOobject
(
"alpha",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);


Info<< "Reading KRhoC\n" << endl;

dimensionedScalar KRhoC
(
transportProperties.lookup("KRhoC")
);

Info<< "Reading HC\n" << endl;

dimensionedScalar HC
(
transportProperties.lookup("HC")
);

Info<< "Reading cureProperties\n" << endl;

IOdictionary cureProperties
(
IOobject
(
"cureProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

Info<< "Reading a1\n" << endl;

dimensionedScalar a1
(
cureProperties.lookup("a1")
);

Info<< "Reading a2\n" << endl;

dimensionedScalar a2
(
cureProperties.lookup("a2")
);

Info<< "Reading d1\n" << endl;

dimensionedScalar d1
(
cureProperties.lookup("d1")
);

Info<< "Reading d2\n" << endl;

dimensionedScalar d2
(
cureProperties.lookup("d2")
);

Info<< "Reading R\n" << endl;

dimensionedScalar R
(
cureProperties.lookup("R")
);
Info<< "Reading m\n" << endl;

dimensionedScalar m
(
cureProperties.lookup("m")
);
Info<< "Reading n\n" << endl;

dimensionedScalar n
(
cureProperties.lookup("n")
);


actually, I cant find anything special here....I stored KRhoC and HC in transportproperties, and other parameters in cureProperties.
Sorry for bothering you and other guys again.
merlyn is offline   Reply With Quote

Old   March 6, 2011, 15:06
Default
  #4
Cyp
Senior Member
 
Cyprien
Join Date: Feb 2010
Location: Stanford University
Posts: 229
Rep Power: 9
Cyp is on a distinguished road
Hi!

Your last error comes from the power in your alphadot expression : in c++ a^b is pow(a,b).

Now, your code should compile perfectly.

Best,
Cyp
Cyp is offline   Reply With Quote

Old   March 6, 2011, 16:17
Default
  #5
New Member
 
Wei Ma
Join Date: Feb 2011
Posts: 14
Rep Power: 6
merlyn is on a distinguished road
Quote:
Originally Posted by Cyp View Post
Hi!

Your last error comes from the power in your alphadot expression : in c++ a^b is pow(a,b).

Now, your code should compile perfectly.

Best,
Cyp
Hi, Cyp
You are the MAN !! It has been complied smoothly.

Grateful for your instruction and learnt a lot from your suggestion!

Merlin-
Truly
merlyn is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM 1.7.1 installation problem on OpenSUSE 11.3 flakid OpenFOAM Installation 16 December 28, 2010 09:48
Problems Installing OF 1.6 32 bit bucksfan OpenFOAM Installation 19 August 4, 2009 01:36
OpenFOAM15 installables are incomplete problem with paraFoam tryingof OpenFOAM Bugs 17 December 7, 2008 05:41
Problem of compilation OF 14Allwmake command not found erik_d OpenFOAM Bugs 13 September 13, 2008 21:45
ParaFoam error message joey OpenFOAM Paraview & paraFoam 1 October 2, 2006 13:28


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