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

segmentation fault

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 22, 2005, 19:41
Default segmentation fault
  #1
Sheila
Guest
 
Posts: n/a
Hi everyone,

I am using sormom.f and I am running with double precision. I get segmentation fault if I set S1U S2U to some calculated value, but if I set them to 0.0 I dont get it... Any idea why and how to correct this?

Sheila
  Reply With Quote

Old   August 23, 2005, 05:11
Default Re: segmentation fault
  #2
4xF
Guest
 
Posts: n/a
Remember that the subroutine SORMOM.F is called for every cell individually. Check that your code respects this feature and also check that you are not accessing S1U and S2U as arrays.
  Reply With Quote

Old   August 23, 2005, 08:31
Default Re: segmentation fault
  #3
Sheila
Guest
 
Posts: n/a
Hi 4xF,

there is nothing in my code to invalidate any of what you have mentioned above. I have written S1U and s2U in terms of cell distances,velocities and viscosity. All of these are from common blocks provided by STAR.

My program seem to work for some mesh and not work for others. It definitely works for small mesh (36x400) and not for (47x400) for example on a 2 m length. These are quite small number meshes.

Sheila
  Reply With Quote

Old   August 23, 2005, 09:27
Default Re: segmentation fault
  #4
Oliver
Guest
 
Posts: n/a
But nevertheless, a segmentation fault in this context most often points to a bad array access (access of an invalid memory address).

This sort of problem could sometimes result in a segmentation fault, sometimes in bad results, depending on array sizes.

Please check your code again, especially the array accesses. Possibly you could post some of the important code lines.

Oliver
  Reply With Quote

Old   August 23, 2005, 20:51
Default Re: segmentation fault
  #5
Sheila
Guest
 
Posts: n/a
Its strange when I run the code with 45x400 or 49x400 cells its fine, but it only gives segmentation fault when runwith 47x400...

Ok, here is some part of my code,

C --- DISTANCES C

XEP = CX(1,IPE)-CX(1,IPSTAR)

XWP = CX(1,IPSTAR)-CX(1,IPW)

DX = DXX(IPSTAR) . . C --- WEIGHTING FACTOR

WFE = 0.5*DX/XEP . . C ---------- U MOMENTUM C

UP = UG(1,IPSTAR)

UPE = UG(1,IPE)

UPW = UG(1,IPW) . . C --- VISCOSITIES C

VISC = VIST

VISTE = VISTG(IPE)

VISTW = VISTG(IPW) . . . C --- COEFFICIENTS C

CON = 4./3.

AE = VISTEF/(DX*XEP)

AW = VISTWF/(DX*XWP) . . .

S1U = CON*((VISTWF*VWNS/DY)-(VISTEF*VENS/DY))/(TW*DX +SMALL)

S1U = S1U + ((VISTNF*VNEW/DX) - (VISTSF*VSEW/DX))/(DY+SMALL)

S1U = S1U + (AE*UPE + AW*UPW)*CON + AN*UPN + AS*UPS

S2U = (AE+AW)*CON + AN + AS . . .
  Reply With Quote

Old   August 24, 2005, 04:05
Default Re: segmentation fault
  #6
Oliver
Guest
 
Posts: n/a
Hi Sheila,

the code does not look bad. You should be careful with your divisions by dx, xep ... You should add everywhere a small where your denominator potentially could go to zero. But that shouldn't be the problem.

For me it would be interesting if you use 3.1x or 3.2x because it makes a difference for your local array definitions especially if they are dimensioned automatically with parm.inc. I assume that dxx, ug and vistg are arrays defined in your code. Perhaps these arrays have not the correct size? Sometimes it is helpful to compile the subroutines with debugging option as depending on compiler and operating system the problem line is shown together with the segmentation fault.

In cases like that I add print lines into the user subroutine code to find the exact position of the problem. Then you could concentrate on the arrays in that range. You could also add some variable output into these debugging print lines to better understand what is happening.

I know that it is a nasty job but usually it is a programming glitch which causes the segmentation fault. Segmentation faults in Fortran are most often access of array positions outside of the valid/defined range. Sometimes those accesses do not produce an error as they simply access a value of the following array but sometimes the memory position in question is not accessible and produces a segmentation fault.

Good luck

Oliver
  Reply With Quote

Old   August 24, 2005, 15:11
Default Re: segmentation fault
  #7
Sheila
Guest
 
Posts: n/a
I am using v3,15. All the parameters I am using are provided by STAR support team. And there is no problem with SMALL as those variables are always non-zero.

I always run with debugging and there is no problem reported when I starlink the case. It is running now for a higher number of mesh, it just would'nt run with that specific number of mesh (47x400) for some reason. And only with double precision.

Thanks for your comments and helps.
  Reply With Quote

Old   September 27, 2005, 22:16
Default Re: segmentation fault
  #8
Rodrigo M.S. de Oliveira
Guest
 
Posts: n/a
Have you tried the command

ulimit -s unlimited

before running the software?

  Reply With Quote

Old   October 9, 2005, 06:40
Default Re: segmentation fault
  #9
Sheila
Guest
 
Posts: n/a
I just tried it, it still is giving me segmentation fault
  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
[Technical] Segmentation fault in map msg30 OpenFOAM Meshing & Mesh Conversion 6 March 27, 2008 11:49
Segmentation fault billy OpenFOAM Installation 20 April 23, 2007 23:57
segmentation fault natesan Siemens 4 January 12, 2004 09:51
Segmentation fault Veebs Siemens 3 June 4, 2002 23:17
Segmentation fault Jose Sanchez Siemens 1 December 16, 2001 09:13


All times are GMT -4. The time now is 17:47.