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

About Segmentation fault

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

Reply
 
LinkBack Thread Tools Display Modes
Old   February 13, 2013, 02:40
Default About Segmentation fault
  #1
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 4
mmkr825 is on a distinguished road
Hi foamers,
I prepared a solver to fit for my needs. When i compiled, it is giving no errors. But it is giving the following error when i run my case file.

Error Message:

Quote:
malli_reddy@ubuntu:~/OpenFOAM/malli_reddy-2.1.1/run/caseFile$ SBMFoam
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.1.1-221db2718bbb
Exec : SBMFoam
Date : Feb 13 2013
Time : 11:56:40
Host : "ubuntu"
PID : 5375
Case : /home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/run/caseFile
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading transportProperties

Reading field Q

Reading field p

Reading field U

Reading field T

Reading/calculating face flux field phi

No field sources present


SIMPLE: convergence criteria
field p tolerance 1e-05
field U tolerance 1e-05
field T tolerance 1e-05


Starting time loop

Time = 1nl [0 0 -1 0 0 0 0] 0.005626
#0 Foam::error:rintStack(Foam::Ostream&) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam211/platforms/linuxGccDPOpt/lib/libOpenFOAM.so"
#2 Uninterpreted:
#3
in "/home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/platforms/linuxGccDPOpt/bin/SBMFoam"
#4 __libc_start_main in "/lib/i386-linux-gnu/libc.so.6"
#5
in "/home/malli_reddy/OpenFOAM/malli_reddy-2.1.1/platforms/linuxGccDPOpt/bin/SBMFoam"
Segmentation fault
Can anyone tell me what this error message trying to convey. Thanks in advance.

Regards
Mallikarjuna
mmkr825 is offline   Reply With Quote

Old   February 13, 2013, 04:54
Default
  #2
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
anishtain4 is on a distinguished road
Somewhere in your solver either a divide by zero or a minus in sqrt is happening, this usually happens by setting some physical values in a bad range or some typos (like wrong parenthesis) in solver
anishtain4 is offline   Reply With Quote

