|
[Sponsors] |
August 22, 2005, 19:41 |
segmentation fault
|
#1 |
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 |
|
August 23, 2005, 05:11 |
Re: segmentation fault
|
#2 |
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.
|
|
August 23, 2005, 08:31 |
Re: segmentation fault
|
#3 |
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 |
|
August 23, 2005, 09:27 |
Re: segmentation fault
|
#4 |
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 |
|
August 23, 2005, 20:51 |
Re: segmentation fault
|
#5 |
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 . . . |
|
August 24, 2005, 04:05 |
Re: segmentation fault
|
#6 |
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 |
|
August 24, 2005, 15:11 |
Re: segmentation fault
|
#7 |
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. |
|
September 27, 2005, 22:16 |
Re: segmentation fault
|
#8 |
Guest
Posts: n/a
|
Have you tried the command
ulimit -s unlimited before running the software? |
|
October 9, 2005, 06:40 |
Re: segmentation fault
|
#9 |
Guest
Posts: n/a
|
I just tried it, it still is giving me segmentation fault
|
|
|
|
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 |