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

Don't know if this is a bug or

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2009, 06:40
Default Don't know if this is a bug or
  #1
New Member
 
Gerrie
Join Date: Aug 2009
Posts: 7
Rep Power: 16
thiart is on a distinguished road
if I am just plain dumb (probably the latter) but can somebody please help:

The offending piece of code I am trying to create in a modified turbulence model reads

void kEpsilonSwirl::updateSwirlSource()
{
Info << "Here 0" << endl;
const volVectorField& rP0 = mesh_.C()-axisPoint_;
Info << "Here 1" << endl;
const volVectorField& rProj0 = (rP0 & axisDir_)*axisDir_/magSqr(axisDir_);
Info << "Here 2 " << endl;
.....

As you see I have instrumented it to see where things go wrong: the code compiles OK but when I run it I get the following:

....

Selecting incompressible transport model Newtonian
Selecting turbulence model type RASModel
Selecting RAS turbulence model kEpsilonSwirl
kEpsilonSwirlCoeffs
{
Cmu 0.09;
C1 1.44;
C2 1.92;
alphaEps 0.76923;
axisDir axisDir [ 0 1 0 0 0 0 0 ] ( 1 0 0 );
axisPoint axisPoint [ 0 1 0 0 0 0 0 ] ( 0 0 0 );
sigmaEps 1.3;
}


Starting time loop

Time = 0.01

Courant Number mean: 0.0176233 max: 0.39971
DILUPBiCG: Solving for Ux, Initial residual = 1, Final residual = 2.55993e-10, No Iterations 3
DILUPBiCG: Solving for Uy, Initial residual = 1, Final residual = 1.37146e-06, No Iterations 2
DILUPBiCG: Solving for Uz, Initial residual = 1, Final residual = 3.3967e-07, No Iterations 2
DICPCG: Solving for p, Initial residual = 1, Final residual = 0.0558327, No Iterations 2
time step continuity errors : sum local = 1.42616e-05, global = -6.28859e-08, cumulative = -6.28859e-08
DICPCG: Solving for p, Initial residual = 0.0989443, Final residual = 7.7364e-07, No Iterations 57
time step continuity errors : sum local = 3.95132e-10, global = -1.68916e-12, cumulative = -6.28876e-08
Here 0
Here 1
terminate called after throwing an instance of 'std::length_error'
what(): basic_string::_S_create

I've tried a number of different options, which either don't compile or don't run.

Help!!

Gerrie Thiart
thiart is offline   Reply With Quote

Old   August 24, 2009, 05:51
Default
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Your code is wrong: you are taking a reference to a temporary. Do:

volVectorField rP0 = mesh_.C()-axisPoint_;

volVectorField rProj0 = (rP0 & xisDir_)*axisDir_/magSqr(axisDir_);

You cannot take a reference to a result of field algebra - it will be a new field.

Enjoy,

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   August 24, 2009, 05:56
Default Great! Thanks,
  #3
New Member
 
Gerrie
Join Date: Aug 2009
Posts: 7
Rep Power: 16
thiart is on a distinguished road
from a bedraggled C++ wannabee.

:-] Gerrie Thiart
thiart is offline   Reply With Quote

Reply


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
Maybe a bug in CFX12.0 BETA? frank CFX 4 November 26, 2008 18:08
Bug in twoPhaseEulerFoam wallfunctions alberto OpenFOAM Bugs 1 February 9, 2007 14:15
Bug reports Mattijs Janssens (Mattijs) OpenFOAM 0 January 10, 2005 10:05
Win XP hot fix bug!!! Emilio Siemens 1 March 27, 2003 12:06
Forum y2k Bug Jonas Larsson Main CFD Forum 1 January 5, 2000 10:22


All times are GMT -4. The time now is 21:04.