|
[Sponsors] |
December 19, 2014, 08:52 |
Segmentation Fault error after min-max
|
#1 |
New Member
Bharat Bhushan Sharma
Join Date: Nov 2014
Posts: 8
Rep Power: 12 |
Hello Dear Foamers,
I have been writing one of my solver and am stucked at one place due to segmentation fault error. Given below are the details about this error. Code:
boundaryField { adiabatic { type zeroGradient; } heater { type zeroGradient; } inlet { type zeroGradient; } outlet { type zeroGradient; } frontAndBack { type empty; } } DILUPBiCG: Solving for H, Initial residual = 1, Final residual = 1.75168e-16, No Iterations 1 Enthalpy Min(H) = -2.5054e+23 Max(H) = 5.6046e+36 #0 Foam::error::printStack(Foam::Ostream&) in "/opt/openfoam230/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #1 Foam::sigSegv::sigHandler(int) in "/opt/openfoam230/platforms/linux64GccDPOpt/lib/libOpenFOAM.so" #2 in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::relativePermeabilityModels::krBrooksAndCorey::correct() in "/root/OpenFOAM/root-2.3.0/platforms/linux64GccDPOpt/lib/libporousModels.so" #4 in "/root/OpenFOAM/root-2.3.0/platforms/linux64GccDPOpt/bin/impesFoam" #5 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #6 in "/root/OpenFOAM/root-2.3.0/platforms/linux64GccDPOpt/bin/impesFoam" Code:
forAll(H_,i) { if( ( H_[i] > -ROL_.value()*(scalar(2)*hvsat_.value() - hlsat_.value()) ) && ( (H_[i] < -ROV_.value()*hvsat_.value()) || (H_[i] == -ROV_.value()*hvsat_.value()) ) ) { T_[i] = TSAT_.value(); dTdH_[i] = scalar(0.0); Sb_[i] = - ( H_[i] + ROV_.value()*hvsat_.value() )/( ROL_.value()*hlg_.value() + (ROL_.value() - ROV_.value())*hvsat_.value() ); } } This piece of code is written inside krBrooksAndCarey.H which contains a derived class called krBrooksAndCarey. This is derived from a base abstract class wherein this H_ is declared as a volScalarField using following: volScalarField H_ Also the H volscalarField which is a primitive variable for enthalpy equation is declared in createFields.H file as: volScalarField H ( IOobject ( "H", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); I think there is something wrong with H volScalarField. I think there is no connection b/w H_ and H defined separately. I wish them to be representing same field variable. But dont know how to do so. Can someone help me sortout this problem. I am really stucked. Bharat |
|
December 19, 2014, 09:41 |
|
#2 |
Member
|
Hi Bharat,
Just an idea, please make sure that all the variables are properly initialized, sometimes that gives a Segmentation Fault error. Best, Likun |
|
December 20, 2014, 01:36 |
|
#3 |
Senior Member
|
Hi all,
I agree with Likun, check the initialization of the variables. I think your solver is not able to initialize the variable (in your custom BC) which leads to the segmentation fault. I am not expert on custom BC, anyways I think the error could be in this formulation: Code:
forAll(H_,i) {......} Code:
forAll(H_.BoundaryField(),i) {......} - Best Regards! Last edited by Tushar@cfd; December 20, 2014 at 01:58. Reason: Added a line |
|
December 24, 2014, 03:31 |
|
#4 |
New Member
Bharat Bhushan Sharma
Join Date: Nov 2014
Posts: 8
Rep Power: 12 |
can the error be due to values out of bound as is printed below ?
Enthalpy Min(H) = -2.5054e+23 Max(H) = 5.6046e+36 Can some one tell me what is the maximum and minimum numerical value supported by openFoam in double or single precision ? |
|
December 24, 2014, 09:30 |
|
#5 |
New Member
Bharat Bhushan Sharma
Join Date: Nov 2014
Posts: 8
Rep Power: 12 |
problem solved....
:-) Last edited by bharat.gmail; December 24, 2014 at 10:41. |
|
August 2, 2017, 19:13 |
|
#6 |
Member
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14 |
Hi all,
I have a similar problem. When I initialize a 3D array and run it for n=128, it crashes with Segmentation fault. The exact line where this happens is Code:
double array[n+2][n+2][n+2]; Thanks, Sugajen |
|
August 7, 2017, 04:53 |
|
#7 | |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
Quote:
|
||
August 7, 2017, 15:30 |
|
#8 |
Member
Sugajen
Join Date: Jan 2012
Location: Tempe, USA
Posts: 52
Rep Power: 14 |
Hi all,
I solved my problem using the following way of dynamically allocating a 3D array so that the heap memory is used. If we do a declaration as I had done on my original post, the stack memory will be used which has some memory limitations that could cause segmentation error. Code:
double ***array = new double**[n+2]; for (int i = 0; i < n+2; i++) { array[i] = new double*[n+2]; for (int j = 0; j < n+2; j++) array[i][j] = new double[n+2]; } Code:
for(int i = 0; i < n+2; ++i) { for(int j = 0; j < n+2; ++j) { delete[] array[i][j]; } delete[] array[i]; } Sugajen |
|
September 18, 2017, 08:37 |
sigsegv error
|
#9 |
New Member
Pooja Verma
Join Date: May 2017
Posts: 13
Rep Power: 9 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
y+ and u+ values with low-Re RANS turbulence models: utility + testcase | florian_krause | OpenFOAM | 114 | August 23, 2023 06:37 |
multiphase turbulance case floating error | harsha_kulkarni | OpenFOAM Running, Solving & CFD | 3 | February 18, 2016 06:06 |
Problem of simulating of small droplet with radius of 2mm | liguifan | OpenFOAM Running, Solving & CFD | 5 | June 3, 2014 03:53 |
On the damBreak4phaseFine cases | paean | OpenFOAM Running, Solving & CFD | 0 | November 14, 2008 22:14 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |