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

error : invalid use of void expression

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 27, 2013, 04:57
Default error : invalid use of void expression
  #1
New Member
 
saeid oqaz
Join Date: Feb 2012
Posts: 19
Rep Power: 5
saeid.oqaz is on a distinguished road
hi foamers.

my problem is entrophy Generation shown in following picture :


i write a code for of220 & got this error.
code:

Code:
    volVectorField gradT = fvc::grad(T);    
        volScalarField gradTx = gradT.component(0);
        volScalarField gradTy = gradT.component(1);
        
    volScalarField uX = U.component(0);
    volScalarField uY = U.component(1);
    volVectorField graduX = fvc::grad(uX);
    volVectorField graduY = fvc::grad(uY);
        volScalarField dudx = graduX.component(0);
        volScalarField dvdy = graduY.component(1);
        volScalarField dudy = graduX.component(1);
        volScalarField dvdx = graduY.component(0);
   

fvScalarMatrix SEqn
(
          Sgen
        == (k/Foam::pow(T,2))*(Foam::pow(gradTx,2)+Foam::pow(gradTy,2))
         + (mu/T)*(Foam::pow(dudx,2)+Foam::pow(dvdy,2))*2
         + (mu/T)*Foam::pow((dudy+dvdx),2)
); 

SEqn.solve();
error:

Code:
In file included from myPorousSimpleFoam.C:73:0:
SEqn.H: In function ‘int main(int, char**)’:
SEqn.H:21:1: error: invalid use of void expression
make: *** [Make/linux64GccDPOpt/myPorousSimpleFoam.o] Error 1
saeid.oqaz is offline   Reply With Quote

Old   September 27, 2013, 04:58
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Which line is number 21?
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   September 27, 2013, 05:11
Default
  #3
New Member
 
saeid oqaz
Join Date: Feb 2012
Posts: 19
Rep Power: 5
saeid.oqaz is on a distinguished road
line 21 : );
saeid.oqaz is offline   Reply With Quote

Old   September 27, 2013, 06:04
Default
  #4
New Member
 
saeid oqaz
Join Date: Feb 2012
Posts: 19
Rep Power: 5
saeid.oqaz is on a distinguished road
Quote:
Originally Posted by akidess View Post
Which line is number 21?
thanks anton. my problem is solved.

using fvc::grad is an explicit operation that actually returns an volScalarFields, not fvScalarMatrix.

Code:
volScalarField Sgen
(
           (k/Foam::pow(T,2))*(Foam::pow(gradTx,2)+Foam::pow(gradTy,2))
         + (mu/T)*(Foam::pow(dudx,2)+Foam::pow(dvdy,2))*2
         + (mu/T)*Foam::pow((dudy+dvdx),2)
);
saeid.oqaz 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
writing execFlowFunctionObjects immortality OpenFOAM Post-Processing 30 September 15, 2013 06:16
How to install CGNS under windows xp? lzgwhy Main CFD Forum 1 January 11, 2011 19:44
CGNS lib and Fortran compiler manaliac Main CFD Forum 2 November 29, 2010 07:25
BlockMeshmergePatchPairs hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36
OpenFoam 14 installation problem gfcoppola OpenFOAM Installation 20 November 2, 2007 14:38


All times are GMT -4. The time now is 22:07.