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

Problem with pos() or Scalar.H

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 25, 2011, 17:52
Default Problem with pos() or Scalar.H
  #1
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 6
seboxx is on a distinguished road
Hi community,

I am trying to calculate the size of a wave segment.
Herefore I use
Code:
fvc::domainIntegrate(pos(u-1e-12))
u is my variable which is a volScalarField.

This is the error message I get
Quote:
In file included from fhnSolver.C:45:
/home/boie/OpenFOAM/OpenFOAM-reloaded/OpenFOAM-2.0.0/src/OpenFOAM/lnInclude/Scalar.H: In function 'int main(int, char**)':
/home/boie/OpenFOAM/OpenFOAM-reloaded/OpenFOAM-2.0.0/src/OpenFOAM/lnInclude/Scalar.H:38: error: expected primary-expression before 'template'
/home/boie/OpenFOAM/OpenFOAM-reloaded/OpenFOAM-2.0.0/src/OpenFOAM/lnInclude/Scalar.H:38: error: expected ';' before 'template'
/home/boie/OpenFOAM/OpenFOAM-reloaded/OpenFOAM-2.0.0/src/finiteVolume/lnInclude/initContinuityErrs.H:37: warning: unused variable 'cumulativeContErr'
fhnSolver.C:82: error: expected '}' at end of input
make: *** [Make/linuxGccDPOpt/fhnSolver.o] Error 1
This sounds like a problem in the Scalar.H header file.
But the Scalar.H file seems fine to me, is there any known problem with it?
I am using Scalar.H because pos() is declared in it.
Also I think the last error that } is missing is also related to that... cuz it disappears if I comment out the include Scalar.H

Is anyone able to make more sense of it?

I am happy about any suggestions. Thanks
seboxx is offline   Reply With Quote

Old   September 26, 2011, 04:44
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
Works for me. Post up the simplest test case you have. What version of OF are you using?
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 26, 2011, 05:03
Default
  #3
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 6
seboxx is on a distinguished road
Hi there,

I am using OF 2.0.0
I have had a look... even a Solver which is perfectly working doesnt compile anymore if I add the simple line
Code:
#include "Scalar.H"
without actually using one of its functions...
I have attached the file if you want to have a look at it...
I am really confused.

Thank you for your help.
Sebastian
Attached Files
File Type: h Scalar.H (5.4 KB, 8 views)
seboxx is offline   Reply With Quote

Old   September 26, 2011, 05:20
Default
  #4
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
Ok, don't include Scalar.H, it will compile fine. Scalar.H contains template specialisations for type Scalar. If you're interested have a look at http://www.cantrip.org/traits.html.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 26, 2011, 07:07
Default
  #5
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 6
seboxx is on a distinguished road
Yea the compilation works.
But I have a problem which I had before. The pos(u-1e-12) gives me values either 0 or 1 depending whether u>1e-12.
Which is good

But by doing
Code:
double Size;
S=pos(u-1e-12);
Size = domainIntegrate(S).value()
I get a uniform value which is 90000 which doesnt depend on u at all.
I encountered this problem before, that's why i figured I might need Scalar.H for a proper pos() function.
My domain is a block of size 1000 * 1000 * 0.1
therefore the 90000 isnt even the size of my domain...
Any idea why I get this constant value?
seboxx is offline   Reply With Quote

Old   September 27, 2011, 04:27
Default
  #6
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 14
l_r_mcglashan will become famous soon enough
Well S will be a field of 1s and 0s. You're then integrating, which will mean you sum all the 1s multiplied by the size of the volume they are in.

Do it on a simpler field with a much smaller size that you know should give you a specific answer.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan is offline   Reply With Quote

Old   September 27, 2011, 05:36
Default
  #7
Member
 
Join Date: Aug 2011
Posts: 33
Rep Power: 6
seboxx is on a distinguished road
You are right. I got confused due to the complexity of my field. Thanks for the hints
seboxx 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
UDF compiling problem Wouter Fluent UDF and Scheme Programming 6 June 6, 2012 04:43
Gambit - meshing over airfoil wrapping (?) problem JFDC FLUENT 1 July 11, 2011 05:59
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13
convergence problem Trushar Phoenics 5 August 27, 2002 23:40


All times are GMT -4. The time now is 02:14.