|
[Sponsors] |
August 22, 2009, 07:40 |
Don't know if this is a bug or
|
#1 |
New Member
Gerrie
Join Date: Aug 2009
Posts: 7
Rep Power: 17 |
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 |
|
August 24, 2009, 06:51 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33 |
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 |
|
August 24, 2009, 06:56 |
Great! Thanks,
|
#3 |
New Member
Gerrie
Join Date: Aug 2009
Posts: 7
Rep Power: 17 |
from a bedraggled C++ wannabee.
:-] Gerrie Thiart |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Maybe a bug in CFX12.0 BETA? | frank | CFX | 4 | November 26, 2008 19:08 |
Bug in twoPhaseEulerFoam wallfunctions | alberto | OpenFOAM Bugs | 1 | February 9, 2007 15:15 |
Bug reports | Mattijs Janssens (Mattijs) | OpenFOAM | 0 | January 10, 2005 11:05 |
Win XP hot fix bug!!! | Emilio | Siemens | 1 | March 27, 2003 13:06 |
Forum y2k Bug | Jonas Larsson | Main CFD Forum | 1 | January 5, 2000 11:22 |