Don't know if this is a bug or
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
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
axisDir axisDir [ 0 1 0 0 0 0 0 ] ( 1 0 0 );
axisPoint axisPoint [ 0 1 0 0 0 0 0 ] ( 0 0 0 );
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
terminate called after throwing an instance of 'std::length_error'
I've tried a number of different options, which either don't compile or don't run.
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.
from a bedraggled C++ wannabee.
:-] Gerrie Thiart
|All times are GMT -4. The time now is 18:22.|