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

Problems initializing a turbulence model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 26, 2008, 13:51
Default Hello I added a turbulence
  #1
Member
 
srinath
Join Date: Mar 2009
Location: Champaign, USA
Posts: 91
Rep Power: 17
srinath is on a distinguished road
Hello

I added a turbulence model to a compressible solver, by adding the following lines in createfields.

Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::rasmodel> turbulence
(
compressible::RASModel::New
(
rho,
U,
massPhi,
thermo()
)
);

The code compiles but i get a segfault at this location during runtime.
gdb gives the following error

(gdb) where
#0 0xb72c6f8f in Foam::compressible::RASModels::kEpsilon::kEpsilon ()
from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
#1 0xb72ecdff in Foam::compressible::RASModel::adddictionaryConstru ctorToTable<foam::compressible ::rasmodels::kepsilon>::New ()
from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
#2 0xb72a1beb in Foam::compressible::RASModel::New () from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
#3 0x080676f7 in main ()

I would appreciate it if someone, could give me some suggestions. I think i am overlooking something small, as i don't even get into the time loop

Regards
Srinath
srinath is offline   Reply With Quote

Old   November 27, 2008, 08:17
Default Hi Srinath! It would be eas
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Srinath!

It would be easier, if you could give us the line number (in other words output from a debug-version would be great)

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   November 27, 2008, 09:42
Default Hi Bernhard I have attached
  #3
Member
 
srinath
Join Date: Mar 2009
Location: Champaign, USA
Posts: 91
Rep Power: 17
srinath is on a distinguished road
Hi Bernhard

I have attached the output of the debugger, and the relevant code fragment. The problem occurs when the constructor for turbulence is invoked.
It is right at the end of the code fragment.

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread -1232189232 (LWP 12520)]
0xb727df8f in Foam::compressible::RASModels::kEpsilon::kEpsilon ()
from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
(gdb) up
#1 0xb72a3dff in Foam::compressible::RASModel::adddictionaryConstru ctorToTable<foam::compressible ::rasmodels::kepsilon>::New ()
from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
(gdb) up
#2 0xb7258beb in Foam::compressible::RASModel::New ()
from /home/srinath/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libcompressibleRASModels.s o
(gdb) up
#3 0x0806b064 in main (argc=52, argv=0x8221c5c) at createFields.H:126

Here is createFields.H
Info<< "Reading thermophysical properties\n" << endl;

autoPtr<basicthermo> thermo
(
basicThermo::New(mesh)
);

volScalarField& p = thermo->p();
volScalarField& h = thermo->h();
const volScalarField& T = thermo->T();
const volScalarField& psi = thermo->psi();
const volScalarField& mu = thermo->mu();

bool inviscid(true);
if (max(mu.internalField()) > 0.0)
{
inviscid = false;
}

Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "rhoBoundaryTypes.H"
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
//IOobject::NO_READ,
//IOobject::AUTO_WRITE
),
thermo->rho()
//rhoBoundaryTypes
);
/*
Info<< "Reading field T\n" << endl;
volScalarField T
(
IOobject
(
"T",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
*/
volVectorField rhoU
(
IOobject
(
"rhoU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*U
);

volScalarField rhoE
(
IOobject
(
"rhoE",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*(h + 0.5*magSqr(U)) - p
);
surfaceScalarField pos
(
IOobject
(
"pos",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("pos", dimless, 1.0)
);

surfaceScalarField neg
(
IOobject
(
"neg",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("neg", dimless, -1.0)
);

#include "createMassPhi.H"

Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::rasmodel> turbulence
(
compressible::RASModel::New
(
rho,
U,
massPhi,
thermo()
)
);
srinath is offline   Reply With Quote

Old   November 27, 2008, 11:06
Default Hi Sinrath! It looks alrigh
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Hi Sinrath!

It looks alright from here. But you're still using an Opt-Version so it doesn't give filenames and line numbers in kEpsilon.

DO YOURSELF A FAVOUR: compile a Debug-Version if you plan to do solver development (somewhere on the Wiki there is an explanation on it). It gives you more information and it checks for some mistakes (out of bounds access etc) that the Opt-Version does not (for performance reasons). Start the compilation this evening before you leave work and tomorrow try your solver with that version. TRUST ME: IT IS WELL INVESTED TIME

Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
Problems with boundary conditions for a lowRekOmegaSST turbulence model cfdmarkus OpenFOAM Running, Solving & CFD 16 November 14, 2011 05:44
Initializing fluid level on VOF model Daniel FLUENT 5 July 3, 2009 04:45
Problem initializing Reynolds stress turbulence Vinicius Siemens 0 January 29, 2009 07:03
Convergence problems with SSG turbulence model Ram CFX 1 June 19, 2006 11:08
HELP! TURBULENCE k-e OR k-omega TURBULENCE MODEL? Mirek Kabacinski FLUENT 5 August 24, 2003 23:31


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