Old   February 13, 2013, 05:26
Default
  #3
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 4
mmkr825 is on a distinguished road
Quote:
Originally Posted by anishtain4 View Post
Somewhere in your solver either a divide by zero or a minus in sqrt is happening, this usually happens by setting some physical values in a bad range or some typos (like wrong parenthesis) in solver
Hi anishtain,
Thanks very much for quick reply. In my solver due to mathematical operations using the Q tensor,
i defined Q as the following:
Quote:
Info<< "Reading field Q\n" << endl;
volTensorField Q
(
IOobject
(
"Q",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedTensor("Q",dimensionSet(0,0,0,0,0,0,0), tensor(0,0,0,0,0,0,0,0,0))
);
Actually Q is not a null matrix. Mathematically Q is (1, 0, 0, 0, 0.8, 0, 0, 0, 0.5). So i defined Q for the boundaries and internal fields inside the source code
for example in my code i did as the following:
Lets assume a boundary named "upperWall" then

Quote:
label upperWall = mesh.boundaryMesh().findPatchID("upperWall");
// upperWall
forAll(mesh.boundaryMesh()[upperWall],i)
{
Q.boundaryField()[upperWall][i].component(tensor::XX) = 1; //or any other values
Q.boundaryField()[upperWall][i].component(tensor::XY) = 0;
Q.boundaryField()[upperWall][i].component(tensor::XZ) = 0;
Q.boundaryField()[upperWall][i].component(tensor::YX) = 0;
Q.boundaryField()[upperWall][i].component(tensor::YY) = 0.8;
Q.boundaryField()[upperWall][i].component(tensor::YZ) = 0;
Q.boundaryField()[upperWall][i].component(tensor::ZX) = 0;
Q.boundaryField()[upperWall][i].component(tensor::ZY) = 0;
Q.boundaryField()[upperWall][i].component(tensor::ZZ) = 0.5;
}
in addition to the internal field:
Quote:
// assign Q on internal Field
/////////////////////////////////////////////////////////
forAll(mesh.cells(),j)
{
Q[j].component(tensor::XX) = 1;
Q[j].component(tensor::XY) = 0;
Q[j].component(tensor::XZ) = 0;
Q[j].component(tensor::YX) = 0;
Q[j].component(tensor::YY) = 0.8;
Q[j].component(tensor::YZ) = 0;
Q[j].component(tensor::ZX) = 0;
Q[j].component(tensor::ZY) = 0;
Q[j].component(tensor::ZZ) = 0.5;
}
//////////////////////////////////////////////////////////
I got this error when i defined as above.
I defined Q in the createFields.H directory and Q for the boundaries and internal fields inside the source code (in UEqn.H directory in my solver). I have doubt whether my approach is correct or not. Could you please tell me what the error message trying to convey.


Thanks
Mallikarjuna
mmkr825 is offline   Reply With Quote

Old   February 13, 2013, 06:08
Default
  #4
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
anishtain4 is on a distinguished road
I'm not sure what you're trying to do, so a comment about your solver would be somehow irrelevant. However I believe defining boundary conditions in the solver is not a good idea since you have to compile the whole solver with every change. That is not the idea behind openfoam, on the other hand you are not trying to write a solver to be included in openfoam distributions so it is not bad to first make it work and then putting some structure in it.

I suggest you to put some Info << in different lines of your solver to spot the line which is causing the break down, then you can scrutinize the line and spot the bug.
anishtain4 is offline   Reply With Quote

Old   February 13, 2013, 09:52
Default
  #5
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
The error seems to be a segmentation fault. This means that there is some memory issue.
I would compile the code in debug mode and use a tool like gdb to fix this.
adhiraj is offline   Reply With Quote

Old   February 13, 2013, 17:05
Default
  #6
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 4
mmkr825 is on a distinguished road
Quote:
Originally Posted by adhiraj View Post
The error seems to be a segmentation fault. This means that there is some memory issue.
I would compile the code in debug mode and use a tool like gdb to fix this.
Hi,
Thanks very much for reply. Actually i am very fresher to openFoam. From your message i understood that i did message in debugging. i studied this error in http://openfoamwiki.net/index.php/Main_FAQ but i am not able to notify this error. from this i know my basics is very poor. But can you you please tell me what actually it refers to.
mmkr825 is offline   Reply With Quote

Old   February 14, 2013, 02:29
Default
  #7
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Posts: 124
Rep Power: 8
anishtain4 is on a distinguished road
It means a mathematically illegal operation has been done
anishtain4 is offline   Reply With Quote

Old   February 14, 2013, 05:43
Default
  #8
Senior Member
 
Join Date: Mar 2010
Location: Germany
Posts: 112
Rep Power: 7
cutter is on a distinguished road
No, the error message from the first post explicitly says segmentation fault. In my optinion probably illegal memory access due to wrong array indexing. Mathematically illegal operations (division by zero etc..) usually result in floating point exceptions. Consult Wikipedia for a a nice introduction to both error types.
cutter is offline   Reply With Quote

Old   February 14, 2013, 09:25
Default
  #9
Member
 
M Mallikarjuna Reddy
Join Date: Jul 2012
Posts: 91
Rep Power: 4
mmkr825 is on a distinguished road
Hi cutter,
I studied about the error. For the full debug i need to set
WM_COMPILE_OPTION=Debug in the bashrc. But in bashrc i am not able to edit that part. Even though it is showing "USER EDITABLE PART", but it is not editing. can you please tell me to solve this problem.

Regards
Mallikarjuna

mmkr825 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
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 15:06
Segmentation Fault Shawn_A OpenFOAM Running, Solving & CFD 6 October 31, 2011 15:38
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 3 June 10, 2011 09:30
forrtl: severe (174): SIGSEGV, segmentation fault occurred therockyy FLOW-3D 7 January 19, 2011 23:52
ParaView segmentation fault only for multiphase gwierink OpenFOAM 9 March 25, 2010 08:23


All times are GMT -4. The time now is 20:44.